public class LocallyCachedTopologyBlob extends LocallyCachedBlob
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
| Modifier and Type | Class and Description |
|---|---|
static class |
LocallyCachedTopologyBlob.TopologyBlobType |
| Modifier and Type | Field and Description |
|---|---|
static long |
LOCAL_MODE_JAR_VERSION |
localUpdateTime, NOT_DOWNLOADED_VERSION| Modifier | Constructor and Description |
|---|---|
protected |
LocallyCachedTopologyBlob(String topologyId,
boolean isLocalMode,
Map<String,Object> conf,
AdvancedFSOps fsOps,
LocallyCachedTopologyBlob.TopologyBlobType type,
String owner,
StormMetricsRegistry metricsRegistry)
Create a new LocallyCachedBlob.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupOrphanedData()
Clean up any temporary files.
|
protected void |
commitNewVersion(long newVersion)
Commit the new version and make it available for the end user.
|
void |
completelyRemove()
Completely remove anything that is cached locally for this blob and all tracking files also stored for it.
|
boolean |
equals(Object other) |
protected void |
extractDirFromJar(String jarpath,
String dir,
Path dest) |
long |
fetchUnzipToTemp(ClientBlobStore store)
Download the latest version to a temp location.
|
long |
getLocalVersion()
Get the version of the blob cached locally.
|
long |
getRemoteVersion(ClientBlobStore store)
Get the version of the blob in the blob store.
|
long |
getSizeOnDisk()
Get the amount of disk space that is used by this blob.
|
int |
hashCode() |
boolean |
isFullyDownloaded() |
String |
toString() |
addReference, fetch, getDependencies, getKey, getLastUsed, getSizeOnDisk, informReferencesAndCommitNewVersion, isUsed, removeReference, touch, updatepublic static final long LOCAL_MODE_JAR_VERSION
protected LocallyCachedTopologyBlob(String topologyId, boolean isLocalMode, Map<String,Object> conf, AdvancedFSOps fsOps, LocallyCachedTopologyBlob.TopologyBlobType type, String owner, StormMetricsRegistry metricsRegistry) throws IOException
Create a new LocallyCachedBlob.
topologyId - the ID of the topology.type - the type of the blob.owner - the name of the user that owns this blob.IOExceptionpublic long getLocalVersion()
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.
getLocalVersion in class LocallyCachedBlobpublic long getRemoteVersion(ClientBlobStore store) throws KeyNotFoundException, AuthorizationException
LocallyCachedBlobGet the version of the blob in the blob store. PRECONDITION: this can only be called with a lock on this instance held.
getRemoteVersion in class LocallyCachedBlobKeyNotFoundExceptionAuthorizationExceptionpublic long fetchUnzipToTemp(ClientBlobStore store) throws IOException, KeyNotFoundException, AuthorizationException
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.
fetchUnzipToTemp in class LocallyCachedBlobstore - the store to us to download the data.IOExceptionKeyNotFoundExceptionAuthorizationExceptionprotected void extractDirFromJar(String jarpath, String dir, Path dest) throws IOException
IOExceptionpublic boolean isFullyDownloaded()
isFullyDownloaded in class LocallyCachedBlobprotected void commitNewVersion(long newVersion)
throws IOException
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.
commitNewVersion in class LocallyCachedBlobnewVersion - the version of the blob to commit.IOExceptionpublic void cleanupOrphanedData()
throws IOException
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.
cleanupOrphanedData in class LocallyCachedBlobIOExceptionpublic void completelyRemove()
throws IOException
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.
completelyRemove in class LocallyCachedBlobIOExceptionpublic long getSizeOnDisk()
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.
getSizeOnDisk in class LocallyCachedBlobCopyright © 2021 The Apache Software Foundation. All rights reserved.