Skip to content

Commit

Permalink
refactor: rework vector abstraction
Browse files Browse the repository at this point in the history
Signed-off-by: usamoi <usamoi@outlook.com>
  • Loading branch information
usamoi committed Feb 21, 2024
1 parent 5889b5d commit 19172b7
Show file tree
Hide file tree
Showing 116 changed files with 4,180 additions and 4,076 deletions.
3 changes: 0 additions & 3 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[build]
rustdocflags = ["--document-private-items"]

[target.'cfg(target_os="macos")']
# Postgres symbols won't be available until runtime
rustflags = ["-Clink-arg=-Wl,-undefined,dynamic_lookup"]
75 changes: 27 additions & 48 deletions Cargo.lock

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

13 changes: 9 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ edition.workspace = true
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_vectors"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg15"]
pg14 = ["pgrx/pg14", "pgrx-tests/pg14"]
Expand All @@ -18,7 +22,6 @@ arrayvec.workspace = true
bincode.workspace = true
bytemuck.workspace = true
byteorder.workspace = true
half.workspace = true
libc.workspace = true
log.workspace = true
memmap2.workspace = true
Expand Down Expand Up @@ -50,9 +53,6 @@ pgrx = { git = "https://github.com/tensorchord/pgrx.git", branch = "v0.11.3-patc
pgrx-tests = { git = "https://github.com/tensorchord/pgrx.git", branch = "v0.11.3-patch" }

[lints]
clippy.needless_range_loop = "allow"
clippy.len_zero = "allow"
clippy.too_many_arguments = "allow"
rust.unsafe_op_in_unsafe_fn = "deny"
rust.unused_lifetimes = "warn"
rust.unused_qualifications = "warn"
Expand Down Expand Up @@ -90,6 +90,11 @@ thiserror = "~1.0"
uuid = { version = "1.7.0", features = ["v4", "serde"] }
validator = { version = "~0.16", features = ["derive"] }

[workspace.lints]
rust.unsafe_op_in_unsafe_fn = "forbid"
rust.unused_lifetimes = "warn"
rust.unused_qualifications = "warn"

[profile.dev]
panic = "unwind"

Expand Down
21 changes: 1 addition & 20 deletions crates/base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,18 @@ version.workspace = true
edition.workspace = true

[dependencies]
bincode.workspace = true
bytemuck.workspace = true
byteorder.workspace = true
half.workspace = true
libc.workspace = true
log.workspace = true
memmap2.workspace = true
num-traits.workspace = true
rand.workspace = true
rustix.workspace = true
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
uuid.workspace = true
validator.workspace = true
c = { path = "../c" }
detect = { path = "../detect" }
crc32fast = "1.4.0"
crossbeam = "0.8.4"
dashmap = "5.5.3"
parking_lot = "0.12.1"
rayon = "1.8.1"
arc-swap = "1.6.0"
multiversion = "0.7.3"

[lints]
clippy.derivable_impls = "allow"
clippy.len_without_is_empty = "allow"
clippy.needless_range_loop = "allow"
clippy.too_many_arguments = "allow"
rust.internal_features = "allow"
rust.unsafe_op_in_unsafe_fn = "forbid"
rust.unused_lifetimes = "warn"
rust.unused_qualifications = "warn"
workspace = true
9 changes: 9 additions & 0 deletions crates/base/src/distance.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use serde::{Deserialize, Serialize};

#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
pub enum DistanceKind {
L2,
Cos,
Dot,
}
Loading

0 comments on commit 19172b7

Please sign in to comment.