pub struct ChunkMetadata { /* private fields */ }Expand description
Metadata associated with a file chunk during processing
This value object encapsulates all metadata needed to track and manage chunks throughout the pipeline processing lifecycle, following DDD principles.
§Key Features
- Chunk Identification: Unique identification and description
- Size Tracking: Accurate size tracking in bytes
- Integrity Verification: Checksum-based integrity checking
- Processing Context: Track processing stages and operations
- Temporal Tracking: Timestamp-based lifecycle management
- Extensible Attributes: Custom metadata through key-value attributes
§Examples
Implementations§
Source§impl ChunkMetadata
impl ChunkMetadata
Sourcepub fn new_for_testing(
chunk_size: usize,
identifier: String,
checksum: Option<String>,
stage: Option<String>,
) -> Self
pub fn new_for_testing( chunk_size: usize, identifier: String, checksum: Option<String>, stage: Option<String>, ) -> Self
Creates chunk metadata with all fields for testing
Sourcepub fn chunk_size(&self) -> usize
pub fn chunk_size(&self) -> usize
Gets the chunk size
Sourcepub fn identifier(&self) -> &str
pub fn identifier(&self) -> &str
Gets the chunk identifier
Sourcepub fn created_at(&self) -> DateTime<Utc>
pub fn created_at(&self) -> DateTime<Utc>
Gets the creation timestamp
Sourcepub fn with_checksum(self, checksum: String) -> Self
pub fn with_checksum(self, checksum: String) -> Self
Sets the checksum for integrity verification
Sourcepub fn with_stage(self, stage: String) -> Self
pub fn with_stage(self, stage: String) -> Self
Sets the processing stage
Sourcepub fn with_attribute(self, key: String, value: String) -> Self
pub fn with_attribute(self, key: String, value: String) -> Self
Adds a custom attribute
Sourcepub fn get_attribute(&self, key: &str) -> Option<&str>
pub fn get_attribute(&self, key: &str) -> Option<&str>
Gets a custom attribute
Sourcepub fn attributes(&self) -> &HashMap<String, String>
pub fn attributes(&self) -> &HashMap<String, String>
Gets all attributes
Sourcepub fn validate(&self) -> Result<(), PipelineError>
pub fn validate(&self) -> Result<(), PipelineError>
Validates the metadata integrity
Trait Implementations§
Source§impl Clone for ChunkMetadata
impl Clone for ChunkMetadata
Source§fn clone(&self) -> ChunkMetadata
fn clone(&self) -> ChunkMetadata
Returns a duplicate of the value. Read more
1.0.0 · 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 ChunkMetadata
impl Debug for ChunkMetadata
Source§impl Default for ChunkMetadata
impl Default for ChunkMetadata
Source§impl<'de> Deserialize<'de> for ChunkMetadata
impl<'de> Deserialize<'de> for ChunkMetadata
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 Display for ChunkMetadata
impl Display for ChunkMetadata
Source§impl PartialEq for ChunkMetadata
impl PartialEq for ChunkMetadata
Source§impl Serialize for ChunkMetadata
impl Serialize for ChunkMetadata
impl Eq for ChunkMetadata
impl StructuralPartialEq for ChunkMetadata
Auto Trait Implementations§
impl Freeze for ChunkMetadata
impl RefUnwindSafe for ChunkMetadata
impl Send for ChunkMetadata
impl Sync for ChunkMetadata
impl Unpin for ChunkMetadata
impl UnwindSafe for ChunkMetadata
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> 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