use crate::domain::IndexEntry;
use crate::error::Result;
pub trait ObjectStore: Send + Sync {
fn save(&self, content: &[u8]) -> Result<String>;
fn load(&self, hash: &str) -> Result<Vec<u8>>;
fn exists(&self, hash: &str) -> Result<bool>;
fn delete(&self, hash: &str) -> Result<()>;
}
pub trait IndexStore: Send + Sync {
fn append(&self, entry: &IndexEntry) -> Result<()>;
fn read_all(&self) -> Result<Vec<IndexEntry>>;
fn clear(&self) -> Result<()>;
fn count(&self) -> Result<usize>;
fn is_empty(&self) -> Result<bool> {
Ok(self.count()? == 0)
}
fn freeze(&self) -> Result<()>;
fn has_staged(&self) -> Result<bool>;
fn read_staged(&self) -> Result<Vec<IndexEntry>>;
fn clear_staged(&self) -> Result<()>;
}
pub trait RefStore: Send + Sync {
fn get(&self, ref_name: &str) -> Result<Option<String>>;
fn update(&self, ref_name: &str, hash: &str) -> Result<()>;
fn delete(&self, ref_name: &str) -> Result<()>;
fn list(&self) -> Result<Vec<String>>;
}
pub trait HeadStore: Send + Sync {
fn get(&self) -> Result<Option<String>>;
fn set(&self, branch: &str) -> Result<()>;
}