Skip to content

Commit

Permalink
Merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
tjgreen42 committed Mar 11, 2025
2 parents 154925e + 0763824 commit 2621b73
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pgvectorscale/pgvectorscale_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn impl_readable_macro(ast: &syn::DeriveInput) -> TokenStream {
Self { _rb: rb }
}

pub fn get_archived_node(&self) -> & #archived_name {
pub fn get_archived_node(&self) -> &'a #archived_name {
// checking the code here is expensive during build, so skip it.
// TODO: should we check the data during queries?
//rkyv::check_archived_root::<Node>(self._rb.get_data_slice()).unwrap()
Expand Down Expand Up @@ -73,7 +73,7 @@ fn impl_writeable_macro(ast: &syn::DeriveInput) -> TokenStream {
}

impl<'a> #writeable_name<'a> {
pub fn get_archived_node(&mut self) -> std::pin::Pin<&mut #archived_name> {
pub fn get_archived_node(&mut self) -> std::pin::Pin<&'a mut #archived_name> {
#archived_name::with_data(self.wb.get_data_slice())
}

Expand Down
2 changes: 1 addition & 1 deletion pgvectorscale/src/access_method/distance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn distance_type_l2() -> i16 {
DistanceType::L2 as i16
}

#[pg_extern(immutable, parallel_safe)]
#[pg_extern(immutable, parallel_safe, create_or_replace)]
pub fn distance_type_inner_product() -> i16 {
DistanceType::InnerProduct as i16
}
Expand Down
2 changes: 1 addition & 1 deletion pgvectorscale/src/access_method/sbq_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use super::{
storage::ArchivedData,
};

/// A node in the SBQ index. Currently just plain nodes, soon to feature labeled ones.
/// A node in the SBQ index
pub enum SbqNode {
Classic(ClassicSbqNode),
Labeled(LabeledSbqNode),
Expand Down
1 change: 0 additions & 1 deletion pgvectorscale/src/access_method/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ pub trait NodeDistanceMeasure {
stats: &mut S,
) -> f32;
}

pub trait ArchivedData {
fn is_deleted(&self) -> bool;
fn get_heap_item_pointer(&self) -> HeapPointer;
Expand Down
6 changes: 3 additions & 3 deletions pgvectorscale/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub struct ReadableBuffer<'a> {
}

impl<'a> ReadableBuffer<'a> {
pub fn get_data_slice(&self) -> &[u8] {
pub fn get_data_slice(&self) -> &'a [u8] {
unsafe { std::slice::from_raw_parts(self.ptr, self.len) }
}

Expand All @@ -95,8 +95,8 @@ pub struct WritableBuffer<'a> {
ptr: *mut u8,
}

impl WritableBuffer<'_> {
pub fn get_data_slice(&mut self) -> &mut [u8] {
impl<'a> WritableBuffer<'a> {
pub fn get_data_slice(&mut self) -> &'a mut [u8] {
unsafe { std::slice::from_raw_parts_mut(self.ptr, self.len) }
}

Expand Down

0 comments on commit 2621b73

Please sign in to comment.