Trait Store

Source
pub trait Store {
    // Required methods
    fn set(
        &mut self,
        repo: &RepoId,
        namespace: &PublicKey,
        refname: &Qualified<'_>,
        oid: Oid,
        timestamp: LocalTime,
    ) -> Result<bool, Error>;
    fn get(
        &self,
        repo: &RepoId,
        namespace: &PublicKey,
        refname: &Qualified<'_>,
    ) -> Result<Option<(Oid, LocalTime)>, Error>;
    fn delete(
        &mut self,
        repo: &RepoId,
        namespace: &PublicKey,
        refname: &Qualified<'_>,
    ) -> Result<bool, Error>;
    fn populate<S>(&mut self, storage: &S) -> Result<(), Error>
       where S: ReadStorage;
    fn count(&self) -> Result<usize, Error>;

    // Provided method
    fn is_empty(&self) -> Result<bool, Error> { ... }
}
Expand description

Refs store.

Used to cache git references.

Required Methods§

Source

fn set( &mut self, repo: &RepoId, namespace: &PublicKey, refname: &Qualified<'_>, oid: Oid, timestamp: LocalTime, ) -> Result<bool, Error>

Set a reference under a remote namespace to the given Oid.

Source

fn get( &self, repo: &RepoId, namespace: &PublicKey, refname: &Qualified<'_>, ) -> Result<Option<(Oid, LocalTime)>, Error>

Get a reference’s Oid and timestamp.

Source

fn delete( &mut self, repo: &RepoId, namespace: &PublicKey, refname: &Qualified<'_>, ) -> Result<bool, Error>

Delete a reference.

Source

fn populate<S>(&mut self, storage: &S) -> Result<(), Error>
where S: ReadStorage,

Populate the database from storage.

Source

fn count(&self) -> Result<usize, Error>

Return the number of references.

Provided Methods§

Source

fn is_empty(&self) -> Result<bool, Error>

Check if there are any references.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§