pub trait ReadStorage {
type Repository: ReadRepository;
// Required methods
fn info(&self) -> &UserInfo;
fn path(&self) -> &Path;
fn path_of(&self, rid: &RepoId) -> PathBuf;
fn contains(&self, rid: &RepoId) -> Result<bool, RepositoryError>;
fn repositories(&self) -> Result<Vec<RepositoryInfo>, Error>;
fn repository(
&self,
rid: RepoId,
) -> Result<Self::Repository, RepositoryError>;
// Provided method
fn get(&self, rid: RepoId) -> Result<Option<Doc>, RepositoryError> { ... }
}
Expand description
Read-only operations on a storage instance.
Required Associated Types§
Required Methods§
Sourcefn contains(&self, rid: &RepoId) -> Result<bool, RepositoryError>
fn contains(&self, rid: &RepoId) -> Result<bool, RepositoryError>
Check whether storage contains a repository.
Sourcefn repositories(&self) -> Result<Vec<RepositoryInfo>, Error>
fn repositories(&self) -> Result<Vec<RepositoryInfo>, Error>
Return all repositories (public and private).
Sourcefn repository(&self, rid: RepoId) -> Result<Self::Repository, RepositoryError>
fn repository(&self, rid: RepoId) -> Result<Self::Repository, RepositoryError>
Open or create a read-only repository.