Skip to main content

hawdb_executor/external/
vector_index.rs

1// Copyright 2026 Nowledge
2// Licensed under the Apache License, Version 2.0.
3
4use super::ExternalReadResourceContract;
5use hawdb_core::{Result, VectorRef};
6use hawdb_storage::NodeId;
7
8pub struct VectorIndexExecutionRequest<'a> {
9    pub index: &'a str,
10    pub embedding: VectorRef<'a>,
11    pub candidate_limit: usize,
12    pub top_k: usize,
13    pub mode: hawdb_core::VectorIndexQueryMode,
14    pub eligible: Option<&'a crate::vector_eligibility::VectorEligibleDomain<'a>>,
15    pub resources: ExternalReadResourceContract<'a>,
16}
17
18#[derive(Debug, Clone, Copy)]
19pub struct VectorIndexExecutionRow {
20    pub node_id: NodeId,
21    pub distance: f64,
22}
23
24/// The implementation keeps candidate payloads attached to their original
25/// admission. Rows expose fixed-size identities without copying retained IDs.
26pub trait VectorIndexExecutionOutput {
27    fn row_count(&self) -> usize;
28    fn row(&self, ordinal: usize) -> Result<VectorIndexExecutionRow>;
29}