Skip to main content

VectorSegment

Struct VectorSegment 

Source
pub struct VectorSegment<'s> { /* private fields */ }
Expand description

The vector sections of one open segment.

Implementations§

Source§

impl<'s> VectorSegment<'s>

Source

pub fn open(segment: &'s Segment) -> Result<Option<Self>, SegmentError>

The segment’s vector sections, or None when it has none. Opening reads every scan row once, to check the values each search relies on.

§Errors

When the segment has only some of them, or they are malformed.

Source

pub fn parts(&self) -> VectorSegmentParts

What this open read and checked, to reopen the same open segment later at no cost.

Source

pub fn reopen(segment: &'s Segment, parts: &VectorSegmentParts) -> Option<Self>

The vector sections of segment as an earlier open of this same open segment found them, without reading or checking anything again. None when parts came from another open segment, even one of the same file.

Source

pub fn segment(&self) -> &'s Segment

Source

pub fn model(&self) -> &ModelIdentity

Source

pub fn dimensions(&self) -> usize

Source

pub fn center(&self) -> &[f32]

The mean vector the segment’s codes are relative to.

Source

pub fn len(&self) -> u32

How many vectors the segment holds.

Source

pub fn is_empty(&self) -> bool

Source

pub fn chunk_map_count(&self) -> u32

How many chunk maps the segment holds.

Source

pub fn section_bytes(&self) -> SectionBytes

Bytes of the segment’s vector sections, for size reports.

Source

pub fn chunk_map_keys(&self) -> Result<Vec<ChunkMapKey>, SegmentError>

The key of every chunk map, in ordinal order.

§Errors

When a read fails.

Source

pub fn texts(&self) -> Result<Vec<TextDigest>, SegmentError>

The text digest of every vector, in ordinal order.

§Errors

When a read fails.

Source

pub fn find(&self, text: TextDigest) -> Result<Option<u32>, SegmentError>

The ordinal of the vector embedded for text, if the segment has it.

§Errors

When a read fails.

Source

pub fn vector(&self, ordinal: u32) -> Result<Vec<f32>, SegmentError>

The stored f32 vector at ordinal, exactly as it was written.

§Errors

When a read fails or a block fails its checksum.

Source

pub fn chunk_map( &self, content: ContentKey, path: &[u8], ) -> Result<Option<Vec<Chunk>>, SegmentError>

The chunk map of the file at path with content, if the segment has one.

§Errors

When a read fails or the map is malformed.

Source

pub fn chunk_map_at(&self, ordinal: u32) -> Result<Vec<Chunk>, SegmentError>

The chunks at ordinal, in the same order as Self::chunk_map_keys.

§Errors

When a read fails, the ordinal is out of range, or the map is malformed.

Source

pub fn chunk_details( &self, content: ContentKey, path: &[u8], ) -> Result<Option<FileDetails>, SegmentError>

The details recorded with the chunk map of the file at path with content: None when the segment has no such map, or the map was added without details.

§Errors

When a read fails, or the details are malformed or do not describe the map’s chunks.

Trait Implementations§

Source§

impl<'s> Debug for VectorSegment<'s>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'s> Forget for VectorSegment<'s>

§

impl<'s> Freeze for VectorSegment<'s>

§

impl<'s> Move for VectorSegment<'s>

§

impl<'s> RefUnwindSafe for VectorSegment<'s>

§

impl<'s> Send for VectorSegment<'s>

§

impl<'s> Sync for VectorSegment<'s>

§

impl<'s> Unpin for VectorSegment<'s>

§

impl<'s> UnsafeUnpin for VectorSegment<'s>

§

impl<'s> UnwindSafe for VectorSegment<'s>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.