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,
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 name,
java.lang.String source)
Performs a fast-forward of the given target branch up to the source snapshot if target is an
ancestor of source.
|
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 name,
java.lang.String source)
Replaces the branch with the given name to point to the source 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, wait
updateEvent
public ManageSnapshots cherrypick(long snapshotId)
ManageSnapshots
cherrypick
in interface ManageSnapshots
snapshotId
- a snapshotId whose changes to applypublic ManageSnapshots setCurrentSnapshot(long snapshotId)
ManageSnapshots
Snapshot
identified by id.setCurrentSnapshot
in interface ManageSnapshots
snapshotId
- long id of the snapshot to roll back table data topublic ManageSnapshots rollbackToTime(long timestampMillis)
ManageSnapshots
Snapshot
before the given timestamp.rollbackToTime
in interface ManageSnapshots
timestampMillis
- a long timestamp, as returned by System.currentTimeMillis()
public ManageSnapshots rollbackTo(long snapshotId)
ManageSnapshots
Snapshot
identified by id.rollbackTo
in interface ManageSnapshots
snapshotId
- long id of snapshot id to roll back table to. Must be an ancestor of the
current snapshotpublic ManageSnapshots createBranch(java.lang.String name, long snapshotId)
ManageSnapshots
createBranch
in interface ManageSnapshots
name
- branch namesnapshotId
- id of the snapshot which will be the head of the branchpublic ManageSnapshots createTag(java.lang.String name, long snapshotId)
ManageSnapshots
createTag
in interface ManageSnapshots
name
- tag namesnapshotId
- snapshotId for the head of the new branch.public ManageSnapshots removeBranch(java.lang.String name)
ManageSnapshots
removeBranch
in interface ManageSnapshots
name
- branch namepublic ManageSnapshots removeTag(java.lang.String name)
ManageSnapshots
removeTag
in interface ManageSnapshots
name
- tag namepublic ManageSnapshots setMinSnapshotsToKeep(java.lang.String name, int minSnapshotsToKeep)
ManageSnapshots
setMinSnapshotsToKeep
in interface ManageSnapshots
name
- branch nameminSnapshotsToKeep
- minimum number of snapshots to retain on the branchpublic ManageSnapshots setMaxSnapshotAgeMs(java.lang.String name, long maxSnapshotAgeMs)
ManageSnapshots
setMaxSnapshotAgeMs
in interface ManageSnapshots
name
- branch namemaxSnapshotAgeMs
- maximum snapshot age in milliseconds to retain on branchpublic ManageSnapshots setMaxRefAgeMs(java.lang.String name, long maxRefAgeMs)
ManageSnapshots
setMaxRefAgeMs
in interface ManageSnapshots
name
- branch namemaxRefAgeMs
- retention age in milliseconds of the tag reference itselfpublic ManageSnapshots replaceTag(java.lang.String name, long snapshotId)
ManageSnapshots
replaceTag
in interface ManageSnapshots
name
- Tag to replacesnapshotId
- new snapshot id for the given tagpublic ManageSnapshots replaceBranch(java.lang.String name, long snapshotId)
ManageSnapshots
replaceBranch
in interface ManageSnapshots
name
- Branch to replacesnapshotId
- new snapshot id for the given branchpublic ManageSnapshots replaceBranch(java.lang.String name, java.lang.String source)
ManageSnapshots
replaceBranch
in interface ManageSnapshots
name
- Branch to replacesource
- Source reference for the target to be replaced withpublic ManageSnapshots fastForwardBranch(java.lang.String name, java.lang.String source)
ManageSnapshots
fastForwardBranch
in interface ManageSnapshots
name
- Branch to fast-forwardsource
- Source reference for the target to be fast forwarded topublic ManageSnapshots renameBranch(java.lang.String name, java.lang.String newName)
ManageSnapshots
renameBranch
in interface ManageSnapshots
name
- name of branch to renamenewName
- the desired new name of the branchpublic Snapshot apply()
PendingUpdate
This does not result in a permanent update.
apply
in interface PendingUpdate<Snapshot>
PendingUpdate.commit()
public void commit()
PendingUpdate
Changes 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>