Class SnapshotManager

    • Method Detail

      • cherrypick

        public ManageSnapshots cherrypick​(long snapshotId)
        Description copied from interface: ManageSnapshots
        Apply supported changes in given snapshot and create a new snapshot which will be set as the current snapshot on commit.
        Specified by:
        cherrypick in interface ManageSnapshots
        Parameters:
        snapshotId - a snapshotId whose changes to apply
        Returns:
        this for method chaining
      • setCurrentSnapshot

        public ManageSnapshots setCurrentSnapshot​(long snapshotId)
        Description copied from interface: ManageSnapshots
        Roll this table's data back to a specific Snapshot identified by id.
        Specified by:
        setCurrentSnapshot in interface ManageSnapshots
        Parameters:
        snapshotId - long id of the snapshot to roll back table data to
        Returns:
        this for method chaining
      • rollbackToTime

        public ManageSnapshots rollbackToTime​(long timestampMillis)
        Description copied from interface: ManageSnapshots
        Roll this table's data back to the last Snapshot before the given timestamp.
        Specified by:
        rollbackToTime in interface ManageSnapshots
        Parameters:
        timestampMillis - a long timestamp, as returned by System.currentTimeMillis()
        Returns:
        this for method chaining
      • rollbackTo

        public ManageSnapshots rollbackTo​(long snapshotId)
        Description copied from interface: ManageSnapshots
        Rollback table's state to a specific Snapshot identified by id.
        Specified by:
        rollbackTo in interface ManageSnapshots
        Parameters:
        snapshotId - long id of snapshot id to roll back table to. Must be an ancestor of the current snapshot
      • createBranch

        public ManageSnapshots createBranch​(java.lang.String name)
        Description copied from interface: ManageSnapshots
        Create a new branch. The branch will point to current snapshot if the current snapshot is not NULL. Otherwise, the branch will point to a newly created empty snapshot.
        Specified by:
        createBranch in interface ManageSnapshots
        Parameters:
        name - branch name
        Returns:
        this for method chaining
      • createBranch

        public ManageSnapshots createBranch​(java.lang.String name,
                                            long snapshotId)
        Description copied from interface: ManageSnapshots
        Create a new branch pointing to the given snapshot id.
        Specified by:
        createBranch in interface ManageSnapshots
        Parameters:
        name - branch name
        snapshotId - id of the snapshot which will be the head of the branch
        Returns:
        this for method chaining
      • createTag

        public ManageSnapshots createTag​(java.lang.String name,
                                         long snapshotId)
        Description copied from interface: ManageSnapshots
        Create a new tag pointing to the given snapshot id
        Specified by:
        createTag in interface ManageSnapshots
        Parameters:
        name - tag name
        snapshotId - snapshotId for the head of the new branch.
        Returns:
        this for method chaining
      • removeTag

        public ManageSnapshots removeTag​(java.lang.String name)
        Description copied from interface: ManageSnapshots
        Remove the tag with the given name.
        Specified by:
        removeTag in interface ManageSnapshots
        Parameters:
        name - tag name
        Returns:
        this for method chaining
      • setMinSnapshotsToKeep

        public ManageSnapshots setMinSnapshotsToKeep​(java.lang.String name,
                                                     int minSnapshotsToKeep)
        Description copied from interface: ManageSnapshots
        Updates the minimum number of snapshots to keep for a branch.
        Specified by:
        setMinSnapshotsToKeep in interface ManageSnapshots
        Parameters:
        name - branch name
        minSnapshotsToKeep - minimum number of snapshots to retain on the branch
        Returns:
        this for method chaining
      • setMaxSnapshotAgeMs

        public ManageSnapshots setMaxSnapshotAgeMs​(java.lang.String name,
                                                   long maxSnapshotAgeMs)
        Description copied from interface: ManageSnapshots
        Updates the max snapshot age for a branch.
        Specified by:
        setMaxSnapshotAgeMs in interface ManageSnapshots
        Parameters:
        name - branch name
        maxSnapshotAgeMs - maximum snapshot age in milliseconds to retain on branch
        Returns:
        this for method chaining
      • setMaxRefAgeMs

        public ManageSnapshots setMaxRefAgeMs​(java.lang.String name,
                                              long maxRefAgeMs)
        Description copied from interface: ManageSnapshots
        Updates the retention policy for a reference.
        Specified by:
        setMaxRefAgeMs in interface ManageSnapshots
        Parameters:
        name - branch name
        maxRefAgeMs - retention age in milliseconds of the tag reference itself
        Returns:
        this for method chaining
      • replaceTag

        public ManageSnapshots replaceTag​(java.lang.String name,
                                          long snapshotId)
        Description copied from interface: ManageSnapshots
        Replaces the tag with the given name to point to the specified snapshot.
        Specified by:
        replaceTag in interface ManageSnapshots
        Parameters:
        name - Tag to replace
        snapshotId - new snapshot id for the given tag
        Returns:
        this for method chaining
      • replaceBranch

        public ManageSnapshots replaceBranch​(java.lang.String name,
                                             long snapshotId)
        Description copied from interface: ManageSnapshots
        Replaces the branch with the given name to point to the specified snapshot
        Specified by:
        replaceBranch in interface ManageSnapshots
        Parameters:
        name - Branch to replace
        snapshotId - new snapshot id for the given branch
        Returns:
        this for method chaining
      • replaceBranch

        public ManageSnapshots replaceBranch​(java.lang.String from,
                                             java.lang.String to)
        Description copied from interface: ManageSnapshots
        Replaces the 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.
        Specified by:
        replaceBranch in interface ManageSnapshots
        Parameters:
        from - Branch to replace
        to - The branch from should be replaced with
        Returns:
        this for method chaining
      • fastForwardBranch

        public ManageSnapshots fastForwardBranch​(java.lang.String from,
                                                 java.lang.String to)
        Description copied from interface: ManageSnapshots
        Performs a fast-forward of 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.
        Specified by:
        fastForwardBranch in interface ManageSnapshots
        Parameters:
        from - Branch to fast-forward
        to - Ref for the from branch to be fast forwarded to
        Returns:
        this for method chaining
      • renameBranch

        public ManageSnapshots renameBranch​(java.lang.String name,
                                            java.lang.String newName)
        Description copied from interface: ManageSnapshots
        Rename a branch
        Specified by:
        renameBranch in interface ManageSnapshots
        Parameters:
        name - name of branch to rename
        newName - the desired new name of the branch
      • apply

        public Snapshot apply()
        Description copied from interface: PendingUpdate
        Apply the pending changes and return the uncommitted changes for validation.

        This does not result in a permanent update.

        Specified by:
        apply in interface PendingUpdate<Snapshot>
        Returns:
        the uncommitted changes that would be committed by calling PendingUpdate.commit()
      • commit

        public void commit()
        Description copied from interface: PendingUpdate
        Apply the pending changes and commit.

        Changes are committed by calling the underlying table's commit method.

        Once the commit is successful, the updated table will be refreshed.

        Specified by:
        commit in interface PendingUpdate<Snapshot>