pub struct LocalBackend {
pub path: PathBuf,
/* private fields */
}Fields§
§path: PathBufImplementations§
Trait Implementations§
Source§impl Backend for LocalBackend
impl Backend for LocalBackend
Source§fn is_initialized(&self) -> Result<bool>
fn is_initialized(&self) -> Result<bool>
Check whether the backend has already been initialized.
Source§fn init(&self) -> Result<()>
fn init(&self) -> Result<()>
Initialize the backend storage (create directories, set permissions, etc.)
Source§fn store(
&self,
hash: &Hashes,
source: &Path,
compression: Compression,
on_bytes: Option<&(dyn Fn(u64) + Send + Sync)>,
) -> Result<u64>
fn store( &self, hash: &Hashes, source: &Path, compression: Compression, on_bytes: Option<&(dyn Fn(u64) + Send + Sync)>, ) -> Result<u64>
Store file to backend by hash, optionally compressing.
Returns the stored (compressed) size in bytes.
Source§fn retrieve(
&self,
hash: &Hashes,
target: &Path,
compression: Compression,
on_bytes: Option<&(dyn Fn(u64) + Send + Sync)>,
) -> Result<bool>
fn retrieve( &self, hash: &Hashes, target: &Path, compression: Compression, on_bytes: Option<&(dyn Fn(u64) + Send + Sync)>, ) -> Result<bool>
Retrieve content by hash to target path, optionally decompressing.
Returns true if the file was copied to the target path.
Source§fn remove(&self, hash: &Hashes) -> Result<()>
fn remove(&self, hash: &Hashes) -> Result<()>
Remove content by hash (for rollback). Best-effort, may silently fail.
Source§fn log_audit(&self, entry: &AuditEntry) -> Result<()>
fn log_audit(&self, entry: &AuditEntry) -> Result<()>
Log an audit entry to the backend’s audit log.
Source§fn read_audit_file(&self, files: &[PathBuf]) -> Result<Vec<AuditEntry>>
fn read_audit_file(&self, files: &[PathBuf]) -> Result<Vec<AuditEntry>>
Read the whole audit file, filtered by the given file paths.
If
files is empty, return the full audit logSource§impl Clone for LocalBackend
impl Clone for LocalBackend
Source§fn clone(&self) -> LocalBackend
fn clone(&self) -> LocalBackend
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LocalBackend
impl Debug for LocalBackend
Source§impl<'de> Deserialize<'de> for LocalBackend
impl<'de> Deserialize<'de> for LocalBackend
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for LocalBackend
impl PartialEq for LocalBackend
Source§fn eq(&self, other: &LocalBackend) -> bool
fn eq(&self, other: &LocalBackend) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for LocalBackend
impl Serialize for LocalBackend
impl StructuralPartialEq for LocalBackend
Auto Trait Implementations§
impl Freeze for LocalBackend
impl RefUnwindSafe for LocalBackend
impl Send for LocalBackend
impl Sync for LocalBackend
impl Unpin for LocalBackend
impl UnsafeUnpin for LocalBackend
impl UnwindSafe for LocalBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more