Package org.apache.hadoop.ozone.om
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents metadata for a specific version in a snapshot. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOmSnapshotLocalData(UUID snapshotId, List<org.rocksdb.LiveFileMetaData> notDefraggedSSTFileList, UUID previousSnapshotId) Creates a OmSnapshotLocalData object with default values.Copy constructor to create a deep copy of OmSnapshotLocalData object. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddVersionSSTFileInfos(List<org.apache.ozone.compaction.log.SstFileInfo> sstFiles, int previousSnapshotVersion) Adds an entry to the defragged SST file list.voidcomputeAndSetChecksum(org.yaml.snakeyaml.Yaml yaml) Compute and set checksum for the snapshot data.Returns the checksum of the YAML representation.longReturns the last defrag time, in epoch milliseconds.booleanReturns whether the snapshot needs defrag.booleanReturns whether SST is filtered for this snapshot.intReturns the version of the snapshot local data.Returns the defragged SST file list.voidsetChecksum(String checksum) Sets the checksum of the YAML representation.voidSets the checksum to a 0 byte array.voidsetLastDefragTime(Long lastDefragTime) Sets the last defrag time, in epoch milliseconds.voidsetNeedsDefrag(boolean needsDefrag) Sets whether the snapshot needs defrag.voidsetPreviousSnapshotId(UUID previousSnapshotId) voidsetSstFiltered(boolean sstFiltered) Sets whether SST is filtered for this snapshot.voidsetVersion(int version) Sets the version of the snapshot local data.voidsetVersionSstFileInfos(Map<Integer, OmSnapshotLocalData.VersionMeta> versionSstFileInfos) Sets the defragged SST file list.
-
Field Details
-
CHARSET_ENCODING
-
-
Constructor Details
-
OmSnapshotLocalData
public OmSnapshotLocalData(UUID snapshotId, List<org.rocksdb.LiveFileMetaData> notDefraggedSSTFileList, UUID previousSnapshotId) Creates a OmSnapshotLocalData object with default values. -
OmSnapshotLocalData
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
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
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
-
getSnapshotId
-
setPreviousSnapshotId
-
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
Returns the checksum of the YAML representation.- Specified by:
getChecksumin interfaceorg.apache.hadoop.ozone.util.WithChecksum<OmSnapshotLocalData>- Returns:
- checksum
-
setChecksum
Sets the checksum of the YAML representation.- Parameters:
checksum- checksum
-
setChecksumTo0ByteArray
public void setChecksumTo0ByteArray()Sets the checksum to a 0 byte array. -
computeAndSetChecksum
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
- Specified by:
copyObjectin interfaceorg.apache.hadoop.hdds.utils.db.CopyObject<OmSnapshotLocalData>
-