pub struct LfsStorage { /* private fields */ }Expand description
Complete LFS storage operations
This struct provides all LFS functionality in one place, delegating to XetStorage for the actual smudge/clean operations.
Implementations§
Source§impl LfsStorage
impl LfsStorage
Sourcepub async fn new(config: &XetConfig) -> Git2DBResult<Self>
pub async fn new(config: &XetConfig) -> Git2DBResult<Self>
Create new LFS storage with XET backend
Sourcepub fn is_lfs_pointer(&self, content: &str) -> bool
pub fn is_lfs_pointer(&self, content: &str) -> bool
Check if content is an LFS pointer
Sourcepub fn is_xet_pointer(&self, content: &str) -> bool
pub fn is_xet_pointer(&self, content: &str) -> bool
Check if content is an XET pointer
Sourcepub fn is_pointer(&self, content: &str) -> bool
pub fn is_pointer(&self, content: &str) -> bool
Check if content is any type of pointer (LFS or XET)
Sourcepub fn parse_lfs_pointer(&self, content: &str) -> Git2DBResult<LfsPointer>
pub fn parse_lfs_pointer(&self, content: &str) -> Git2DBResult<LfsPointer>
Parse LFS pointer from content
Sourcepub async fn smudge_lfs_pointer(
&self,
pointer: &LfsPointer,
) -> Git2DBResult<Vec<u8>>
pub async fn smudge_lfs_pointer( &self, pointer: &LfsPointer, ) -> Git2DBResult<Vec<u8>>
Smudge LFS pointer to memory
Sourcepub async fn smudge_lfs_pointer_to_file_bounded(
&self,
pointer: &LfsPointer,
path: &Path,
) -> Git2DBResult<u64>
pub async fn smudge_lfs_pointer_to_file_bounded( &self, pointer: &LfsPointer, path: &Path, ) -> Git2DBResult<u64>
Stream a captured LFS pointer through a writer that rejects any byte beyond its declared size before it reaches the projection filesystem.
Sourcepub async fn smudge_xet_pointer_to_file_bounded(
&self,
pointer: &str,
path: &Path,
max_output_bytes: u64,
) -> Git2DBResult<u64>
pub async fn smudge_xet_pointer_to_file_bounded( &self, pointer: &str, path: &Path, max_output_bytes: u64, ) -> Git2DBResult<u64>
Stream an XET JSON pointer through a writer that rejects bytes beyond its authenticated pointer size before they reach the projection disk.
Sourcepub async fn smudge_lfs_pointer_to_file(
&self,
pointer: &LfsPointer,
path: &Path,
) -> Git2DBResult<()>
pub async fn smudge_lfs_pointer_to_file( &self, pointer: &LfsPointer, path: &Path, ) -> Git2DBResult<()>
Stream a captured LFS pointer’s payload into a private file. Callers must independently verify SHA-256 and size before publishing it.
Sourcepub async fn smudge_lfs_pointer_validated(
&self,
pointer: &LfsPointer,
) -> Git2DBResult<Vec<u8>>
pub async fn smudge_lfs_pointer_validated( &self, pointer: &LfsPointer, ) -> Git2DBResult<Vec<u8>>
Smudge LFS pointer with validation
Sourcepub async fn clean_file(&self, path: &Path) -> Git2DBResult<String>
pub async fn clean_file(&self, path: &Path) -> Git2DBResult<String>
Upload file and return XET pointer
Sourcepub async fn clean_bytes(&self, data: &[u8]) -> Git2DBResult<String>
pub async fn clean_bytes(&self, data: &[u8]) -> Git2DBResult<String>
Upload data from memory and return XET pointer
Sourcepub async fn smudge_file(
&self,
pointer: &str,
output_path: &Path,
) -> Git2DBResult<()>
pub async fn smudge_file( &self, pointer: &str, output_path: &Path, ) -> Git2DBResult<()>
Download XET pointer to file
Sourcepub async fn smudge_bytes(&self, pointer: &str) -> Git2DBResult<Vec<u8>>
pub async fn smudge_bytes(&self, pointer: &str) -> Git2DBResult<Vec<u8>>
Download XET pointer to memory
Sourcepub async fn load_file(&self, file_path: &Path) -> Git2DBResult<Vec<u8>>
pub async fn load_file(&self, file_path: &Path) -> Git2DBResult<Vec<u8>>
Load file with automatic LFS/XET pointer detection and smudging
This implements LFS spec-compliant pointer detection:
- Checks file size via metadata (pointers MUST be < 1024 bytes)
- Reads first 100 bytes for pointer detection (per LFS spec)
- If pointer detected, reads rest and smudges
- If not pointer, reads full file efficiently
Use this for files outside git operations (git-xet-filter handles files in git repos).
Sourcepub async fn scan_lfs_files(
&self,
directory: &Path,
) -> Git2DBResult<Vec<PathBuf>>
pub async fn scan_lfs_files( &self, directory: &Path, ) -> Git2DBResult<Vec<PathBuf>>
Scan directory for LFS files using git2 tree traversal
Sourcepub async fn process_worktree(
&self,
worktree_path: &Path,
) -> Git2DBResult<ProcessingStats>
pub async fn process_worktree( &self, worktree_path: &Path, ) -> Git2DBResult<ProcessingStats>
Process all LFS files in a worktree by smudging them in place
Sourcepub async fn process_worktree_with_progress(
&self,
worktree_path: &Path,
progress: Option<&Arc<dyn ProgressReporter>>,
) -> Git2DBResult<ProcessingStats>
pub async fn process_worktree_with_progress( &self, worktree_path: &Path, progress: Option<&Arc<dyn ProgressReporter>>, ) -> Git2DBResult<ProcessingStats>
Process all LFS files in a worktree with optional progress reporting
Sourcepub async fn batch_process(
&self,
worktree_path: &Path,
concurrency: usize,
) -> Git2DBResult<ProcessingStats>
pub async fn batch_process( &self, worktree_path: &Path, concurrency: usize, ) -> Git2DBResult<ProcessingStats>
Batch process LFS files with concurrency control
Trait Implementations§
Source§impl Clone for LfsStorage
impl Clone for LfsStorage
Source§fn clone(&self) -> LfsStorage
fn clone(&self) -> LfsStorage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LfsStorage
impl !RefUnwindSafe for LfsStorage
impl Send for LfsStorage
impl Sync for LfsStorage
impl Unpin for LfsStorage
impl UnsafeUnpin for LfsStorage
impl !UnwindSafe for LfsStorage
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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