pub trait VersioningService {
Show 18 methods
// Required methods
fn create_branch(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
request: CreateBranchRequest,
) -> Result<Branch, Error>;
fn create_tag(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
request: CreateTagRequest,
) -> Result<Tag, Error>;
fn get_commit(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
commit_id: CommitId,
) -> Result<Commit, Error>;
fn batch_get_commits(
&self,
auth_: BearerToken,
resource_and_commit_ids: BTreeSet<ResourceAndCommitId>,
) -> Result<BTreeSet<Commit>, Error>;
fn get_commit_by_branch(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
branch_name: BranchName,
) -> Result<Commit, Error>;
fn get_commit_by_tag(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
tag_name: TagName,
) -> Result<Commit, Error>;
fn get_least_common_ancestor(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
request: GetLeastCommonAncestorRequest,
) -> Result<CommitId, Error>;
fn get_commit_history(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
commit_id: CommitId,
page_size: Option<i32>,
next_page_token: Option<Token>,
) -> Result<CommitHistory, Error>;
fn persist_commits(
&self,
auth_: BearerToken,
request: BTreeSet<ResourceAndCommitId>,
) -> Result<(), Error>;
fn get_branch(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
branch_name: BranchName,
) -> Result<Branch, Error>;
fn get_branches(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
) -> Result<Vec<Branch>, Error>;
fn batch_get_branches(
&self,
auth_: BearerToken,
resource_and_branches: BTreeSet<ResourceAndBranchName>,
) -> Result<BTreeSet<Branch>, Error>;
fn get_tag(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
tag_name: TagName,
) -> Result<Tag, Error>;
fn batch_get_tags(
&self,
auth_: BearerToken,
resource_and_commits: BTreeSet<ResourceAndCommitId>,
) -> Result<BTreeSet<Tag>, Error>;
fn get_tags_by_resource(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
) -> Result<Vec<Tag>, Error>;
fn delete_branch(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
branch_name: BranchName,
) -> Result<(), Error>;
fn delete_branches(
&self,
auth_: BearerToken,
resource_and_branches: BTreeSet<ResourceAndBranchName>,
) -> Result<(), Error>;
fn delete_tag(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
tag_name: TagName,
) -> Result<(), Error>;
}
Expand description
This is the external-facing portion of VersioningService which gives clients access to functionality that doesn’t create new commits. The creation of new commits should be done via the resource-specific services.
Required Methods§
Sourcefn create_branch(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
request: CreateBranchRequest,
) -> Result<Branch, Error>
fn create_branch( &self, auth_: BearerToken, resource_rid: ResourceIdentifier, request: CreateBranchRequest, ) -> Result<Branch, Error>
Creates a mutable pointer to the provided commit. “Saves”/“commits” can be performed on this pointer. Throws if the name is already used as a commit pointer for this resource. Throws if the provided commit doesn’t exist.
Sourcefn create_tag(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
request: CreateTagRequest,
) -> Result<Tag, Error>
fn create_tag( &self, auth_: BearerToken, resource_rid: ResourceIdentifier, request: CreateTagRequest, ) -> Result<Tag, Error>
Creates an immutable pointer to the provided commit. Throws if the name is already used as a commit pointer for this resource. Throws if the provided commit doesn’t exist.
Sourcefn get_commit(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
commit_id: CommitId,
) -> Result<Commit, Error>
fn get_commit( &self, auth_: BearerToken, resource_rid: ResourceIdentifier, commit_id: CommitId, ) -> Result<Commit, Error>
Throws if the commit doesn’t exist.
Sourcefn batch_get_commits(
&self,
auth_: BearerToken,
resource_and_commit_ids: BTreeSet<ResourceAndCommitId>,
) -> Result<BTreeSet<Commit>, Error>
fn batch_get_commits( &self, auth_: BearerToken, resource_and_commit_ids: BTreeSet<ResourceAndCommitId>, ) -> Result<BTreeSet<Commit>, Error>
Filters out resources that are not authorized.
Sourcefn get_commit_by_branch(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
branch_name: BranchName,
) -> Result<Commit, Error>
fn get_commit_by_branch( &self, auth_: BearerToken, resource_rid: ResourceIdentifier, branch_name: BranchName, ) -> Result<Commit, Error>
Returns the commit pointed to by the branch. Throws if the branch doesn’t exist.
Sourcefn get_commit_by_tag(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
tag_name: TagName,
) -> Result<Commit, Error>
fn get_commit_by_tag( &self, auth_: BearerToken, resource_rid: ResourceIdentifier, tag_name: TagName, ) -> Result<Commit, Error>
Returns the commit pointed to by the tag. Throws if the tag doesn’t exist.
Sourcefn get_least_common_ancestor(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
request: GetLeastCommonAncestorRequest,
) -> Result<CommitId, Error>
fn get_least_common_ancestor( &self, auth_: BearerToken, resource_rid: ResourceIdentifier, request: GetLeastCommonAncestorRequest, ) -> Result<CommitId, Error>
Returns the least common ancestor of the two commits. Throws if either commit doesn’t exist.
Sourcefn get_commit_history(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
commit_id: CommitId,
page_size: Option<i32>,
next_page_token: Option<Token>,
) -> Result<CommitHistory, Error>
fn get_commit_history( &self, auth_: BearerToken, resource_rid: ResourceIdentifier, commit_id: CommitId, page_size: Option<i32>, next_page_token: Option<Token>, ) -> Result<CommitHistory, Error>
Returns the commit history sorted by creation time descending. Excludes working state commits. Throws if the commit doesn’t exist.
Sourcefn persist_commits(
&self,
auth_: BearerToken,
request: BTreeSet<ResourceAndCommitId>,
) -> Result<(), Error>
fn persist_commits( &self, auth_: BearerToken, request: BTreeSet<ResourceAndCommitId>, ) -> Result<(), Error>
Persists the commits so that they are not compacted. This operation is atomic - either all commits are persisted or none are (in the case of an error).
Sourcefn get_branch(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
branch_name: BranchName,
) -> Result<Branch, Error>
fn get_branch( &self, auth_: BearerToken, resource_rid: ResourceIdentifier, branch_name: BranchName, ) -> Result<Branch, Error>
Throws if the branch doesn’t exist.
Sourcefn get_branches(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
) -> Result<Vec<Branch>, Error>
fn get_branches( &self, auth_: BearerToken, resource_rid: ResourceIdentifier, ) -> Result<Vec<Branch>, Error>
Returns all branches for the resource in order of most recently updated.
Sourcefn batch_get_branches(
&self,
auth_: BearerToken,
resource_and_branches: BTreeSet<ResourceAndBranchName>,
) -> Result<BTreeSet<Branch>, Error>
fn batch_get_branches( &self, auth_: BearerToken, resource_and_branches: BTreeSet<ResourceAndBranchName>, ) -> Result<BTreeSet<Branch>, Error>
Omits branches that are not authorized.
Sourcefn get_tag(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
tag_name: TagName,
) -> Result<Tag, Error>
fn get_tag( &self, auth_: BearerToken, resource_rid: ResourceIdentifier, tag_name: TagName, ) -> Result<Tag, Error>
Throws if the tag doesn’t exist.
Omits tags that are not authorized.
Returns all tags for the resource in order of most recently created.
Sourcefn delete_branch(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
branch_name: BranchName,
) -> Result<(), Error>
fn delete_branch( &self, auth_: BearerToken, resource_rid: ResourceIdentifier, branch_name: BranchName, ) -> Result<(), Error>
Deletes the branch pointer. Throws if the branch doesn’t exist. Throws if you attempt to delete the “main” branch.
Sourcefn delete_branches(
&self,
auth_: BearerToken,
resource_and_branches: BTreeSet<ResourceAndBranchName>,
) -> Result<(), Error>
fn delete_branches( &self, auth_: BearerToken, resource_and_branches: BTreeSet<ResourceAndBranchName>, ) -> Result<(), Error>
Deletes the branch pointers. Throws if any resource or branch is non-existent or unauthorized. Throws if any attempt is made to delete “main”.
Sourcefn delete_tag(
&self,
auth_: BearerToken,
resource_rid: ResourceIdentifier,
tag_name: TagName,
) -> Result<(), Error>
fn delete_tag( &self, auth_: BearerToken, resource_rid: ResourceIdentifier, tag_name: TagName, ) -> Result<(), Error>
Deletes the tag pointer. Throws if the tag doesn’t exist.