pub trait CommitStore: Send + Sync {
// Required methods
fn put<'life0, 'async_trait>(
&'life0 self,
commit: Commit,
) -> Pin<Box<dyn Future<Output = Result<CommitId>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CommitId,
) -> Pin<Box<dyn Future<Output = Result<Option<Commit>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn contains<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CommitId,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn children<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CommitId,
) -> Pin<Box<dyn Future<Output = Result<Vec<CommitId>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn all_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<CommitId>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn remove_many<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: &'life1 [CommitId],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Content-addressed storage for commits, plus the parent/child index needed
for ancestry walks (log, bisect) without touching blob contents.
Required Methods§
Sourcefn put<'life0, 'async_trait>(
&'life0 self,
commit: Commit,
) -> Pin<Box<dyn Future<Output = Result<CommitId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 self,
commit: Commit,
) -> Pin<Box<dyn Future<Output = Result<CommitId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stores a commit. Content-addressed and idempotent: storing byte-identical content twice returns the same id without creating a second entry. Enforces invariant 2 (acyclic, no dangling parents) by rejecting any non-root commit whose parents are not already present.
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CommitId,
) -> Pin<Box<dyn Future<Output = Result<Option<Commit>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CommitId,
) -> Pin<Box<dyn Future<Output = Result<Option<Commit>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetches a commit by id, if it exists.
Sourcefn contains<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CommitId,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn contains<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CommitId,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
True if a commit with this id has been stored.
Sourcefn children<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CommitId,
) -> Pin<Box<dyn Future<Output = Result<Vec<CommitId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn children<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 CommitId,
) -> Pin<Box<dyn Future<Output = Result<Vec<CommitId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Direct children of a commit (reverse edge index), for ancestry walks.
Sourcefn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Total number of stored commits (used by gc / diagnostics).
Sourcefn all_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<CommitId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn all_ids<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<CommitId>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
All commit ids currently stored. Used by gc to compute reachability.
Sourcefn remove_many<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: &'life1 [CommitId],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_many<'life0, 'life1, 'async_trait>(
&'life0 self,
ids: &'life1 [CommitId],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Removes commits by id unconditionally. Callers (e.g. gc) are
responsible for having already proven these ids are unreachable from
any branch. Not exposed as a normal write-path operation.
Provided Methods§
fn is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".