public class SnapshotManager extends java.lang.Object implements ManageSnapshots
| Modifier and Type | Method and Description |
|---|---|
Snapshot |
apply()
Apply the pending changes and return the uncommitted changes for validation.
|
ManageSnapshots |
cherrypick(long snapshotId)
Apply supported changes in given snapshot and create a new snapshot which will be set as the
current snapshot on commit.
|
void |
commit()
Apply the pending changes and commit.
|
ManageSnapshots |
createBranch(java.lang.String name)
Create a new branch.
|
ManageSnapshots |
createBranch(java.lang.String name,
long snapshotId)
Create a new branch pointing to the given snapshot id.
|
ManageSnapshots |
createTag(java.lang.String name,
long snapshotId)
Create a new tag pointing to the given snapshot id
|
ManageSnapshots |
fastForwardBranch(java.lang.String from,
java.lang.String to)
Performs a fast-forward of
from up to the to snapshot if from is an
ancestor of to. |
ManageSnapshots |
removeBranch(java.lang.String name)
Remove a branch by name
|
ManageSnapshots |
removeTag(java.lang.String name)
Remove the tag with the given name.
|
ManageSnapshots |
renameBranch(java.lang.String name,
java.lang.String newName)
Rename a branch
|
ManageSnapshots |
replaceBranch(java.lang.String name,
long snapshotId)
Replaces the branch with the given name to point to the specified snapshot
|
ManageSnapshots |
replaceBranch(java.lang.String from,
java.lang.String to)
Replaces the
from branch to point to the to snapshot. |
ManageSnapshots |
replaceTag(java.lang.String name,
long snapshotId)
Replaces the tag with the given name to point to the specified snapshot.
|
ManageSnapshots |
rollbackTo(long snapshotId)
Rollback table's state to a specific
Snapshot identified by id. |
ManageSnapshots |
rollbackToTime(long timestampMillis)
Roll this table's data back to the last
Snapshot before the given timestamp. |
ManageSnapshots |
setCurrentSnapshot(long snapshotId)
Roll this table's data back to a specific
Snapshot identified by id. |
ManageSnapshots |
setMaxRefAgeMs(java.lang.String name,
long maxRefAgeMs)
Updates the retention policy for a reference.
|
ManageSnapshots |
setMaxSnapshotAgeMs(java.lang.String name,
long maxSnapshotAgeMs)
Updates the max snapshot age for a branch.
|
ManageSnapshots |
setMinSnapshotsToKeep(java.lang.String name,
int minSnapshotsToKeep)
Updates the minimum number of snapshots to keep for a branch.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitupdateEventpublic ManageSnapshots cherrypick(long snapshotId)
ManageSnapshotscherrypick in interface ManageSnapshotssnapshotId - a snapshotId whose changes to applypublic ManageSnapshots setCurrentSnapshot(long snapshotId)
ManageSnapshotsSnapshot identified by id.setCurrentSnapshot in interface ManageSnapshotssnapshotId - long id of the snapshot to roll back table data topublic ManageSnapshots rollbackToTime(long timestampMillis)
ManageSnapshotsSnapshot before the given timestamp.rollbackToTime in interface ManageSnapshotstimestampMillis - a long timestamp, as returned by System.currentTimeMillis()public ManageSnapshots rollbackTo(long snapshotId)
ManageSnapshotsSnapshot identified by id.rollbackTo in interface ManageSnapshotssnapshotId - long id of snapshot id to roll back table to. Must be an ancestor of the
current snapshotpublic ManageSnapshots createBranch(java.lang.String name)
ManageSnapshotscreateBranch in interface ManageSnapshotsname - branch namepublic ManageSnapshots createBranch(java.lang.String name, long snapshotId)
ManageSnapshotscreateBranch in interface ManageSnapshotsname - branch namesnapshotId - id of the snapshot which will be the head of the branchpublic ManageSnapshots createTag(java.lang.String name, long snapshotId)
ManageSnapshotscreateTag in interface ManageSnapshotsname - tag namesnapshotId - snapshotId for the head of the new branch.public ManageSnapshots removeBranch(java.lang.String name)
ManageSnapshotsremoveBranch in interface ManageSnapshotsname - branch namepublic ManageSnapshots removeTag(java.lang.String name)
ManageSnapshotsremoveTag in interface ManageSnapshotsname - tag namepublic ManageSnapshots setMinSnapshotsToKeep(java.lang.String name, int minSnapshotsToKeep)
ManageSnapshotssetMinSnapshotsToKeep in interface ManageSnapshotsname - branch nameminSnapshotsToKeep - minimum number of snapshots to retain on the branchpublic ManageSnapshots setMaxSnapshotAgeMs(java.lang.String name, long maxSnapshotAgeMs)
ManageSnapshotssetMaxSnapshotAgeMs in interface ManageSnapshotsname - branch namemaxSnapshotAgeMs - maximum snapshot age in milliseconds to retain on branchpublic ManageSnapshots setMaxRefAgeMs(java.lang.String name, long maxRefAgeMs)
ManageSnapshotssetMaxRefAgeMs in interface ManageSnapshotsname - branch namemaxRefAgeMs - retention age in milliseconds of the tag reference itselfpublic ManageSnapshots replaceTag(java.lang.String name, long snapshotId)
ManageSnapshotsreplaceTag in interface ManageSnapshotsname - Tag to replacesnapshotId - new snapshot id for the given tagpublic ManageSnapshots replaceBranch(java.lang.String name, long snapshotId)
ManageSnapshotsreplaceBranch in interface ManageSnapshotsname - Branch to replacesnapshotId - new snapshot id for the given branchpublic ManageSnapshots replaceBranch(java.lang.String from, java.lang.String to)
ManageSnapshotsfrom branch to point to the to snapshot. The to will
remain unchanged, and from branch will retain its retention properties. If the from branch does not exist, it will be created with default retention properties.replaceBranch in interface ManageSnapshotsfrom - Branch to replaceto - The branch from should be replaced withpublic ManageSnapshots fastForwardBranch(java.lang.String from, java.lang.String to)
ManageSnapshotsfrom up to the to snapshot if from is an
ancestor of to. The to will remain unchanged, and from will retain its
retention properties. If the from branch does not exist, it will be created with
default retention properties.fastForwardBranch in interface ManageSnapshotsfrom - Branch to fast-forwardto - Ref for the from branch to be fast forwarded topublic ManageSnapshots renameBranch(java.lang.String name, java.lang.String newName)
ManageSnapshotsrenameBranch in interface ManageSnapshotsname - name of branch to renamenewName - the desired new name of the branchpublic Snapshot apply()
PendingUpdateThis does not result in a permanent update.
apply in interface PendingUpdate<Snapshot>PendingUpdate.commit()public void commit()
PendingUpdateChanges are committed by calling the underlying table's commit method.
Once the commit is successful, the updated table will be refreshed.
commit in interface PendingUpdate<Snapshot>