pub trait Backend: Send + Sync {
// Required methods
fn lock_exclusive(&self) -> Result<Box<dyn Lock>>;
fn lock_shared(&self) -> Result<Box<dyn Lock>>;
fn new_thread(&self) -> Result<Box<dyn BackendThread>>;
}
Expand description
Backend API
Backend is thread-safe, and the actual work is implemented by per-thread instances of it.
Required Methods§
Sourcefn lock_exclusive(&self) -> Result<Box<dyn Lock>>
fn lock_exclusive(&self) -> Result<Box<dyn Lock>>
Lock the repository exclusively
Use to protect operations that are potentially destructive, like GC.
Lock the repository in shared mode
This will only prevent anyone from grabing exclusive lock.
Use to protect operations that only add new data, like write
.
Sourcefn new_thread(&self) -> Result<Box<dyn BackendThread>>
fn new_thread(&self) -> Result<Box<dyn BackendThread>>
Spawn a new thread object of the backend.