pub struct GitStorage { /* private fields */ }Expand description
Git storage backed by HashTree with configurable persistence
Implementations§
Source§impl GitStorage
impl GitStorage
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Open or create a git storage at the given path
Sourcepub fn open_with_max_bytes(
path: impl AsRef<Path>,
max_size_bytes: u64,
) -> Result<Self>
pub fn open_with_max_bytes( path: impl AsRef<Path>, max_size_bytes: u64, ) -> Result<Self>
Open or create a git storage at the given path with an explicit byte limit.
pub fn open_with_backend_and_max_bytes( path: impl AsRef<Path>, backend: StorageBackend, max_size_bytes: u64, ) -> Result<Self>
Sourcepub fn evict_if_needed(&self) -> Result<u64>
pub fn evict_if_needed(&self) -> Result<u64>
Evict old local blobs if storage is over the configured limit.
Sourcepub fn write_raw_object(
&self,
obj_type: ObjectType,
content: &[u8],
) -> Result<ObjectId>
pub fn write_raw_object( &self, obj_type: ObjectType, content: &[u8], ) -> Result<ObjectId>
Write raw object data (type + content already parsed)
Sourcepub fn delete_ref(&self, name: &str) -> Result<bool>
pub fn delete_ref(&self, name: &str) -> Result<bool>
Delete a ref
Sourcepub fn import_compressed_object(
&self,
oid: &str,
compressed_data: Vec<u8>,
) -> Result<()>
pub fn import_compressed_object( &self, oid: &str, compressed_data: Vec<u8>, ) -> Result<()>
Import a raw git object (already in loose format, zlib compressed) Used when fetching existing objects from remote before push
Sourcepub fn import_ref(&self, name: &str, value: &str) -> Result<()>
pub fn import_ref(&self, name: &str, value: &str) -> Result<()>
Import a ref directly (used when loading existing refs from remote)
Sourcepub fn get_root_cid(&self) -> Result<Option<Cid>>
pub fn get_root_cid(&self) -> Result<Option<Cid>>
Get the cached root CID (returns None if tree hasn’t been built)
Sourcepub fn default_branch(&self) -> Result<Option<String>>
pub fn default_branch(&self) -> Result<Option<String>>
Get the default branch name
Sourcepub fn build_tree(&self) -> Result<Cid>
pub fn build_tree(&self) -> Result<Cid>
Build the hashtree and return the root CID (hash + encryption key)
Sourcepub fn store(&self) -> &Arc<LocalStore>
pub fn store(&self) -> &Arc<LocalStore>
Get the underlying store
Sourcepub fn hashtree(&self) -> &HashTree<LocalStore>
pub fn hashtree(&self) -> &HashTree<LocalStore>
Get the HashTree for direct access
Sourcepub fn push_to_file_servers(
&self,
blossom: &BlossomClient,
) -> Result<(usize, usize)>
pub fn push_to_file_servers( &self, blossom: &BlossomClient, ) -> Result<(usize, usize)>
Push all blobs to file servers
Auto Trait Implementations§
impl !Freeze for GitStorage
impl RefUnwindSafe for GitStorage
impl Send for GitStorage
impl Sync for GitStorage
impl Unpin for GitStorage
impl UnsafeUnpin for GitStorage
impl UnwindSafe for GitStorage
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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