Package org.apache.storm.localizer

# Class LocallyCachedTopologyBlob

java.lang.Object
org.apache.storm.localizer.LocallyCachedBlob
org.apache.storm.localizer.LocallyCachedTopologyBlob

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`

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `LocallyCachedTopologyBlob.TopologyBlobType`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final long`
  `LOCAL_MODE_JAR_VERSION`

  ### Fields inherited from class org.apache.storm.localizer.LocallyCachedBlob

  `localUpdateTime, NOT_DOWNLOADED_VERSION`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `LocallyCachedTopologyBlob(String topologyId, boolean isLocalMode, Map<String,Object> conf, AdvancedFSOps fsOps, LocallyCachedTopologyBlob.TopologyBlobType type, String owner, StormMetricsRegistry metricsRegistry)`
  Create a new LocallyCachedBlob.

- ## Method Summary

  Modifier and Type
  Method
  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()`

  ### Methods inherited from class org.apache.storm.localizer.LocallyCachedBlob

  `addReference, fetch, getDependencies, getKey, getLastUsed, getSizeOnDisk, informReferencesAndCommitNewVersion, isUsed, removeReference, touch, update`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### LOCAL_MODE_JAR_VERSION

    public static final long LOCAL_MODE_JAR_VERSION
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### LocallyCachedTopologyBlob

    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.
    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

  - ### 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 class `LocallyCachedBlob`

  - ### 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 class `LocallyCachedBlob`
    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 class `LocallyCachedBlob`
    Parameters:
      `store` - the store to us to download the data.
    Returns:
      the version that was downloaded.
    Throws:
      `IOException`
      `KeyNotFoundException`
      `AuthorizationException`

  - ### extractDirFromJar

    protected void extractDirFromJar(String jarpath, String dir, Path dest) throws IOException
    Throws:
      `IOException`

  - ### isFullyDownloaded

    public boolean isFullyDownloaded()
    Specified by:
      `isFullyDownloaded` in class `LocallyCachedBlob`

  - ### commitNewVersion

    protected void commitNewVersion(long newVersion) throws IOException
    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 class `LocallyCachedBlob`
    Parameters:
      `newVersion` - the version of the blob to commit.
    Throws:
      `IOException`

  - ### cleanupOrphanedData

    public void cleanupOrphanedData() throws IOException
    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 class `LocallyCachedBlob`
    Throws:
      `IOException`

  - ### completelyRemove

    public void completelyRemove() throws IOException
    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 class `LocallyCachedBlob`
    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 class `LocallyCachedBlob`

  - ### equals

    public boolean equals(Object other)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`