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 resources: ExternalReadResourceContract<'a>,
14}
15
16#[derive(Debug, Clone, Copy)]
17pub struct VectorIndexExecutionRow {
18    pub node_id: NodeId,
19    pub distance: f64,
20}
21
22/// The implementation keeps candidate payloads attached to their original
23/// admission. Rows expose fixed-size identities without copying retained IDs.
24pub trait VectorIndexExecutionOutput {
25    fn row_count(&self) -> usize;
26    fn row(&self, ordinal: usize) -> Result<VectorIndexExecutionRow>;
27}