Trait jj_lib::backend::Backend

source ·
pub trait Backend: Send + Sync + Debug {
Show 17 methods // Required methods fn as_any(&self) -> &dyn Any; fn name(&self) -> &str; fn commit_id_length(&self) -> usize; fn change_id_length(&self) -> usize; fn read_file( &self, path: &RepoPath, id: &FileId ) -> BackendResult<Box<dyn Read>>; fn write_file( &self, path: &RepoPath, contents: &mut dyn Read ) -> BackendResult<FileId>; fn read_symlink( &self, path: &RepoPath, id: &SymlinkId ) -> BackendResult<String>; fn write_symlink( &self, path: &RepoPath, target: &str ) -> BackendResult<SymlinkId>; fn root_commit_id(&self) -> &CommitId; fn root_change_id(&self) -> &ChangeId; fn empty_tree_id(&self) -> &TreeId; fn read_tree(&self, path: &RepoPath, id: &TreeId) -> BackendResult<Tree>; fn write_tree( &self, path: &RepoPath, contents: &Tree ) -> BackendResult<TreeId>; fn read_conflict( &self, path: &RepoPath, id: &ConflictId ) -> BackendResult<Conflict>; fn write_conflict( &self, path: &RepoPath, contents: &Conflict ) -> BackendResult<ConflictId>; fn read_commit(&self, id: &CommitId) -> BackendResult<Commit>; fn write_commit( &self, contents: Commit ) -> BackendResult<(CommitId, Commit)>;
}

Required Methods§

source

fn as_any(&self) -> &dyn Any

source

fn name(&self) -> &str

A unique name that identifies this backend. Written to .jj/repo/store/backend when the repo is created.

source

fn commit_id_length(&self) -> usize

The length of commit IDs in bytes.

source

fn change_id_length(&self) -> usize

The length of change IDs in bytes.

source

fn read_file( &self, path: &RepoPath, id: &FileId ) -> BackendResult<Box<dyn Read>>

source

fn write_file( &self, path: &RepoPath, contents: &mut dyn Read ) -> BackendResult<FileId>

source

fn root_commit_id(&self) -> &CommitId

source

fn root_change_id(&self) -> &ChangeId

source

fn empty_tree_id(&self) -> &TreeId

source

fn read_tree(&self, path: &RepoPath, id: &TreeId) -> BackendResult<Tree>

source

fn write_tree(&self, path: &RepoPath, contents: &Tree) -> BackendResult<TreeId>

source

fn read_conflict( &self, path: &RepoPath, id: &ConflictId ) -> BackendResult<Conflict>

source

fn write_conflict( &self, path: &RepoPath, contents: &Conflict ) -> BackendResult<ConflictId>

source

fn read_commit(&self, id: &CommitId) -> BackendResult<Commit>

source

fn write_commit(&self, contents: Commit) -> BackendResult<(CommitId, Commit)>

Writes a commit and returns its ID and the commit itself. The commit should contain the data that was actually written, which may differ from the data passed in. For example, the backend may change the committer name to an authenticated user’s name, or the backend’s timestamps may have less precision than the millisecond precision in Commit.

Implementors§