Package org.apache.storm.localizer
Class LocalizedResource
java.lang.Object
org.apache.storm.localizer.LocallyCachedBlob
org.apache.storm.localizer.LocalizedResource
Represents a resource that is localized on the supervisor. A localized resource has a .current symlink to the current version file which
is named filename.{current version}. There is also a filename.version which contains the latest version.
-
Field Summary
Fields inherited from class org.apache.storm.localizer.LocallyCachedBlob
localUpdateTime, NOT_DOWNLOADED_VERSION
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clean up any temporary files.protected void
commitNewVersion
(long version) Commit the new version and make it available for the end user.void
Completely remove anything that is cached locally for this blob and all tracking files also stored for it.boolean
long
fetchUnzipToTemp
(ClientBlobStore store) Download the latest version to a temp location.long
Get the version of the blob cached locally.long
getRemoteVersion
(ClientBlobStore store) Get the version of the blob in the blob store.long
Get the amount of disk space that is used by this blob.int
hashCode()
boolean
protected void
setSize
(long size) toString()
Methods inherited from class org.apache.storm.localizer.LocallyCachedBlob
addReference, fetch, getDependencies, getKey, getLastUsed, getSizeOnDisk, informReferencesAndCommitNewVersion, isUsed, removeReference, touch, update
-
Method Details
-
setSize
protected void setSize(long size) -
getLocalVersion
public long getLocalVersion()Description copied from class:LocallyCachedBlob
Get the version of the blob cached locally. If the version is unknown or it has not been downloaded NOT_DOWNLOADED_VERSION should be returned. PRECONDITION: this can only be called with a lock on this instance held.- Specified by:
getLocalVersion
in classLocallyCachedBlob
-
getRemoteVersion
public long getRemoteVersion(ClientBlobStore store) throws KeyNotFoundException, AuthorizationException Description copied from class:LocallyCachedBlob
Get the version of the blob in the blob store. PRECONDITION: this can only be called with a lock on this instance held.- Specified by:
getRemoteVersion
in classLocallyCachedBlob
- Throws:
KeyNotFoundException
AuthorizationException
-
fetchUnzipToTemp
public long fetchUnzipToTemp(ClientBlobStore store) throws IOException, KeyNotFoundException, AuthorizationException Description copied from class:LocallyCachedBlob
Download the latest version to a temp location. This may also include unzipping some or all of the data to a temp location. PRECONDITION: this can only be called with a lock on this instance held.- Specified by:
fetchUnzipToTemp
in classLocallyCachedBlob
- Parameters:
store
- the store to us to download the data.- Returns:
- the version that was downloaded.
- Throws:
IOException
KeyNotFoundException
AuthorizationException
-
commitNewVersion
Description copied from class:LocallyCachedBlob
Commit the new version and make it available for the end user. PRECONDITION: uncompressToTempLocationIfNeeded will have been called. PRECONDITION: this can only be called with a lock on this instance held.- Specified by:
commitNewVersion
in classLocallyCachedBlob
- Parameters:
version
- the version of the blob to commit.- Throws:
IOException
-
cleanupOrphanedData
Description copied from class:LocallyCachedBlob
Clean up any temporary files. This will be called after updating a blob, either successfully or if an error has occured. The goal is to find any files that may be left over and remove them so space is not leaked. PRECONDITION: this can only be called with a lock on this instance held.- Specified by:
cleanupOrphanedData
in classLocallyCachedBlob
- Throws:
IOException
-
completelyRemove
Description copied from class:LocallyCachedBlob
Completely remove anything that is cached locally for this blob and all tracking files also stored for it. This will be called after the blob was determined to no longer be needed in the cache. PRECONDITION: this can only be called with a lock on this instance held.- Specified by:
completelyRemove
in classLocallyCachedBlob
- Throws:
IOException
-
getSizeOnDisk
public long getSizeOnDisk()Description copied from class:LocallyCachedBlob
Get the amount of disk space that is used by this blob. If the blob is uncompressed it should be the sum of the space used by all of the uncompressed files. In general this will not be called with any locks held so it is a good idea to cache it and updated it when committing a new version.- Specified by:
getSizeOnDisk
in classLocallyCachedBlob
-
isFullyDownloaded
public boolean isFullyDownloaded()- Specified by:
isFullyDownloaded
in classLocallyCachedBlob
-
equals
-
hashCode
public int hashCode() -
toString
-