pub struct CollectionMetadata {
pub version: MetadataVersion,
pub name: String,
pub created_at: u64,
pub updated_at: u64,
pub document_count: u64,
pub total_size_bytes: u64,
pub wal_config: Option<CollectionWalConfig>,
}Expand description
Collection metadata stored on disk.
This struct contains all persistent metadata for a collection, including statistics, operational state, and WAL configuration.
Storage limit: 1MB total serialized size
Fields§
§version: MetadataVersionMetadata format version
name: StringCollection name
created_at: u64Creation timestamp (Unix timestamp)
updated_at: u64Last modification timestamp
document_count: u64Number of documents in the collection
total_size_bytes: u64Total size of all documents (bytes)
wal_config: Option<CollectionWalConfig>WAL configuration for this collection
Implementations§
Source§impl CollectionMetadata
impl CollectionMetadata
Sourcepub fn upgrade_to_current(&mut self) -> Result<(), String>
pub fn upgrade_to_current(&mut self) -> Result<(), String>
Upgrade metadata to the current version if needed
This method handles forward migration of metadata from older versions to the current version. It modifies the metadata in-place.
Sourcepub const fn needs_upgrade(&self) -> bool
pub const fn needs_upgrade(&self) -> bool
Check if metadata needs upgrade to current version
pub fn touch(&mut self)
Sourcepub fn add_document(&mut self, size_bytes: u64)
pub fn add_document(&mut self, size_bytes: u64)
Increment document count and size
Sourcepub fn remove_document(&mut self, size_bytes: u64)
pub fn remove_document(&mut self, size_bytes: u64)
Decrement document count and size
Sourcepub fn update_document_size(&mut self, old_size: u64, new_size: u64)
pub fn update_document_size(&mut self, old_size: u64, new_size: u64)
Update document size (for modifications)
Trait Implementations§
Source§impl Clone for CollectionMetadata
impl Clone for CollectionMetadata
Source§fn clone(&self) -> CollectionMetadata
fn clone(&self) -> CollectionMetadata
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 CollectionMetadata
impl Debug for CollectionMetadata
Source§impl<'de> Deserialize<'de> for CollectionMetadata
impl<'de> Deserialize<'de> for CollectionMetadata
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 CollectionMetadata
impl RefUnwindSafe for CollectionMetadata
impl Send for CollectionMetadata
impl Sync for CollectionMetadata
impl Unpin for CollectionMetadata
impl UnwindSafe for CollectionMetadata
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