pub struct VantaEmbedded { /* private fields */ }Expand description
Stable embedded database handle used by SDKs and bindings.
Implementations§
Source§impl VantaEmbedded
impl VantaEmbedded
pub fn from_engine(engine: Arc<StorageEngine>) -> Self
pub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open_with_config(config: VantaConfig) -> Result<Self>
pub fn insert_node(&self, input: VantaNodeInput) -> Result<()>
pub fn get_node(&self, id: u64) -> Result<Option<VantaNodeRecord>>
pub fn delete_node(&self, id: u64, reason: &str) -> Result<()>
Sourcepub fn put_batch(
&self,
inputs: Vec<VantaMemoryInput>,
) -> Result<Vec<VantaMemoryRecord>>
pub fn put_batch( &self, inputs: Vec<VantaMemoryInput>, ) -> Result<Vec<VantaMemoryRecord>>
Insert or update multiple namespace-scoped persistent memory records in parallel.
Validates all inputs upfront (fail-fast on invalid namespaces/keys/metadata),
then processes the batch in parallel using Rayon for up to 5x throughput
improvement over sequential put() calls.
pub fn put(&self, input: VantaMemoryInput) -> Result<VantaMemoryRecord>
pub fn get( &self, namespace: &str, key: &str, ) -> Result<Option<VantaMemoryRecord>>
pub fn delete(&self, namespace: &str, key: &str) -> Result<bool>
pub fn list_namespaces(&self) -> Result<Vec<String>>
pub fn list( &self, namespace: &str, options: VantaMemoryListOptions, ) -> Result<VantaMemoryListPage>
pub fn search( &self, request: VantaMemorySearchRequest, ) -> Result<Vec<VantaMemorySearchHit>>
pub fn rebuild_index(&self) -> Result<VantaIndexRebuildReport>
Sourcepub fn compact_layout(&self) -> Result<u64>
pub fn compact_layout(&self) -> Result<u64>
Compacta físicamente el archivo de vectores (vector_store.vanta) reescribiendo
los nodos en orden BFS desde el entry point del grafo HNSW.
Esta operación reduce drásticamente los page-faults en accesos MMap durante búsquedas semánticas, ya que agrupa los nodos más conectados (hubs y capas superiores del HNSW) en las primeras páginas virtuales del archivo.
Retorna el número de nodos compactados.
pub fn export_namespace( &self, path: impl AsRef<Path>, namespace: &str, ) -> Result<VantaExportReport>
pub fn export_all(&self, path: impl AsRef<Path>) -> Result<VantaExportReport>
pub fn import_records( &self, records: Vec<VantaMemoryRecord>, ) -> Result<VantaImportReport>
pub fn import_file(&self, path: impl AsRef<Path>) -> Result<VantaImportReport>
Sourcepub fn audit_text_index(
&self,
namespace: Option<&str>,
) -> Result<VantaTextIndexAuditReport>
pub fn audit_text_index( &self, namespace: Option<&str>, ) -> Result<VantaTextIndexAuditReport>
Run a read-only structural audit of the derived persistent text index.
The audit compares postings, BM25 stats, phrase positions, and the
state marker against canonical memory records. It never repairs state;
callers should use rebuild_index when the report returns passed = false.
Sourcepub fn audit_text_index_deep(
&self,
namespace: Option<&str>,
) -> Result<VantaTextIndexAuditReport>
pub fn audit_text_index_deep( &self, namespace: Option<&str>, ) -> Result<VantaTextIndexAuditReport>
Run a deep structural audit of the derived persistent text index.
The audit decodes and compares individual fields (TF, positions, DF, doc lengths) across all postings against the canonical memory records.
Sourcepub fn repair_text_index(&self) -> Result<VantaTextIndexRepairReport>
pub fn repair_text_index(&self) -> Result<VantaTextIndexRepairReport>
Public repair primitive for the text index. Rebuilds all postings, doc stats, term stats, and namespace stats from canonical memory records.
pub fn operational_metrics(&self) -> VantaOperationalMetrics
Sourcepub fn search_vector(
&self,
vector: &[f32],
top_k: usize,
) -> Result<Vec<VantaSearchHit>>
pub fn search_vector( &self, vector: &[f32], top_k: usize, ) -> Result<Vec<VantaSearchHit>>
K-NN vector search across all nodes via HNSW index.
Complejidad: O(log N) en promedio. Anteriormente era O(N) brute-force.
Sourcepub fn flush(&self) -> Result<()>
pub fn flush(&self) -> Result<()>
Flush WAL y archivos memory-mapped a disco para garantizar durabilidad.
Delega al StorageEngine::flush() que sincroniza el backend KV y el
archivo de vectores MMap. Antes era un no-op silencioso.
Sourcepub fn compact_wal(&self) -> Result<()>
pub fn compact_wal(&self) -> Result<()>
Compact the WAL: flush, archive the current WAL file as
vanta.wal.<timestamp>, and start a fresh WAL.
Safe to call at any time. Archived WALs can be removed once no longer needed for crash recovery.
Sourcepub fn purge_expired(&self) -> Result<u64>
pub fn purge_expired(&self) -> Result<u64>
Scan all memory records and physically delete those whose
expires_at_ms deadline has passed. Returns the number
of records purged.
Sourcepub fn capabilities(&self) -> VantaCapabilities
pub fn capabilities(&self) -> VantaCapabilities
Return stable runtime capabilities.
Sourcepub fn add_edge(
&self,
source_id: u64,
target_id: u64,
label: &str,
weight: Option<f32>,
) -> Result<()>
pub fn add_edge( &self, source_id: u64, target_id: u64, label: &str, weight: Option<f32>, ) -> Result<()>
Add a directed edge between two nodes.
Sourcepub fn query(&self, query: &str) -> Result<VantaQueryResult>
pub fn query(&self, query: &str) -> Result<VantaQueryResult>
Execute an IQL query.
Sourcepub fn generate_snippet(
&self,
payload: &str,
text_query: &str,
with_highlighting: bool,
) -> Option<String>
pub fn generate_snippet( &self, payload: &str, text_query: &str, with_highlighting: bool, ) -> Option<String>
Generate a text snippet with optional highlighting of matched terms.
§Arguments
payload- The original text contenttext_query- The search query used to find matcheswith_highlighting- Whether to add HTML highlighting to matched terms
§Returns
Option<String>- The snippet with optional highlighting, or None if no match found
pub fn explain_memory_search( &self, request: VantaMemorySearchRequest, ) -> Result<VantaSearchExplanation>
pub fn graph_bfs(&self, roots: &[u64], max_depth: usize) -> Result<Vec<u64>>
pub fn graph_dfs(&self, roots: &[u64], max_depth: usize) -> Result<Vec<u64>>
pub fn graph_topological_sort(&self, roots: &[u64]) -> Result<Vec<u64>>
pub fn graph_is_dag(&self, roots: &[u64]) -> Result<bool>
Trait Implementations§
Source§impl Clone for VantaEmbedded
impl Clone for VantaEmbedded
Source§fn clone(&self) -> VantaEmbedded
fn clone(&self) -> VantaEmbedded
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for VantaEmbedded
impl !UnwindSafe for VantaEmbedded
impl Freeze for VantaEmbedded
impl Send for VantaEmbedded
impl Sync for VantaEmbedded
impl Unpin for VantaEmbedded
impl UnsafeUnpin for VantaEmbedded
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more