Interface Snapshot
-
public interface Snapshot
A snapshot in a repository.
A snapshot is a reference to a particular commit on a branch in the repository. The snapshot itself is typically used as a representative, or recording, of the latest versions of items at the time of the commit.
Use one of the plain value-returning methods to query the database for a specific data value of the snapshot. Use the optimized
get()
method to return all data values of the snapshot using a single database query operation.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Commit
commit()
Get the commit referenced by the snapshot.CommitKey
commitKey()
Get the identifying key of the commit referenced by the snapshot.Database
database()
Get the database that the snapshot belongs to.DatabaseKey
databaseKey()
Get the identifying key of the database that the snapshot belongs to.void
delete()
Delete the snapshot.GetSnapshotResult
get()
Get all of the current data values of the snapshot itself using a single database query operation.boolean
isDeleted()
Query the database whether or not the snapshot is currently marked as deleted.java.lang.String
name()
Query the database for the current name of the snapshot.Repository
repository()
Get the repository that the snapshot belongs to.RepositoryKey
repositoryKey()
Get the identifying key of the repository that the snapshot belongs to.void
restore()
Restore a previously deleted snapshot in a repository.SnapshotKey
snapshotKey()
Get the identifying key of the snapshot.void
update(UpdateSnapshotParam updateSnapshotParam)
Update settings for the snapshot itself in the repository.void
updateName(java.lang.String name)
Update the name of the snapshot.
-
-
-
Method Detail
-
databaseKey
DatabaseKey databaseKey()
Get the identifying key of the database that the snapshot belongs to.- Returns:
- The identifying key of the database that the snapshot belongs to.
-
database
Database database()
Get the database that the snapshot belongs to.- Returns:
- The database that the snapshot belongs to.
-
repositoryKey
RepositoryKey repositoryKey()
Get the identifying key of the repository that the snapshot belongs to.- Returns:
- The identifying key of the repository that the snapshot belongs to.
-
repository
Repository repository()
Get the repository that the snapshot belongs to.- Returns:
- The repository that the snapshot belongs to.
-
snapshotKey
SnapshotKey snapshotKey()
Get the identifying key of the snapshot.- Returns:
- The identifying key of the snapshot.
-
name
java.lang.String name()
Query the database for the current name of the snapshot. Note that this name need not be unique in the database.- Returns:
- The current name of the snapshot.
-
commitKey
CommitKey commitKey()
Get the identifying key of the commit referenced by the snapshot.- Returns:
- The identifying key of the commit referenced by the snapshot.
-
commit
Commit commit()
Get the commit referenced by the snapshot.- Returns:
- The commit referenced by the snapshot.
-
isDeleted
boolean isDeleted()
Query the database whether or not the snapshot is currently marked as deleted.- Returns:
- True if the snapshot is currently marked as deleted, otherwise false.
-
get
GetSnapshotResult get()
Get all of the current data values of the snapshot itself using a single database query operation.
The data values held by the returned instance are collectively retrieved from the database already when this method is invoked. Using this method therefore offers better performance over the sibling query methods on this interface whenever multiple data values need to be retrieved for the snapshot (at the risk of the data values becoming stale if the snapshot is modified).
- Returns:
- The current data values for the snapshot as returned by the database.
-
updateName
void updateName(java.lang.String name)
Update the name of the snapshot.- Parameters:
name
- The new name for the snapshot.
-
update
void update(UpdateSnapshotParam updateSnapshotParam)
Update settings for the snapshot itself in the repository. This includes, for example, renaming the snapshot.
Set desired input options on the generator returned by
DatabaseApiUtil.param().forUpdateSnapshot()
and then pass the generator as the sole argument to this method.- Parameters:
updateSnapshotParam
- Input parameters for the update.
-
delete
void delete()
Delete the snapshot. Does nothing if the snapshot is already marked as deleted.
This deletion is not permanent. Use
restore()
to restore a previously deleted snapshot.
-
restore
void restore()
Restore a previously deleted snapshot in a repository. Does nothing if the snapshot is not marked as deleted.
-
-