pub struct FileHandle {
pub id: String,
pub path: PathBuf,
pub metadata: FileMetadata,
pub ref_count: Arc<AtomicUsize>,
}Expand description
A handle to a stored file
FileHandle tracks the file ID, path, and metadata. Note: Reference counting is managed by FileIndex, not FileHandle. FileHandle’s ref_count is for informational purposes only.
Fields§
§id: StringUnique file ID (SHA256 hash)
path: PathBufStorage path relative to the data directory
metadata: FileMetadataFile metadata
ref_count: Arc<AtomicUsize>Local reference count view (for debugging/information)
Implementations§
Source§impl FileHandle
impl FileHandle
Sourcepub fn new(id: String, path: PathBuf, metadata: FileMetadata) -> Self
pub fn new(id: String, path: PathBuf, metadata: FileMetadata) -> Self
Create a new file handle
Sourcepub fn with_ref_count(
id: String,
path: PathBuf,
metadata: FileMetadata,
count: usize,
) -> Self
pub fn with_ref_count( id: String, path: PathBuf, metadata: FileMetadata, count: usize, ) -> Self
Create from index entry with specific ref count
Sourcepub fn is_last_ref(&self) -> bool
pub fn is_last_ref(&self) -> bool
Check if this is the last reference
Trait Implementations§
Source§impl Clone for FileHandle
impl Clone for FileHandle
Auto Trait Implementations§
impl Freeze for FileHandle
impl RefUnwindSafe for FileHandle
impl Send for FileHandle
impl Sync for FileHandle
impl Unpin for FileHandle
impl UnsafeUnpin for FileHandle
impl UnwindSafe for FileHandle
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,
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