pub struct ByteStorage { /* private fields */ }Expand description
Raw byte storage engine (pure Rust core) Simple store/retrieve interface with no type awareness
Implementations§
Source§impl ByteStorage
impl ByteStorage
Sourcepub fn store(
&self,
data: &[u8],
format: Option<String>,
) -> Result<Vec<u8>, ByteStorageError>
pub fn store( &self, data: &[u8], format: Option<String>, ) -> Result<Vec<u8>, ByteStorageError>
Store arbitrary bytes with compression and checksums
Returns serialized StorageEnvelope bytes
Sourcepub fn retrieve(
&self,
envelope_bytes: &[u8],
) -> Result<(Vec<u8>, String), ByteStorageError>
pub fn retrieve( &self, envelope_bytes: &[u8], ) -> Result<(Vec<u8>, String), ByteStorageError>
Retrieve and validate stored bytes
Returns (original_data, format_identifier)
Sourcepub fn estimate_compression(&self, data: &[u8]) -> Result<f64, ByteStorageError>
pub fn estimate_compression(&self, data: &[u8]) -> Result<f64, ByteStorageError>
Get compression ratio for given data
Sourcepub fn validate(&self, envelope_bytes: &[u8]) -> bool
pub fn validate(&self, envelope_bytes: &[u8]) -> bool
Validate envelope without extracting data
Sourcepub fn get_last_metrics(&self) -> OperationMetrics
pub fn get_last_metrics(&self) -> OperationMetrics
Get metrics from last operation
Returns a snapshot of metrics from the most recent store() or retrieve() call
Sourcepub fn max_uncompressed_size(&self) -> usize
pub fn max_uncompressed_size(&self) -> usize
Get security limits
pub fn max_compressed_size(&self) -> usize
pub fn max_compression_ratio(&self) -> u64
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ByteStorage
impl RefUnwindSafe for ByteStorage
impl Send for ByteStorage
impl Sync for ByteStorage
impl Unpin for ByteStorage
impl UnwindSafe for ByteStorage
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