Skip to main content

SharedGraph

Struct SharedGraph 

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

Per-graph shared runtime state.

Since v1.2 (BRIEF 1) every snapshot publish is funneled through a single per-graph committer thread (CommitterThread), which is the sole writer of the snapshot ArcSwap cell. begin_write hands each WriteTxn a cheap submit handle; commit/compact seal-and-submit to the committer and block until it publishes. This single-committer + sole-publisher discipline is what preserves D10 strict-serializability once seal() drops the write lock early — it is load-bearing and NOT type-enforced (a second committer or ArcSwap writer would silently break it).

Implementations§

Source§

impl SharedGraph

Source

pub fn vector_candidate_set( &self, name: &DbString, ) -> Result<Option<VectorCandidateSet>, ProviderError>

Look up a generation-checked maintained vector candidate set by name.

Ok(None) means no maintained candidate-state provider is registered or the provider has no set named name. The returned set is tied to the same immutable snapshot generation used for the lookup.

§Errors

Returns ProviderError when the candidate-state provider is present but cannot prove it has applied through the current graph generation.

Source

pub fn vector_candidate_state_infos( &self, ) -> Result<Vec<VectorCandidateStateInfo>, ProviderError>

Return generation-checked metadata for maintained vector candidate states.

An empty vector means no maintained candidate-state provider is registered for this graph. The metadata is tied to the same immutable graph snapshot that supplies the generation value, so callers can use the returned names immediately with vector candidate-state scoring.

§Errors

Returns ProviderError when the candidate-state provider is present but cannot prove it has applied through the current graph generation.

Source§

impl SharedGraph

Source

pub fn exact_json_contains_nodes( &self, label: &DbString, property: &DbString, candidate: &JsonValue, k: usize, ) -> GraphResult<Vec<JsonContainmentHit>>

Exhaustively find JSON-valued node properties in the current snapshot.

Source

pub fn exact_json_contains_nodes_checked( &self, label: &DbString, property: &DbString, candidate: &JsonValue, k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<JsonContainmentHit>, JsonSearchError>

Exhaustively find JSON-valued node properties with cancellation checks.

Source

pub fn exact_json_path_exists_nodes( &self, label: &DbString, property: &DbString, path: &[JsonPathSelector], k: usize, ) -> GraphResult<Vec<JsonPathHit>>

Exhaustively find JSON-valued node properties where path exists.

Source

pub fn exact_json_path_exists_nodes_checked( &self, label: &DbString, property: &DbString, path: &[JsonPathSelector], k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<JsonPathHit>, JsonSearchError>

Exhaustively find JSON-valued node properties with path-existence checks.

Source

pub fn exact_json_path_contains_nodes( &self, label: &DbString, property: &DbString, path: &[JsonPathSelector], candidate: &JsonValue, k: usize, ) -> GraphResult<Vec<JsonPathContainmentHit>>

Exhaustively find JSON-valued node properties whose selected path contains candidate.

Source

pub fn exact_json_path_contains_nodes_checked( &self, label: &DbString, property: &DbString, path: &[JsonPathSelector], candidate: &JsonValue, k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<JsonPathContainmentHit>, JsonSearchError>

Exhaustively find JSON path containment matches with cancellation checks.

Source

pub fn exact_json_path_value_nodes( &self, label: &DbString, property: &DbString, path: &[JsonPathSelector], k: usize, ) -> GraphResult<Vec<JsonPathValueHit>>

Exhaustively find JSON-valued node properties where path selects a value.

Source

pub fn exact_json_path_value_nodes_checked( &self, label: &DbString, property: &DbString, path: &[JsonPathSelector], k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<JsonPathValueHit>, JsonSearchError>

Exhaustively find JSON path values with cancellation checks.

Source§

impl SharedGraph

Source

pub fn exact_json_contains_candidate_nodes( &self, label: &DbString, property: &DbString, candidate: &JsonValue, candidates: &[NodeId], k: usize, ) -> GraphResult<Vec<JsonContainmentHit>>

Find candidate nodes whose JSON property contains candidate.

Source

pub fn exact_json_contains_candidate_nodes_checked( &self, label: &DbString, property: &DbString, candidate: &JsonValue, candidates: &[NodeId], k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<JsonContainmentHit>, JsonSearchError>

Find candidate JSON containment matches with cancellation checks.

Source

pub fn exact_json_path_exists_candidate_nodes( &self, label: &DbString, property: &DbString, path: &[JsonPathSelector], candidates: &[NodeId], k: usize, ) -> GraphResult<Vec<JsonPathHit>>

Find candidate nodes whose JSON property has path.

Source

pub fn exact_json_path_exists_candidate_nodes_checked( &self, label: &DbString, property: &DbString, path: &[JsonPathSelector], candidates: &[NodeId], k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<JsonPathHit>, JsonSearchError>

Find candidate JSON path-existence matches with cancellation checks.

Source

pub fn exact_json_path_contains_candidate_nodes( &self, label: &DbString, property: &DbString, options: JsonPathContainmentCandidateOptions<'_>, ) -> GraphResult<Vec<JsonPathContainmentHit>>

Find candidate nodes whose selected JSON path contains candidate.

Source

pub fn exact_json_path_contains_candidate_nodes_checked( &self, label: &DbString, property: &DbString, options: JsonPathContainmentCandidateOptions<'_>, checker: CancellationChecker<'_>, ) -> Result<Vec<JsonPathContainmentHit>, JsonSearchError>

Find candidate JSON path-containment matches with cancellation checks.

Source

pub fn exact_json_path_value_candidate_nodes( &self, label: &DbString, property: &DbString, path: &[JsonPathSelector], candidates: &[NodeId], k: usize, ) -> GraphResult<Vec<JsonPathValueHit>>

Return selected JSON values for matching candidate nodes.

Source

pub fn exact_json_path_value_candidate_nodes_checked( &self, label: &DbString, property: &DbString, path: &[JsonPathSelector], candidates: &[NodeId], k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<JsonPathValueHit>, JsonSearchError>

Return selected candidate JSON path values with cancellation checks.

Source§

impl SharedGraph

Source

pub fn recover(dir: &Path, graph_id: GraphId) -> GraphResult<Self>

Recover an open (GG01) shared graph from a persistence directory.

graph_id is the caller-asserted identity. If a snapshot is present and declares a bound_type, recovery fails — a closed graph must be recovered via SharedGraph::recover_closed.

§Errors

Returns persistence errors, crate::GraphError::Provider when a snapshot disagrees with graph_id or declares a closed binding, or graph errors when the recovered state cannot be materialized.

Source

pub fn recover_with_providers( dir: &Path, graph_id: GraphId, providers: Vec<Arc<dyn IndexProvider>>, ) -> GraphResult<Self>

Recover an open (GG01) shared graph with extension index providers.

Each supplied provider participates in snapshot-section recovery and WAL replay, then remains attached to the returned graph so future commits route to the same provider set.

§Errors

Returns persistence errors, crate::GraphError::Provider when provider tags are duplicated or recovered provider state is inconsistent, or graph errors when the recovered state cannot be materialized.

Source

pub fn recover_closed( dir: &Path, graph_id: GraphId, bound_type: GraphTypeDef, ) -> GraphResult<Self>

Recover a closed (GG02) shared graph bound to bound_type.

graph_id and bound_type are caller-asserted; recovery validates against the snapshot:

  • If the snapshot’s CORE/META references a bound_type via CORE/GTYP, it must equal bound_type or recovery fails (drift).
  • If the snapshot declares no binding but bound_type is provided, recovery fails (snapshot says open, caller says closed).
  • If no snapshot is present (WAL-only or empty-dir), the caller’s bound_type is used and validation runs against replayed state.
§Errors

Returns persistence errors, crate::GraphError::Provider on type drift / inconsistency, crate::GraphError::TypeViolation when recovered entities don’t conform to bound_type, or graph errors when the recovered state cannot be materialized.

Source

pub fn recover_closed_with_providers( dir: &Path, graph_id: GraphId, bound_type: GraphTypeDef, providers: Vec<Arc<dyn IndexProvider>>, ) -> GraphResult<Self>

Recover a closed (GG02) shared graph with extension index providers.

This is the provider-aware counterpart to SharedGraph::recover_closed. Recovery validates the caller-supplied bound_type, rebuilds the supplied index providers from snapshot sections and WAL replay, and returns a live WAL-backed graph with those providers still attached.

§Errors

Returns persistence errors, crate::GraphError::Provider on provider tag duplication or type drift, crate::GraphError::TypeViolation when recovered entities don’t conform to bound_type, or graph errors when the recovered state cannot be materialized.

Source§

impl SharedGraph

Source

pub fn create_property_index( &self, label: DbString, property: DbString, kind: TypedIndexKind, ) -> GraphResult<()>

Register a built-in node property index for (label, property).

The current node columns are scanned under the write lock and the published snapshot is updated in one transaction.

§Errors

Returns GraphError::PropertyIndexAlreadyExists if the pair is already registered, or GraphError::IndexValueRejected if any existing node with label has a non-null value that does not match kind.

Source

pub fn create_property_index_named( &self, label: DbString, property: DbString, kind: TypedIndexKind, name: Option<DbString>, ) -> GraphResult<()>

Register a built-in node property index with optional catalog name.

Source

pub fn drop_property_index( &self, label: DbString, property: DbString, ) -> GraphResult<()>

Drop a built-in node property index.

The operation is idempotent; dropping an absent index succeeds without publishing a new snapshot.

Source

pub fn create_edge_property_index( &self, label: DbString, property: DbString, kind: TypedIndexKind, ) -> GraphResult<()>

Register a built-in edge property index for (label, property).

The current edge columns are scanned under the write lock and the published snapshot is updated in one transaction.

§Errors

Returns GraphError::PropertyIndexAlreadyExists if the pair is already registered, or GraphError::IndexValueRejected if any existing edge with label has a non-null value that does not match kind.

Source

pub fn create_edge_property_index_named( &self, label: DbString, property: DbString, kind: TypedIndexKind, name: Option<DbString>, ) -> GraphResult<()>

Register a built-in edge property index with optional catalog name.

Source

pub fn drop_edge_property_index( &self, label: DbString, property: DbString, ) -> GraphResult<()>

Drop a built-in edge property index.

The operation is idempotent; dropping an absent index succeeds without publishing a new snapshot.

Source

pub fn create_vector_index( &self, label: DbString, property: DbString, kind: VectorIndexKind, dimension: u32, ) -> GraphResult<()>

Register a built-in node vector index for (label, property).

The current node columns are scanned under the write lock and the published snapshot is updated in one transaction.

§Errors

Returns GraphError::VectorIndexAlreadyExists if the pair is already registered, GraphError::VectorIndexInvalidDimension when dimension is zero, or GraphError::VectorIndexValueRejected if any existing node with label has a non-null value for property that is not a vector with the declared dimension.

Source

pub fn create_vector_index_named( &self, label: DbString, property: DbString, kind: VectorIndexKind, dimension: u32, name: Option<DbString>, ) -> GraphResult<()>

Register a built-in node vector index with optional catalog name.

Source

pub fn create_vector_index_named_with_config( &self, label: DbString, property: DbString, kind: VectorIndexKind, dimension: u32, name: Option<DbString>, hnsw_config: Option<HnswIndexConfig>, ) -> GraphResult<()>

Register a built-in node vector index with optional HNSW construction config.

Source

pub fn create_vector_index_named_with_configs( &self, label: DbString, property: DbString, kind: VectorIndexKind, dimension: u32, name: Option<DbString>, config: VectorIndexConfig, ) -> GraphResult<()>

Register a built-in node vector index with optional ANN construction config.

Source

pub fn drop_vector_index( &self, label: DbString, property: DbString, ) -> GraphResult<()>

Drop a built-in node vector index.

The operation is idempotent; dropping an absent index succeeds without publishing a new snapshot.

Source

pub fn create_text_index( &self, label: DbString, property: DbString, ) -> GraphResult<()>

Register a built-in node text index for (label, property).

The current node columns are scanned under the write lock and the published snapshot is updated in one transaction.

§Errors

Returns GraphError::TextIndexAlreadyExists if the pair is already registered, or GraphError::Inconsistent if index construction observes corrupt graph columns.

Source

pub fn create_text_index_named( &self, label: DbString, property: DbString, name: Option<DbString>, ) -> GraphResult<()>

Register a built-in node text index with optional catalog name.

Source

pub fn drop_text_index( &self, label: DbString, property: DbString, ) -> GraphResult<()>

Drop a built-in node text index.

The operation is idempotent; dropping an absent index succeeds without publishing a new snapshot.

Source§

impl SharedGraph

Source

pub fn new(graph_id: GraphId) -> Self

Construct an empty shared graph.

Source

pub fn builder(graph_id: GraphId) -> SharedGraphBuilder

Start building an empty shared graph with optional providers.

Source

pub fn from_graph(graph: SeleneGraph) -> Self

Construct shared state from a pre-built graph snapshot.

The allocator floors are derived from storage length so that stale GraphMeta.next_*_id values cannot allow ID reuse over rows that already exist (recovery hardening — spec 02 §4 forbids ID reuse).

§Panics

Panics if the supplied graph contains more than u32::MAX rows in either store. Selene-graph’s row index is u32 by construction; SeleneGraph::new() always satisfies this, and any caller-built fixture must too. Use SharedGraph::try_from_graph for the fallible variant when validating untrusted snapshots.

Source

pub fn try_from_graph(graph: SeleneGraph) -> GraphResult<Self>

Fallible variant of SharedGraph::from_graph. Returns GraphError::Inconsistent when the graph’s stores exceed the u32 row capacity.

Source

pub fn from_graph_with_providers( graph: SeleneGraph, providers: Vec<Arc<dyn IndexProvider>>, ) -> GraphResult<Self>

Construct shared state from a graph snapshot and fixed provider list.

§Errors

Returns GraphError::Provider when two providers declare the same ProviderTag, and GraphError::Inconsistent when the graph’s stores exceed the u32 row capacity.

Source

pub fn from_graph_with_wal( graph: SeleneGraph, path: impl AsRef<Path>, config: WalConfig, ) -> GraphResult<Self>

Construct shared state from a graph snapshot and commit-critical WAL file.

Since v1.2 (BRIEF 2) the committer is the sole fsync caller, so the WAL is always opened in SyncPolicy::OnFlushOnly regardless of the config.sync_policy passed (it is overwritten before WalWriter::open). This non-builder constructor uses CommitBatching::Off, so the committer still fsyncs once per commit — behaviorally identical to BRIEF 1’s EveryN(1).

§Errors

Returns GraphError::Persist when the WAL cannot be opened, plus the same consistency and provider-registration errors as Self::try_from_graph.

Source

pub fn read(&self) -> Arc<SeleneGraph>

Load the current immutable snapshot without taking the write lock.

Source

pub fn compaction_stats(&self) -> CompactionStats

Return compaction pressure for the current published snapshot.

This is a lock-free read of row counts and liveness counters. It does not compact, rebuild indexes, or take the writer lock.

Source

pub fn compact(&self) -> GraphResult<CompactionReport>

Compact the live graph in place: reclaim every dead / hole row, renumber rows dense, and atomically republish the result so the RAM held by deleted rows is reclaimed immediately (BRIEF-Item-4c — the live-densify half of snapshot-time compaction).

This is pure space reclamation: it changes only the internal row layout, never external NodeId/EdgeId, properties, or labels, so it emits no selene_core::Change and writes no WAL entry. Durability comes from the next snapshot, which encodes the now-dense live graph (the CORE provider reads the same snapshot cell this method publishes into). A crash before that snapshot simply reloads the pre-compaction state and recompacts later — compaction can never lose data.

The dense graph is built under the write lock on the calling thread (seal-and-handover, exactly like a commit), and is allocated a publish seal_seq under that same lock; the single committer then swaps it into the published snapshot cell strictly in seal_seq order. So compaction serializes with writers exactly like a commit and can never be reordered ahead of an earlier-sealed commit (which would let that commit’s stale, non-dense frozen snapshot clobber the dense one). Lock-free readers keep observing the old snapshot until the dense graph is published. The monotonic allocator high-water marks are preserved (the live allocator is untouched, and compact_core carries GraphMeta verbatim — and the allocator is kept in sync with GraphMeta on every commit), so no external id is ever reused after a later recovery.

§Errors

Returns GraphError if the graph’s id↔row mapping is corrupt or the recompacted graph fails its consistency check (see compact_core).

Source

pub fn rebuild_vector_indexes(&self) -> GraphResult<VectorIndexRebuildReport>

Rebuild every registered vector index from primary node values.

HNSW indexes retain stale deleted entries after vector update/delete so in-flight search can still traverse the neighbor graph safely. This maintenance path reclaims those stale entries by rebuilding only the derived vector-index state; it does not change graph data, emit selene_core::Change, write a WAL entry, bump schema epoch, or notify providers. The HNSW graph is derived, not durable: snapshots and recovery persist only vector-index registrations plus primary values, so a reopen rebuilds the index from that authoritative state.

The rebuild is strict on live data: if an indexed row no longer satisfies the registered vector dimension/metric invariant, this method returns an error instead of silently dropping the row from the index.

Rebuild only vector indexes whose diagnostics recommend maintenance.

This is the bounded maintenance variant for IVF drift: it uses each index’s current ivf_rebuild_recommended value to decide whether to rebuild that derived index. Indexes that do not recommend rebuild are left untouched, and a no-op call returns an empty report without publishing a maintenance item.

The rebuild is strict on live data for selected indexes, matching Self::rebuild_vector_indexes.

Source

pub fn maintain_vector_indexes( &self, policy: VectorIndexMaintenancePolicy, ) -> GraphResult<VectorIndexRebuildReport>

Maintain recommended vector indexes under a caller-supplied policy.

This is the explicit orchestration API for amortized vector-index maintenance. It rebuilds only indexes whose diagnostics currently recommend maintenance and applies the policy cap after ordering recommended indexes by pending IVF retrain pressure. It remains a maintenance-tier operation: reads never trigger it, and a no-op call returns an empty report without publishing a derived-state replacement.

The rebuild is strict on live data for selected indexes, matching Self::rebuild_vector_indexes.

Source

pub fn schema_version(&self) -> u64

Return the runtime schema-version epoch used for plan-cache invalidation.

The epoch starts at zero for each SharedGraph instance and advances only after a successful commit whose change set contains selene_core::Change::SchemaChanged.

Source

pub fn graph_type(&self) -> Option<Arc<GraphTypeDef>>

Return the bound graph type, if this is a closed graph.

Source

pub fn is_closed(&self) -> bool

Return true when this graph is bound to a closed graph type.

Source

pub fn index_provider_by_tag( &self, tag: ProviderTag, ) -> Option<Arc<dyn IndexProvider>>

Look up a registered provider by tag.

Source

pub fn index_providers(&self) -> &[Arc<dyn IndexProvider>]

Borrow the fixed provider registry for executor procedure contexts.

Source

pub fn durable_providers(&self) -> &[Arc<dyn DurableProvider>]

Borrow the fixed commit-critical durable provider registry.

Source

pub fn begin_write(&self) -> WriteTxn<'_>

Begin a write transaction by acquiring the single graph write lock.

Concurrent writers from other threads queue normally on the write lock; the engine does not panic legitimate concurrent writes during another commit’s provider fanout.

Since v1.2 (BRIEF 1) the actual snapshot publish happens on the single committer thread, not here: WriteTxn::commit seals under this lock, releases it, and hands the frozen bundle to the committer. Provider fan-out therefore now runs on the committer thread, so the re-entrancy guard below protects the committer thread (sound with exactly one committer — see reentry.rs and the v1.2 design §7.7).

§Panics

Panics when called from inside an IndexProvider callback on the committer thread as the active fanout. Re-entrant writes from a provider callback are unsupported; the committer is publishing, so a nested write would recurse indefinitely. The panic is caught by the committer’s notify_providers boundary; provider state may drift, but the commit still completes.

Cross-thread re-entry — a provider spawning a worker thread that calls begin_write and waiting for it — is documented misuse rather than a detectable footgun (the engine cannot trace causal thread ancestry). See the module docs in reentry.rs and the IndexProvider rustdoc for the contract.

Source§

impl SharedGraph

Source

pub fn write_snapshot( &self, config: SnapshotConfig, ) -> GraphResult<SnapshotFinalizeOutcome>

Write one snapshot containing every registered provider section.

This is the graph-layer facade over SnapshotBuilder. It walks the fixed provider registry, asks each provider to encode every declared subsection, and finalizes the snapshot envelope from config.

Call after the commit whose state should be checkpointed has returned. Callers that need a deterministic checkpoint should avoid concurrent writes while this method is collecting provider sections.

§Errors

Returns crate::GraphError::Provider when a provider cannot encode one of its declared sections, or crate::GraphError::Persist when the snapshot envelope cannot be finalized.

Source§

impl SharedGraph

Source

pub fn build_text_index( &self, label: &DbString, property: &DbString, ) -> GraphResult<TextIndex>

Build a reusable BM25 postings index from the current shared snapshot.

§Errors

Returns GraphError::Inconsistent if index construction observes corrupt graph columns.

Source

pub fn indexed_text_search_nodes( &self, label: &DbString, property: &DbString, query: &str, k: usize, ) -> GraphResult<Vec<TextSearchHit>>

Rank string-valued node properties through a transient postings index.

§Errors

Returns GraphError::Inconsistent if index construction observes corrupt graph columns.

Source§

impl SharedGraph

Source

pub fn exact_text_search_nodes( &self, label: &DbString, property: &DbString, query: &str, k: usize, ) -> GraphResult<Vec<TextSearchHit>>

Exhaustively rank string-valued node properties in the current snapshot.

Source

pub fn exact_text_search_nodes_checked( &self, label: &DbString, property: &DbString, query: &str, k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<TextSearchHit>, TextSearchError>

Exhaustively rank string-valued node properties with cancellation checks.

Source§

impl SharedGraph

Source

pub fn exact_vector_search_nodes( &self, label: &DbString, property: &DbString, query: &VectorValue, metric: VectorMetric, k: usize, ) -> GraphResult<Vec<VectorNodeSearchHit>>

Exhaustively rank vector-valued node properties in the current snapshot.

This loads one immutable snapshot and delegates to crate::SeleneGraph::exact_vector_search_nodes, so the result is lock-free with respect to concurrent writers once the snapshot pointer is read.

Source

pub fn exact_vector_search_nodes_checked( &self, label: &DbString, property: &DbString, query: &VectorValue, metric: VectorMetric, k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<VectorNodeSearchHit>, VectorSearchError>

Exhaustively rank vector-valued node properties with cancellation checks.

This loads one immutable snapshot and delegates to crate::SeleneGraph::exact_vector_search_nodes_checked.

Source

pub fn exact_vector_search_nodes_batch_checked( &self, label: &DbString, property: &DbString, queries: &[VectorValue], metric: VectorMetric, k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<Vec<VectorNodeSearchHit>>, VectorSearchError>

Lock-free read snapshot wrapper for exact vector batch search.

Source

pub fn approximate_vector_search_nodes_checked( &self, label: &DbString, property: &DbString, query: &VectorValue, options: ApproximateVectorSearchOptions, checker: CancellationChecker<'_>, ) -> Result<Vec<VectorNodeSearchHit>, VectorSearchError>

Approximately rank vector-valued node properties through an ANN index.

This loads one immutable snapshot and delegates to crate::SeleneGraph::approximate_vector_search_nodes_checked.

Source

pub fn approximate_vector_search_nodes_batch_checked( &self, label: &DbString, property: &DbString, queries: &[VectorValue], options: ApproximateVectorSearchOptions, checker: CancellationChecker<'_>, ) -> Result<Vec<Vec<VectorNodeSearchHit>>, VectorSearchError>

Lock-free read snapshot wrapper for approximate vector batch search.

Source

pub fn approximate_vector_search_candidate_set_checked( &self, label: &DbString, property: &DbString, query: &VectorValue, candidates: &VectorCandidateSet, options: ApproximateVectorSearchOptions, checker: CancellationChecker<'_>, ) -> Result<Vec<VectorNodeSearchHit>, VectorSearchError>

Lock-free read snapshot wrapper for approximate search within candidates.

Source

pub fn approximate_vector_search_candidate_sets_batch_checked( &self, label: &DbString, property: &DbString, queries: &[VectorValue], candidate_sets: &[VectorCandidateSet], options: ApproximateVectorSearchOptions, checker: CancellationChecker<'_>, ) -> Result<Vec<Vec<VectorNodeSearchHit>>, VectorSearchError>

Lock-free read snapshot wrapper for approximate batch search within candidates.

Source

pub fn approximate_vector_search_expanded_candidates_checked( &self, label: &DbString, property: &DbString, query: &VectorValue, options: ApproximateVectorExpansionOptions<'_>, checker: CancellationChecker<'_>, ) -> Result<Vec<VectorNodeSearchHit>, VectorSearchError>

Lock-free read snapshot wrapper for ANN-root graph expansion.

Source

pub fn approximate_vector_search_expanded_candidates_batch_checked( &self, label: &DbString, property: &DbString, queries: &[VectorValue], options: ApproximateVectorExpansionOptions<'_>, checker: CancellationChecker<'_>, ) -> Result<Vec<Vec<VectorNodeSearchHit>>, VectorSearchError>

Lock-free read snapshot wrapper for batched ANN-root graph expansion.

Source§

impl SharedGraph

Source

pub fn score_vector_nodes( &self, property: &DbString, query: &VectorValue, candidates: &[NodeId], metric: VectorMetric, k: usize, ) -> GraphResult<Vec<VectorNodeSearchHit>>

Score explicit node candidates in the current snapshot.

This loads one immutable snapshot and delegates to crate::SeleneGraph::score_vector_nodes.

Source

pub fn score_vector_nodes_checked( &self, property: &DbString, query: &VectorValue, candidates: &[NodeId], metric: VectorMetric, k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<VectorNodeSearchHit>, VectorSearchError>

Lock-free read snapshot wrapper for crate::SeleneGraph::score_vector_nodes_checked.

Source

pub fn score_vector_nodes_batch<C>( &self, property: &DbString, queries: &[VectorValue], candidate_sets: &[C], metric: VectorMetric, k: usize, ) -> GraphResult<Vec<Vec<VectorNodeSearchHit>>>
where C: AsRef<[NodeId]>,

Score one explicit node candidate set per query in the current snapshot.

This loads one immutable snapshot and delegates to crate::SeleneGraph::score_vector_nodes_batch.

Source

pub fn score_vector_nodes_batch_checked<C>( &self, property: &DbString, queries: &[VectorValue], candidate_sets: &[C], metric: VectorMetric, k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<Vec<VectorNodeSearchHit>>, VectorSearchError>
where C: AsRef<[NodeId]>,

Lock-free read snapshot wrapper for crate::SeleneGraph::score_vector_nodes_batch_checked.

Source

pub fn score_vector_candidate_set( &self, property: &DbString, query: &VectorValue, candidates: &VectorCandidateSet, metric: VectorMetric, k: usize, ) -> GraphResult<Vec<VectorNodeSearchHit>>

Score one canonical candidate set against one query in the current snapshot.

This loads one immutable snapshot and delegates to crate::SeleneGraph::score_vector_candidate_set.

Source

pub fn score_vector_candidate_set_checked( &self, property: &DbString, query: &VectorValue, candidates: &VectorCandidateSet, metric: VectorMetric, k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<VectorNodeSearchHit>, VectorSearchError>

Lock-free read snapshot wrapper for crate::SeleneGraph::score_vector_candidate_set_checked.

Source

pub fn score_vector_candidate_sets_batch( &self, property: &DbString, queries: &[VectorValue], candidate_sets: &[VectorCandidateSet], metric: VectorMetric, k: usize, ) -> GraphResult<Vec<Vec<VectorNodeSearchHit>>>

Score one canonical candidate set per query in the current snapshot.

This loads one immutable snapshot and delegates to crate::SeleneGraph::score_vector_candidate_sets_batch.

Source

pub fn score_vector_candidate_sets_batch_checked( &self, property: &DbString, queries: &[VectorValue], candidate_sets: &[VectorCandidateSet], metric: VectorMetric, k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<Vec<VectorNodeSearchHit>>, VectorSearchError>

Source

pub fn score_vector_neighbors( &self, property: &DbString, query: &VectorValue, anchor: NodeId, options: VectorNeighborSearchOptions<'_>, ) -> GraphResult<Vec<VectorNodeSearchHit>>

Score vector-valued neighbors reached from one anchor in the current snapshot.

Source

pub fn score_vector_neighbors_checked( &self, property: &DbString, query: &VectorValue, anchor: NodeId, options: VectorNeighborSearchOptions<'_>, checker: CancellationChecker<'_>, ) -> Result<Vec<VectorNodeSearchHit>, VectorSearchError>

Lock-free read snapshot wrapper for crate::SeleneGraph::score_vector_neighbors_checked.

Source

pub fn score_vector_neighbors_batch( &self, property: &DbString, queries: &[VectorValue], anchors: &[NodeId], options: VectorNeighborSearchOptions<'_>, ) -> GraphResult<Vec<Vec<VectorNodeSearchHit>>>

Score one anchor’s vector-valued neighbors for each query in the current snapshot.

Source

pub fn score_vector_neighbors_batch_checked( &self, property: &DbString, queries: &[VectorValue], anchors: &[NodeId], options: VectorNeighborSearchOptions<'_>, checker: CancellationChecker<'_>, ) -> Result<Vec<Vec<VectorNodeSearchHit>>, VectorSearchError>

Lock-free read snapshot wrapper for crate::SeleneGraph::score_vector_neighbors_batch_checked.

Source

pub fn score_vector_expanded_candidate_sets_batch( &self, property: &DbString, queries: &[VectorValue], root_sets: &[VectorCandidateSet], options: VectorNeighborSearchOptions<'_>, ) -> GraphResult<Vec<Vec<VectorNodeSearchHit>>>

Expand one canonical root set per query, then score it in the current snapshot.

This loads one immutable snapshot and delegates to crate::SeleneGraph::score_vector_expanded_candidate_sets_batch.

Source

pub fn score_vector_expanded_candidate_sets_batch_checked( &self, property: &DbString, queries: &[VectorValue], root_sets: &[VectorCandidateSet], options: VectorNeighborSearchOptions<'_>, checker: CancellationChecker<'_>, ) -> Result<Vec<Vec<VectorNodeSearchHit>>, VectorSearchError>

Source

pub fn vector_neighbor_candidates( &self, anchor: NodeId, edge_label: &DbString, direction: VectorNeighborDirection, ) -> VectorCandidateSet

Return canonical vector-score candidates reached from one graph anchor in the current snapshot.

Source

pub fn expand_vector_candidate_set( &self, roots: &VectorCandidateSet, edge_label: &DbString, direction: VectorNeighborDirection, ) -> VectorCandidateSet

Expand canonical candidates through one labeled graph hop in the current snapshot.

Source

pub fn expand_vector_candidate_set_checked( &self, roots: &VectorCandidateSet, edge_label: &DbString, direction: VectorNeighborDirection, checker: CancellationChecker<'_>, ) -> Result<VectorCandidateSet, VectorSearchError>

Lock-free read snapshot wrapper for crate::SeleneGraph::expand_vector_candidate_set_checked.

Source

pub fn expand_vector_candidate_sets_batch_checked( &self, root_sets: &[VectorCandidateSet], edge_label: &DbString, direction: VectorNeighborDirection, k: usize, checker: CancellationChecker<'_>, ) -> Result<Vec<VectorCandidateSet>, VectorSearchError>

Expand one canonical root set per query through one graph hop in the current snapshot.

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more