Skip to content

rust server setup (minus cuda implementation)#3

Merged
joshL1215 merged 2 commits into
mainfrom
kishan
May 15, 2026
Merged

rust server setup (minus cuda implementation)#3
joshL1215 merged 2 commits into
mainfrom
kishan

Conversation

@kishangoli

Copy link
Copy Markdown
Collaborator

barebone initialization of rust server, no cuda engine yet. currently using brute force vector search for testing purposes (making sure engine works).

Copilot AI review requested due to automatic review settings May 15, 2026 04:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Barebones Rust/Axum vector search server initialization, with in-memory brute-force search used as a temporary engine before CUDA integration.

Changes:

  • Adds Axum server routes for health, insert, search, and delete.
  • Introduces request/response models, shared app state, and API error helpers.
  • Implements an in-memory FlatIndex using cosine similarity.

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Cargo.toml Defines Rust package and Axum/Tokio/Serde dependencies.
Cargo.lock Locks dependency graph for the new Rust server.
.gitignore Ignores Rust build output and local files.
src/main.rs Wires server startup and HTTP routes.
src/state.rs Adds shared application state for the vector engine.
src/models.rs Adds API request and response structs.
src/engine.rs Adds brute-force in-memory vector index and similarity scoring.
src/api/mod.rs Exposes API modules.
src/api/response.rs Adds API result/error response helpers.
src/api/handlers.rs Implements health, insert, search, and delete handlers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/engine.rs
let mut left_norm = 0.0;
let mut right_norm = 0.0;

for (left_value, right_value) in left.iter().zip(right.iter()) {
Comment thread src/engine.rs
Comment on lines +56 to +58
dot += left_value * right_value;
left_norm += left_value * left_value;
right_norm += right_value * right_value;
Comment thread src/api/handlers.rs
Comment on lines +51 to +59
let engine = state.engine.lock().expect("engine mutex poisoned");

if let Some(expected_dimension) = engine.dimension() {
if request.query.len() != expected_dimension {
return Err(bad_request("query dimension does not match stored vectors"));
}
}

let results = engine.search(request.query, request.k);
Comment thread src/engine.rs
Comment on lines +31 to +41
let mut results: Vec<SearchResult> = self
.vectors
.iter()
.map(|(id, vector)| SearchResult {
id: id.clone(),
score: cosine_similarity(&query, vector),
})
.collect();

results.sort_by(|left, right| right.score.total_cmp(&left.score));
results.truncate(k);
@joshL1215 joshL1215 merged commit 28cc226 into main May 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants