Class OmSnapshotLocalData

java.lang.Object
org.apache.hadoop.ozone.om.OmSnapshotLocalData
All Implemented Interfaces:
org.apache.hadoop.hdds.utils.db.CopyObject<OmSnapshotLocalData>, org.apache.hadoop.ozone.util.WithChecksum<OmSnapshotLocalData>

public class OmSnapshotLocalData extends Object implements org.apache.hadoop.ozone.util.WithChecksum<OmSnapshotLocalData>
OmSnapshotLocalData is the in-memory representation of snapshot local metadata. Inspired by org.apache.hadoop.ozone.container.common.impl.ContainerData
  • Field Details

    • CHARSET_ENCODING

      public static final Charset CHARSET_ENCODING
  • Constructor Details

    • OmSnapshotLocalData

      public OmSnapshotLocalData(UUID snapshotId, List<org.rocksdb.LiveFileMetaData> notDefraggedSSTFileList, UUID previousSnapshotId)
      Creates a OmSnapshotLocalData object with default values.
    • OmSnapshotLocalData

      public OmSnapshotLocalData(OmSnapshotLocalData source)
      Copy constructor to create a deep copy of OmSnapshotLocalData object.
      Parameters:
      source - The source OmSnapshotLocalData to copy from
  • Method Details

    • getSstFiltered

      public boolean getSstFiltered()
      Returns whether SST is filtered for this snapshot.
      Returns:
      true if SST is filtered, false otherwise
    • setSstFiltered

      public void setSstFiltered(boolean sstFiltered)
      Sets whether SST is filtered for this snapshot.
      Parameters:
      sstFiltered -
    • getLastDefragTime

      public long getLastDefragTime()
      Returns the last defrag time, in epoch milliseconds.
      Returns:
      Timestamp of the last defrag
    • setLastDefragTime

      public void setLastDefragTime(Long lastDefragTime)
      Sets the last defrag time, in epoch milliseconds.
      Parameters:
      lastDefragTime - Timestamp of the last defrag
    • getNeedsDefrag

      public boolean getNeedsDefrag()
      Returns whether the snapshot needs defrag.
      Returns:
      true if the snapshot needs defrag, false otherwise
    • setNeedsDefrag

      public void setNeedsDefrag(boolean needsDefrag)
      Sets whether the snapshot needs defrag.
      Parameters:
      needsDefrag - true if the snapshot needs defrag, false otherwise
    • getVersionSstFileInfos

      public Map<Integer,OmSnapshotLocalData.VersionMeta> getVersionSstFileInfos()
      Returns the defragged SST file list.
      Returns:
      Map of version to defragged SST file list
    • setVersionSstFileInfos

      public void setVersionSstFileInfos(Map<Integer,OmSnapshotLocalData.VersionMeta> versionSstFileInfos)
      Sets the defragged SST file list.
      Parameters:
      versionSstFileInfos - Map of version to defragged SST file list
    • getPreviousSnapshotId

      public UUID getPreviousSnapshotId()
    • getSnapshotId

      public UUID getSnapshotId()
    • setPreviousSnapshotId

      public void setPreviousSnapshotId(UUID previousSnapshotId)
    • addVersionSSTFileInfos

      public void addVersionSSTFileInfos(List<org.apache.ozone.compaction.log.SstFileInfo> sstFiles, int previousSnapshotVersion)
      Adds an entry to the defragged SST file list.
      Parameters:
      sstFiles - SST file name
    • getChecksum

      public String getChecksum()
      Returns the checksum of the YAML representation.
      Specified by:
      getChecksum in interface org.apache.hadoop.ozone.util.WithChecksum<OmSnapshotLocalData>
      Returns:
      checksum
    • setChecksum

      public void setChecksum(String checksum)
      Sets the checksum of the YAML representation.
      Parameters:
      checksum - checksum
    • setChecksumTo0ByteArray

      public void setChecksumTo0ByteArray()
      Sets the checksum to a 0 byte array.
    • computeAndSetChecksum

      public void computeAndSetChecksum(org.yaml.snakeyaml.Yaml yaml) throws IOException
      Compute and set checksum for the snapshot data.
      Parameters:
      yaml - Yaml instance for serialization
      Throws:
      IOException - if checksum computation fails
    • getVersion

      public int getVersion()
      Returns the version of the snapshot local data.
      Returns:
      version
    • setVersion

      public void setVersion(int version)
      Sets the version of the snapshot local data. A valid version shall be greater than 0.
      Parameters:
      version - version
    • copyObject

      public OmSnapshotLocalData copyObject()
      Specified by:
      copyObject in interface org.apache.hadoop.hdds.utils.db.CopyObject<OmSnapshotLocalData>