Skip to main content

RvfStore

Struct RvfStore 

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

The main RVF store handle.

Provides create, open, ingest, query, delete, compact, and close.

Implementations§

Source§

impl RvfStore

Source

pub fn create(path: &Path, options: RvfOptions) -> Result<Self, RvfError>

Create a new RVF store at the given path.

Source

pub fn open(path: &Path) -> Result<Self, RvfError>

Open an existing RVF store for read-write access.

Source

pub fn open_readonly(path: &Path) -> Result<Self, RvfError>

Open an existing RVF store for read-only access (no lock required).

Source

pub fn ingest_batch( &mut self, vectors: &[&[f32]], ids: &[u64], metadata: Option<&[MetadataEntry]>, ) -> Result<IngestResult, RvfError>

Ingest a batch of vectors into the store.

Source

pub fn query( &self, vector: &[f32], k: usize, options: &QueryOptions, ) -> Result<Vec<SearchResult>, RvfError>

Query the store for the k nearest neighbors of the given vector.

Source

pub fn delete(&mut self, ids: &[u64]) -> Result<DeleteResult, RvfError>

Soft-delete vectors by ID.

Source

pub fn delete_by_filter( &mut self, filter_expr: &FilterExpr, ) -> Result<DeleteResult, RvfError>

Soft-delete vectors matching a filter expression.

Source

pub fn status(&self) -> StoreStatus

Get the current store status.

Source

pub fn compact(&mut self) -> Result<CompactionResult, RvfError>

Run compaction to reclaim dead space.

Preserves all non-Vec, non-Manifest, non-Journal segments byte-for-byte to maintain forward compatibility with segment types this version does not understand (e.g., future Kernel, Ebpf, or vendor-extension segments).

Source

pub fn close(self) -> Result<(), RvfError>

Close the store, releasing the writer lock.

Source

pub fn embed_kernel( &mut self, arch: u8, kernel_type: u8, kernel_flags: u32, kernel_image: &[u8], api_port: u16, cmdline: Option<&str>, ) -> Result<u64, RvfError>

Embed a kernel image into this RVF file as a KERNEL_SEG.

Builds a 128-byte KernelHeader, serializes it, then delegates to the write path. Returns the segment_id of the new KERNEL_SEG.

Source

pub fn embed_kernel_with_binding( &mut self, arch: u8, kernel_type: u8, kernel_flags: u32, kernel_image: &[u8], api_port: u16, cmdline: Option<&str>, binding: &KernelBinding, ) -> Result<u64, RvfError>

Embed a kernel image with a KernelBinding footer.

The new KERNEL_SEG wire format is: KernelHeader (128B) || KernelBinding (128B) || cmdline || kernel_image

The KernelBinding ties the manifest root hash to the kernel, preventing segment-swap attacks.

Source

pub fn extract_kernel(&self) -> Result<Option<(Vec<u8>, Vec<u8>)>, RvfError>

Extract the kernel image from this RVF file.

Scans the segment directory for a KERNEL_SEG (type 0x0E) and returns the first 128 bytes (serialized KernelHeader) plus the remainder (kernel image bytes). Returns None if no KERNEL_SEG is present.

For files with KernelBinding (ADR-031), the remainder includes the 128-byte binding followed by optional cmdline and the kernel image. Use extract_kernel_binding to parse the binding separately.

Source

pub fn extract_kernel_binding(&self) -> Result<Option<KernelBinding>, RvfError>

Extract the KernelBinding from a KERNEL_SEG, if present.

Returns None if no KERNEL_SEG exists or if the payload is too short to contain a KernelBinding (backward-compatible with old format).

Source

pub fn embed_ebpf( &mut self, program_type: u8, attach_type: u8, max_dimension: u16, program_bytecode: &[u8], btf_data: Option<&[u8]>, ) -> Result<u64, RvfError>

Embed an eBPF program into this RVF file as an EBPF_SEG.

Builds a 64-byte EbpfHeader, serializes it, then delegates to the write path. Returns the segment_id of the new EBPF_SEG.

Source

pub fn extract_ebpf(&self) -> Result<Option<(Vec<u8>, Vec<u8>)>, RvfError>

Extract eBPF program bytecode from this RVF file.

Scans the segment directory for an EBPF_SEG (type 0x0F) and returns the first 64 bytes (serialized EbpfHeader) plus the remainder (program bytecode + optional BTF). Returns None if no EBPF_SEG.

Source

pub fn segment_dir(&self) -> &[(u64, u64, u64, u8)]

Get the segment directory.

Source

pub fn dimension(&self) -> u16

Get the store’s vector dimensionality.

Source

pub fn file_identity(&self) -> &FileIdentity

Get the file identity (lineage metadata) for this store.

Source

pub fn file_id(&self) -> &[u8; 16]

Get this file’s unique identifier.

Source

pub fn parent_id(&self) -> &[u8; 16]

Get the parent file’s identifier (all zeros if root).

Source

pub fn lineage_depth(&self) -> u32

Get the lineage depth (0 for root files).

Source

pub fn branch(&self, child_path: &Path) -> Result<Self, RvfError>

Create a COW branch from this store.

Creates a new child file that inherits all vectors from the parent via COW references. Writes to the child only allocate local clusters as needed. The parent should be frozen first to ensure immutability.

Source

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

Freeze (snapshot) this store. Prevents further writes to this generation.

Source

pub fn is_cow_child(&self) -> bool

Check if this store is a COW child (has a parent).

Source

pub fn cow_stats(&self) -> Option<CowStats>

Get COW statistics, if this store uses COW.

Source

pub fn membership_filter(&self) -> Option<&MembershipFilter>

Get the membership filter, if present.

Source

pub fn membership_filter_mut(&mut self) -> Option<&mut MembershipFilter>

Get a mutable reference to the membership filter.

Source

pub fn parent_path(&self) -> Option<&Path>

Get the parent file path, if this is a COW child.

Source

pub fn derive( &self, child_path: &Path, _derivation_type: DerivationType, child_options: Option<RvfOptions>, ) -> Result<Self, RvfError>

Derive a child store from this parent.

Creates a new RVF file at child_path that records this store as its parent. The child gets a new file_id, inherits dimensions and options, and records the parent’s manifest hash for provenance verification.

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.