pub struct FileRef {
pub blob_hash: String,
pub encryption_info: ConvergentEncryptionInfo,
pub filename: Option<String>,
pub content_type: Option<String>,
pub metadata: Vec<Metadata>,
}Expand description
Reference to a stored file, containing everything needed to retrieve it
This type represents metadata for files that have been encrypted using convergent encryption and stored in a content-addressable blob store. It contains all the information needed to retrieve and decrypt the file later.
Fields§
§blob_hash: StringHash of the encrypted blob in storage
This is the content-addressable hash used by the blob storage system to uniquely identify and retrieve the encrypted file data.
encryption_info: ConvergentEncryptionInfoEncryption metadata needed for decryption
Contains the encryption key, compression settings, and other metadata required to decrypt the stored file back to its original form.
filename: Option<String>Original filename (for reference)
The name of the file when it was stored. This is kept for reference and display purposes and doesn’t affect retrieval. This is optional to support cases where filename is not relevant.
content_type: Option<String>MIME type or file extension for reference
Optional content type information derived from the file extension or explicitly provided when storing the file.
metadata: Vec<Metadata>Additional metadata about the stored file
Structured metadata that applications can use to store additional information about the file (e.g., original timestamps, user tags, categories, etc.) using typed metadata variants.
Implementations§
Source§impl FileRef
impl FileRef
Sourcepub fn new(
blob_hash: String,
encryption_info: ConvergentEncryptionInfo,
filename: Option<String>,
) -> Self
pub fn new( blob_hash: String, encryption_info: ConvergentEncryptionInfo, filename: Option<String>, ) -> Self
Create a new FileRef with minimal required fields
Sourcepub fn with_metadata(self, key: String, value: String) -> Self
pub fn with_metadata(self, key: String, value: String) -> Self
Add generic metadata to the stored file info
Sourcepub fn with_structured_metadata(self, metadata: Metadata) -> Self
pub fn with_structured_metadata(self, metadata: Metadata) -> Self
Add structured metadata to the stored file info
Sourcepub fn generic_metadata(&self) -> BTreeMap<String, String>
pub fn generic_metadata(&self) -> BTreeMap<String, String>
Get all generic metadata as a key-value map for backward compatibility
This method extracts only the Metadata::Generic(key, value) entries and returns them
as a BTreeMap<String, String> for backward compatibility with APIs that expect
key-value metadata.
Sourcepub fn with_content_type(self, content_type: String) -> Self
pub fn with_content_type(self, content_type: String) -> Self
Set the content type
Sourcepub fn file_extension(&self) -> Option<String>
pub fn file_extension(&self) -> Option<String>
Get file extension from the filename (if available)
Sourcepub fn original_size(&self) -> usize
pub fn original_size(&self) -> usize
Get the original file size (from encryption info)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FileRef
impl<'de> Deserialize<'de> for FileRef
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>,
impl Eq for FileRef
impl StructuralPartialEq for FileRef
Auto Trait Implementations§
impl Freeze for FileRef
impl RefUnwindSafe for FileRef
impl Send for FileRef
impl Sync for FileRef
impl Unpin for FileRef
impl UnwindSafe for FileRef
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.