Class Snapshot
java.lang.Object
org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot
- All Implemented Interfaces:
Comparable<byte[]>
Snapshot of a sub-tree in the namesystem.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThis id is used to indicate the current state (vs. snapshots)static final Comparator<Snapshot>Compare snapshot with IDs, where null indicates the current status thus is greater than any non-null snapshot.static final Comparator<Integer>Compare snapshot with IDs, where null indicates the current status thus is greater than any non-null ID.static final int -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(byte[] bytes) booleanstatic intfindLatestSnapshot(INode inode, int anchor) Find the latest snapshot that 1) covers the given inode (which means the snapshot was either taken on the inode or taken on an ancestor of the inode), and 2) was taken before the given snapshot (if the given snapshot is not null).static Stringstatic StringintgetId()getRoot()static intstatic StringgetSnapshotPath(String snapshottableDir, String snapshotRelativePath) static StringgetSnapshotString(int snapshot) inthashCode()toString()
-
Field Details
-
CURRENT_STATE_ID
public static final int CURRENT_STATE_IDThis id is used to indicate the current state (vs. snapshots)- See Also:
-
NO_SNAPSHOT_ID
public static final int NO_SNAPSHOT_ID- See Also:
-
ID_COMPARATOR
Compare snapshot with IDs, where null indicates the current status thus is greater than any non-null snapshot. -
ID_INTEGER_COMPARATOR
Compare snapshot with IDs, where null indicates the current status thus is greater than any non-null ID.
-
-
Method Details
-
generateDefaultSnapshotName
-
generateDeletedSnapshotName
-
getSnapshotPath
-
getSnapshotId
-
getSnapshotString
-
findLatestSnapshot
Find the latest snapshot that 1) covers the given inode (which means the snapshot was either taken on the inode or taken on an ancestor of the inode), and 2) was taken before the given snapshot (if the given snapshot is not null).- Parameters:
inode- the given inode that the returned snapshot needs to coveranchor- the returned snapshot should be taken before this given id.- Returns:
- id of the latest snapshot that covers the given inode and was taken before the the given snapshot (if it is not null).
-
getId
public int getId() -
getRoot
- Returns:
- the root directory of the snapshot.
-
compareTo
public int compareTo(byte[] bytes) - Specified by:
compareToin interfaceComparable<byte[]>
-
equals
-
hashCode
public int hashCode() -
toString
-