#![allow(rustdoc::broken_intra_doc_links)]
mod allocator;
mod block;
mod directory;
mod header;
pub mod lock;
mod single_file;
mod wal;
pub use allocator::BlockAllocator;
pub use block::{BLOCK_SIZE, BlockId, Extent, HEADER_SIZE};
pub use directory::{MetadataSnapshot, SegmentEntry, VectorIndexEntry};
pub use header::{ActiveRoot, FORMAT_VERSION, FileHeader, MAGIC, RootPointer, xxh3_checksum};
#[cfg(unix)]
pub use single_file::SingleFileDirectory;
pub use wal::{DurabilityMode, Wal, WalRecord, replay_wal};
use crate::core::{FieldId, Result, SegmentId};
pub trait Storage: Send {
fn write_segment(&mut self, segment_id: SegmentId, data: &[u8]) -> Result<()>;
fn read_segment(&self, segment_id: SegmentId) -> Result<Vec<u8>>;
fn commit(&mut self) -> Result<()>;
fn segments(&self) -> &[SegmentEntry];
fn generation(&self) -> u64;
fn set_user_metadata(&mut self, metadata: Vec<u8>);
fn user_metadata(&self) -> &[u8];
fn remove_segments(&mut self, segment_ids: &[SegmentId]);
fn write_vector_index(&mut self, field_id: FieldId, data: &[u8]) -> Result<()>;
fn read_vector_index(&self, field_id: FieldId) -> Result<Option<Vec<u8>>>;
fn vector_index_fields(&self) -> Vec<FieldId>;
fn remove_vector_index(&mut self, field_id: FieldId);
fn set_write_timeout(&mut self, _timeout: std::time::Duration) {}
}