Skip to main content

CowEngine

Struct CowEngine 

Source
pub struct CowEngine { /* private fields */ }
Expand description

COW read/write engine for vector-addressed clusters.

Implementations§

Source§

impl CowEngine

Source

pub fn new( cluster_size: u32, vectors_per_cluster: u32, bytes_per_vector: u32, ) -> Self

Create a new COW engine.

§Panics

Panics if vectors_per_cluster is 0 (would cause division by zero on read/write).

Source

pub fn from_parent( cluster_count: u32, cluster_size: u32, vectors_per_cluster: u32, bytes_per_vector: u32, ) -> Self

Create a COW engine initialized from a parent (all clusters point to parent).

§Panics

Panics if vectors_per_cluster is 0 (would cause division by zero on read/write).

Source

pub fn cow_map(&self) -> &CowMap

Get a reference to the underlying COW map.

Source

pub fn read_vector( &self, vector_id: u64, file: &File, parent: Option<&File>, ) -> Result<Vec<u8>, RvfError>

Read a vector by ID. Returns byte slice of vector data.

Source

pub fn read_cluster( &self, cluster_id: u32, file: &File, parent: Option<&File>, ) -> Result<Vec<u8>, RvfError>

Read an entire cluster. Returns cluster data.

Source

pub fn write_vector( &mut self, vector_id: u64, data: &[u8], ) -> Result<(), RvfError>

Write a vector. Handles COW: copies parent slab if inherited.

Writes are buffered for coalescing. Call flush_writes to commit.

Source

pub fn flush_writes( &mut self, file: &mut File, parent: Option<&File>, ) -> Result<Vec<WitnessEvent>, RvfError>

Flush write coalescing buffer. Performs actual slab copies for inherited clusters and applies all pending mutations.

Source

pub fn freeze(&mut self, epoch: u32) -> Result<(), RvfError>

Snapshot-freeze: set epoch, prevent further writes to this generation.

Source

pub fn is_frozen(&self) -> bool

Check if frozen.

Source

pub fn snapshot_epoch(&self) -> u32

Get the snapshot epoch.

Source

pub fn stats(&self) -> CowStats

Get COW statistics.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.