pub struct Entry {
pub key: Key,
pub value: Value,
pub entry_type: EntryType,
pub created_at: u64,
pub modified_at: u64,
pub version: u64,
pub metadata: HashMap<String, String>,
pub checksum: Option<[u8; 32]>,
}Expand description
A complete database entry with metadata
Fields§
§key: KeyThe entry key
value: ValueThe entry value
entry_type: EntryTypeEntry type
created_at: u64Creation timestamp (Unix epoch milliseconds)
modified_at: u64Last modified timestamp
version: u64Version number for optimistic concurrency
metadata: HashMap<String, String>Custom metadata
checksum: Option<[u8; 32]>Checksum for integrity verification
Implementations§
Source§impl Entry
impl Entry
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Set metadata
Sourcepub fn compute_checksum(&mut self) -> Result<[u8; 32]>
pub fn compute_checksum(&mut self) -> Result<[u8; 32]>
Compute and cache checksum
Sourcepub fn verify_checksum(&self) -> Result<bool>
pub fn verify_checksum(&self) -> Result<bool>
Verify checksum
Sourcepub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Get the size of this entry in bytes (approximate)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Entry
impl<'de> Deserialize<'de> for Entry
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
Auto Trait Implementations§
impl Freeze for Entry
impl RefUnwindSafe for Entry
impl Send for Entry
impl Sync for Entry
impl Unpin for Entry
impl UnwindSafe for Entry
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