public interface ManageSnapshots extends PendingUpdate<Snapshot>
snapshot
. Rollback:
This API does not allow conflicting calls to setCurrentSnapshot(long)
and rollbackToTime(long)
.
When committing, these changes will be applied to the current table metadata. Commit conflicts
will not be resolved and will result in a CommitFailedException
. Cherrypick:
In an audit workflow, new data is written to an orphan snapshot
that is not
committed as the table's current state until it is audited. After auditing a change, it may need
to be applied or cherry-picked on top of the latest snapshot instead of the one that was current
when the audited changes were created. This class adds support for cherry-picking the changes
from an orphan snapshot by applying them to the current snapshot. The output of the operation is
a new snapshot with the changes from cherry-picked snapshot.
Modifier and Type | Method and Description |
---|---|
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.
|
default 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 branchName,
long maxSnapshotAgeMs)
Updates the max snapshot age for a branch.
|
ManageSnapshots |
setMinSnapshotsToKeep(java.lang.String branchName,
int minSnapshotsToKeep)
Updates the minimum number of snapshots to keep for a branch.
|
apply, commit, updateEvent
ManageSnapshots setCurrentSnapshot(long snapshotId)
Snapshot
identified by id.snapshotId
- long id of the snapshot to roll back table data tojava.lang.IllegalArgumentException
- If the table has no snapshot with the given idManageSnapshots rollbackToTime(long timestampMillis)
Snapshot
before the given timestamp.timestampMillis
- a long timestamp, as returned by System.currentTimeMillis()
java.lang.IllegalArgumentException
- If the table has no old snapshot before the given timestampManageSnapshots rollbackTo(long snapshotId)
Snapshot
identified by id.snapshotId
- long id of snapshot id to roll back table to. Must be an ancestor of the
current snapshotjava.lang.IllegalArgumentException
- If the table has no snapshot with the given idValidationException
- If given snapshot id is not an ancestor of the current stateManageSnapshots cherrypick(long snapshotId)
snapshotId
- a snapshotId whose changes to applyjava.lang.IllegalArgumentException
- If the table has no snapshot with the given idDuplicateWAPCommitException
- In case of a WAP workflow and if the table has a duplicate
commit with same wapIddefault ManageSnapshots createBranch(java.lang.String name)
name
- branch namejava.lang.IllegalArgumentException
- if a branch with the given name already existsManageSnapshots createBranch(java.lang.String name, long snapshotId)
name
- branch namesnapshotId
- id of the snapshot which will be the head of the branchjava.lang.IllegalArgumentException
- if a branch with the given name already existsManageSnapshots createTag(java.lang.String name, long snapshotId)
name
- tag namesnapshotId
- snapshotId for the head of the new branch.java.lang.IllegalArgumentException
- if a tag with the given name already existsManageSnapshots removeBranch(java.lang.String name)
name
- branch namejava.lang.IllegalArgumentException
- if the branch does not existManageSnapshots renameBranch(java.lang.String name, java.lang.String newName)
name
- name of branch to renamenewName
- the desired new name of the branchjava.lang.IllegalArgumentException
- if the branch to rename does not exist or if there is already
a branch with the same name as the desired new name.ManageSnapshots removeTag(java.lang.String name)
name
- tag namejava.lang.IllegalArgumentException
- if the branch does not existManageSnapshots replaceTag(java.lang.String name, long snapshotId)
name
- Tag to replacesnapshotId
- new snapshot id for the given tagManageSnapshots replaceBranch(java.lang.String name, long snapshotId)
name
- Branch to replacesnapshotId
- new snapshot id for the given branchManageSnapshots replaceBranch(java.lang.String from, java.lang.String to)
from
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.from
- Branch to replaceto
- The branch from
should be replaced withManageSnapshots fastForwardBranch(java.lang.String from, java.lang.String to)
from
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.from
- Branch to fast-forwardto
- Ref for the from
branch to be fast forwarded tojava.lang.IllegalArgumentException
- if from
is not an ancestor of to
ManageSnapshots setMinSnapshotsToKeep(java.lang.String branchName, int minSnapshotsToKeep)
branchName
- branch nameminSnapshotsToKeep
- minimum number of snapshots to retain on the branchjava.lang.IllegalArgumentException
- if the branch does not existManageSnapshots setMaxSnapshotAgeMs(java.lang.String branchName, long maxSnapshotAgeMs)
branchName
- branch namemaxSnapshotAgeMs
- maximum snapshot age in milliseconds to retain on branchjava.lang.IllegalArgumentException
- if the branch does not existManageSnapshots setMaxRefAgeMs(java.lang.String name, long maxRefAgeMs)
name
- branch namemaxRefAgeMs
- retention age in milliseconds of the tag reference itselfjava.lang.IllegalArgumentException
- if the reference does not exist