Skip to content

Commit 6f46234

Browse files
committed
traversal: remove dead bfs/ and navigation/ modules, move Distance to dist
- Add pub type Distance = f32 to traversal/dist/adjacency.rs (alongside Neighbor). - Update all 9 HNSW files + coordinator to use traversal::dist::Distance. - Remove traversal::bfs (superseded by expand/ + search/). - Remove traversal::navigation (NavigationEngine/Service/Coordinator/Worker never instantiated; App::to_task() was unimplemented; only Distance was actually used externally). - Remove navigation re-export from traversal/search/mod.rs. - Strip job/mod.rs of navigation-only types (App, Job, JobReport, JobStatus, CollectiveResult, initialize_job_run); keep only JobId and logger. - Delete unused job/service.rs (JobService had no callers). Made-with: Cursor
1 parent 239af78 commit 6f46234

26 files changed

Lines changed: 12 additions & 1671 deletions

src/apps/hnsw/coordinator/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use futures::future::BoxFuture;
1616
use itertools::Itertools;
1717
use neb::{index::vector::HnswConfig, query::data_client::IndexedDataClient, ram::types::RandValue};
1818

19-
use crate::{graph::GraphEngine, job::JobId, traversal::navigation::Distance};
19+
use crate::{graph::GraphEngine, job::JobId, traversal::dist::Distance};
2020

2121
use super::{
2222
measurements::MetricEncoding,

src/apps/hnsw/coordinator/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::apps::hnsw::HNSWPartitionService;
1717
use crate::job::logger::JobLogger;
1818
use crate::server::MorpheusServer;
1919
use crate::tests::start_server;
20-
use crate::traversal::navigation::Distance;
20+
use crate::traversal::dist::Distance;
2121

2222
const CELL_SCHEMA_ID: u32 = hash_ident!("CELL");
2323
const VECTOR: &str = "VECTOR";

src/apps/hnsw/measurements.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::fmt::Debug;
44

55
use super::simd_ops; // Used by metric_distance functions
66

7-
use crate::traversal::navigation::Distance;
7+
use crate::traversal::dist::Distance;
88

99
pub use neb::index::vector::MetricEncoding;
1010

src/apps/hnsw/partition/search.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use crate::{
3232
JobId,
3333
},
3434
job_log_debug, job_log_trace, job_log_verbose,
35-
traversal::navigation::Distance,
35+
traversal::dist::Distance,
3636
utils::ring_buffer::RingBuffer,
3737
};
3838
use log::info;

src/apps/hnsw/partition/service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::{
2121
logger::{append_job_log, JobLogLevel, JobLogger},
2222
JobId,
2323
},
24-
traversal::navigation::Distance,
24+
traversal::dist::Distance,
2525
};
2626
use neb::index::vector::HnswConfig;
2727

src/apps/hnsw/partition/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::job::logger::JobLogger;
1818
use crate::job::JobId;
1919
use crate::server::MorpheusServer;
2020
use crate::tests::start_server;
21-
use crate::traversal::navigation::Distance;
21+
use crate::traversal::dist::Distance;
2222
use dovahkiin::types::Map as DovMap;
2323
use tokio::sync::Semaphore;
2424

src/apps/hnsw/partition/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use neb::ram::cell::ReadError;
1111
use neb::{client::transaction::TxnError, ram::cell::WriteError};
1212

1313
use crate::graph::{edge::EdgeError, NeighbourhoodError};
14-
use crate::traversal::navigation::Distance;
14+
use crate::traversal::dist::Distance;
1515
use crate::utils::ring_buffer::RingBuffer;
1616

1717
/// A fast hasher for Id types that uses XOR of the two u64 fields.

src/apps/hnsw/partition/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::apps::hnsw::partition::types::HNSWIndexError;
22
use crate::graph::partitioner::vector::FromVectorPartitioner;
3-
use crate::traversal::navigation::Distance;
3+
use crate::traversal::dist::Distance;
44
use crate::utils::ring_buffer::RingBuffer;
55
use dovahkiin::types::Id;
66
use neb::ram::cell::OwnedCell;

src/apps/hnsw/recovery_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::apps::hnsw::partition::schema::{
2828
use crate::apps::hnsw::HNSWPartitionService;
2929
use crate::server::MorpheusServer;
3030
use crate::tests::start_server_with_storage_and_recovery;
31-
use crate::traversal::navigation::Distance;
31+
use crate::traversal::dist::Distance;
3232

3333
const CELL_SCHEMA_ID: u32 = hash_ident!("RECOVERY_TEST_CELL");
3434
const VECTOR: &str = "VECTOR";

src/job/mod.rs

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,13 @@
1-
use crate::traversal::navigation::App;
2-
use dovahkiin::types::Id;
3-
use parking_lot::Mutex;
41
use serde::{Deserialize, Serialize};
5-
use std::sync::Arc;
62

73
pub mod logger;
8-
pub mod service;
94

105
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
116
pub struct JobId {
127
pub coordinator_server_id: u64,
138
pub coordinator_job_id: u64,
149
}
1510

16-
#[derive(Debug, Clone, Serialize, Deserialize)]
17-
pub struct JobReport {
18-
pub status: JobStatus,
19-
pub result: Vec<u8>,
20-
}
21-
22-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
23-
pub enum JobStatus {
24-
Created,
25-
Initialized,
26-
Running,
27-
Finished,
28-
Failed,
29-
}
30-
31-
pub struct Job {
32-
pub job_id: JobId,
33-
pub app: App,
34-
pub config: Vec<u8>,
35-
pub report: Arc<Mutex<JobReport>>,
36-
}
37-
38-
pub enum CollectiveResult {
39-
Found(Vec<(Id, u64)>),
40-
Continue(Vec<(Id, u64, f32)>),
41-
Error(Vec<(Id, u64, String)>),
42-
NotFound,
43-
}
44-
45-
impl JobReport {
46-
pub fn new() -> Self {
47-
Self {
48-
status: JobStatus::Created,
49-
result: vec![],
50-
}
51-
}
52-
53-
pub fn update_status(&mut self, status: JobStatus) {
54-
self.status = status;
55-
}
56-
57-
pub fn update_findings(&mut self, findings: Vec<u8>) {
58-
self.result = findings;
59-
}
60-
}
61-
62-
pub fn initialize_job_run(report: &Arc<Mutex<JobReport>>) {
63-
report.lock().update_status(JobStatus::Running);
64-
}
65-
6611
impl JobId {
6712
pub fn new(coordinator_server_id: u64, coordinator_job_id: u64) -> Self {
6813
Self {

0 commit comments

Comments
 (0)