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
impl RvfStore
Sourcepub fn create(path: &Path, options: RvfOptions) -> Result<Self, RvfError>
pub fn create(path: &Path, options: RvfOptions) -> Result<Self, RvfError>
Create a new RVF store at the given path.
Sourcepub fn open(path: &Path) -> Result<Self, RvfError>
pub fn open(path: &Path) -> Result<Self, RvfError>
Open an existing RVF store for read-write access.
Sourcepub fn open_readonly(path: &Path) -> Result<Self, RvfError>
pub fn open_readonly(path: &Path) -> Result<Self, RvfError>
Open an existing RVF store for read-only access (no lock required).
Sourcepub fn ingest_batch(
&mut self,
vectors: &[&[f32]],
ids: &[u64],
metadata: Option<&[MetadataEntry]>,
) -> Result<IngestResult, RvfError>
pub fn ingest_batch( &mut self, vectors: &[&[f32]], ids: &[u64], metadata: Option<&[MetadataEntry]>, ) -> Result<IngestResult, RvfError>
Ingest a batch of vectors into the store.
Sourcepub fn query(
&self,
vector: &[f32],
k: usize,
options: &QueryOptions,
) -> Result<Vec<SearchResult>, RvfError>
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.
Sourcepub fn delete(&mut self, ids: &[u64]) -> Result<DeleteResult, RvfError>
pub fn delete(&mut self, ids: &[u64]) -> Result<DeleteResult, RvfError>
Soft-delete vectors by ID.
Sourcepub fn delete_by_filter(
&mut self,
filter_expr: &FilterExpr,
) -> Result<DeleteResult, RvfError>
pub fn delete_by_filter( &mut self, filter_expr: &FilterExpr, ) -> Result<DeleteResult, RvfError>
Soft-delete vectors matching a filter expression.
Sourcepub fn status(&self) -> StoreStatus
pub fn status(&self) -> StoreStatus
Get the current store status.
Sourcepub fn compact(&mut self) -> Result<CompactionResult, RvfError>
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).
Sourcepub 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>
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.
Sourcepub 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>
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.
Sourcepub fn extract_kernel(&self) -> Result<Option<(Vec<u8>, Vec<u8>)>, RvfError>
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.
Sourcepub fn extract_kernel_binding(&self) -> Result<Option<KernelBinding>, RvfError>
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).
Sourcepub fn embed_ebpf(
&mut self,
program_type: u8,
attach_type: u8,
max_dimension: u16,
program_bytecode: &[u8],
btf_data: Option<&[u8]>,
) -> Result<u64, RvfError>
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.
Sourcepub fn extract_ebpf(&self) -> Result<Option<(Vec<u8>, Vec<u8>)>, RvfError>
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.
Sourcepub fn file_identity(&self) -> &FileIdentity
pub fn file_identity(&self) -> &FileIdentity
Get the file identity (lineage metadata) for this store.
Sourcepub fn lineage_depth(&self) -> u32
pub fn lineage_depth(&self) -> u32
Get the lineage depth (0 for root files).
Sourcepub fn branch(&self, child_path: &Path) -> Result<Self, RvfError>
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.
Sourcepub fn freeze(&mut self) -> Result<(), RvfError>
pub fn freeze(&mut self) -> Result<(), RvfError>
Freeze (snapshot) this store. Prevents further writes to this generation.
Sourcepub fn is_cow_child(&self) -> bool
pub fn is_cow_child(&self) -> bool
Check if this store is a COW child (has a parent).
Sourcepub fn membership_filter(&self) -> Option<&MembershipFilter>
pub fn membership_filter(&self) -> Option<&MembershipFilter>
Get the membership filter, if present.
Sourcepub fn membership_filter_mut(&mut self) -> Option<&mut MembershipFilter>
pub fn membership_filter_mut(&mut self) -> Option<&mut MembershipFilter>
Get a mutable reference to the membership filter.
Sourcepub fn parent_path(&self) -> Option<&Path>
pub fn parent_path(&self) -> Option<&Path>
Get the parent file path, if this is a COW child.
Sourcepub fn derive(
&self,
child_path: &Path,
_derivation_type: DerivationType,
child_options: Option<RvfOptions>,
) -> Result<Self, RvfError>
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.