Package org.apache.storm.localizer
Class LocallyCachedTopologyBlob
java.lang.Object
org.apache.storm.localizer.LocallyCachedBlob
org.apache.storm.localizer.LocallyCachedTopologyBlob
A locally cached blob for the topology.  storm.jar, stormcode.ser, or stormconf.ser.
 The version number of the blob's file will be stored in `${basename}.version`
- 
Nested Class SummaryNested Classes
- 
Field SummaryFieldsFields inherited from class org.apache.storm.localizer.LocallyCachedBloblocalUpdateTime, NOT_DOWNLOADED_VERSION
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedLocallyCachedTopologyBlob(String topologyId, boolean isLocalMode, Map<String, Object> conf, AdvancedFSOps fsOps, LocallyCachedTopologyBlob.TopologyBlobType type, String owner, StormMetricsRegistry metricsRegistry) Create a new LocallyCachedBlob.
- 
Method SummaryModifier and TypeMethodDescriptionvoidClean up any temporary files.protected voidcommitNewVersion(long newVersion) Commit the new version and make it available for the end user.voidCompletely remove anything that is cached locally for this blob and all tracking files also stored for it.booleanprotected voidextractDirFromJar(String jarpath, String dir, Path dest) longfetchUnzipToTemp(ClientBlobStore store) Download the latest version to a temp location.longGet the version of the blob cached locally.longgetRemoteVersion(ClientBlobStore store) Get the version of the blob in the blob store.longGet the amount of disk space that is used by this blob.inthashCode()booleantoString()Methods inherited from class org.apache.storm.localizer.LocallyCachedBlobaddReference, fetch, getDependencies, getKey, getLastUsed, getSizeOnDisk, informReferencesAndCommitNewVersion, isUsed, removeReference, touch, update
- 
Field Details- 
LOCAL_MODE_JAR_VERSIONpublic static final long LOCAL_MODE_JAR_VERSION- See Also:
 
 
- 
- 
Constructor Details- 
LocallyCachedTopologyBlobprotected LocallyCachedTopologyBlob(String topologyId, boolean isLocalMode, Map<String, Object> conf, AdvancedFSOps fsOps, LocallyCachedTopologyBlob.TopologyBlobType type, String owner, StormMetricsRegistry metricsRegistry) throws IOExceptionCreate a new LocallyCachedBlob.- Parameters:
- topologyId- the ID of the topology.
- type- the type of the blob.
- owner- the name of the user that owns this blob.
- Throws:
- IOException
 
 
- 
- 
Method Details- 
getLocalVersionpublic long getLocalVersion()Description copied from class:LocallyCachedBlobGet 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:
- getLocalVersionin class- LocallyCachedBlob
 
- 
getRemoteVersionpublic long getRemoteVersion(ClientBlobStore store) throws KeyNotFoundException, AuthorizationException Description copied from class:LocallyCachedBlobGet the version of the blob in the blob store. PRECONDITION: this can only be called with a lock on this instance held.- Specified by:
- getRemoteVersionin class- LocallyCachedBlob
- Throws:
- KeyNotFoundException
- AuthorizationException
 
- 
fetchUnzipToTemppublic long fetchUnzipToTemp(ClientBlobStore store) throws IOException, KeyNotFoundException, AuthorizationException Description copied from class:LocallyCachedBlobDownload 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:
- fetchUnzipToTempin class- LocallyCachedBlob
- Parameters:
- store- the store to us to download the data.
- Returns:
- the version that was downloaded.
- Throws:
- IOException
- KeyNotFoundException
- AuthorizationException
 
- 
extractDirFromJar- Throws:
- IOException
 
- 
isFullyDownloadedpublic boolean isFullyDownloaded()- Specified by:
- isFullyDownloadedin class- LocallyCachedBlob
 
- 
commitNewVersionDescription copied from class:LocallyCachedBlobCommit 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:
- commitNewVersionin class- LocallyCachedBlob
- Parameters:
- newVersion- the version of the blob to commit.
- Throws:
- IOException
 
- 
cleanupOrphanedDataDescription copied from class:LocallyCachedBlobClean 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:
- cleanupOrphanedDatain class- LocallyCachedBlob
- Throws:
- IOException
 
- 
completelyRemoveDescription copied from class:LocallyCachedBlobCompletely 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:
- completelyRemovein class- LocallyCachedBlob
- Throws:
- IOException
 
- 
getSizeOnDiskpublic long getSizeOnDisk()Description copied from class:LocallyCachedBlobGet 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:
- getSizeOnDiskin class- LocallyCachedBlob
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
 
-