Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
209 changes: 208 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,21 @@ log = "0.4.14"
fs2 = "0.4.0"
env_logger = "0.11.3"
serde_json = "1.0.68"
ahash = "0.8.11"
rand = "0.8.4"
rusqlite = "0.31.0"
chrono = "0.4"
brotli = "6.0.0"

[profile.release]
opt-level = 3

[profile.bench]
opt-level = 3

# [profile.dev]
# debug = true

# [[bench]]
# name = "hamming_distance"
# harness = false
Expand Down
9 changes: 8 additions & 1 deletion src/constants.rs
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
pub const VECTOR_SIZE: usize = 1024;
pub const QUANTIZED_VECTOR_SIZE: usize = VECTOR_SIZE / 8;
pub const QUANTIZED_VECTOR_SIZE: usize = 128;
pub const K: usize = 512;
pub const C: usize = 1;
pub const ALPHA: usize = 64;
pub const BETA: usize = 3;
pub const GAMMA: usize = 1;
pub const RHO: usize = 1;
pub const B: usize = 512;
27 changes: 27 additions & 0 deletions src/errors.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use std::error::Error;
use std::fmt;

#[derive(Debug)]
pub struct HaystackError {
details: String,
}

impl HaystackError {
pub fn new(msg: &str) -> HaystackError {
HaystackError {
details: msg.to_string(),
}
}
}

impl fmt::Display for HaystackError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.details)
}
}

impl Error for HaystackError {
fn description(&self) -> &str {
&self.details
}
}
1 change: 1 addition & 0 deletions src/lib.rs
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod constants;
pub mod errors;
pub mod math;
pub mod services;
pub mod structures;
Expand Down
Loading