Skip to main content

SegmentHeader

Struct SegmentHeader 

Source
#[repr(C)]
pub struct SegmentHeader {
Show 23 fields pub magic: [u8; 8], pub version: u32, pub flags: SegmentFlags, pub n_vec: u32, pub dim: u32, pub bps_block: u16, pub bps_proj: u16, pub rdf_t: u16, pub rdf_stripe_shift: u8, pub num_outliers: u8, pub off_bps: u64, pub off_i8: u64, pub off_scales: u64, pub off_outliers: u64, pub off_tombstone: u64, pub off_rdf_dir: u64, pub off_rdf_data: u64, pub off_dim_weights: u64, pub off_fp32: u64, pub off_bps_qparams: u64, pub file_len: u64, pub _reserved1: [u8; 128], pub _reserved2: [u8; 8],
}
Expand description

Segment header - fixed size at file start

Fields§

§magic: [u8; 8]

Magic bytes: b“SVSEGM\0\0“

§version: u32

Format version

§flags: SegmentFlags

Feature flags

§n_vec: u32

Number of vectors in segment

§dim: u32

Vector dimension

§bps_block: u16

BPS block size (e.g., 16)

§bps_proj: u16

BPS projections per block (1 or 2)

§rdf_t: u16

RDF top-t dimensions per vector

§rdf_stripe_shift: u8

RDF stripe shift (log2 of stripe size)

§num_outliers: u8

Number of outliers per vector

§off_bps: u64

BPS SoA array

§off_i8: u64

int8 embeddings (blocked SoA)

§off_scales: u64

Quantization scales per block

§off_outliers: u64

Outlier entries

§off_tombstone: u64

Tombstone bitset

§off_rdf_dir: u64

RDF posting list directory

§off_rdf_data: u64

RDF posting list data

§off_dim_weights: u64

Dimension weights for RDF

§off_fp32: u64

Original fp32 vectors (optional, for verification)

§off_bps_qparams: u64

BPS quantization parameters (min, inv_range per slot)

§file_len: u64

Total file length

§_reserved1: [u8; 128]

Padding for alignment (to 256 bytes total) 8 + 4 + 4 + 4 + 4 + 2 + 2 + 2 + 1 + 1 + (10 * 8) + 8 = 120, so we need 136 reserved

§_reserved2: [u8; 8]

Implementations§

Source§

impl SegmentHeader

Source

pub const SIZE: usize

Source

pub fn new(n_vec: u32, dim: u32) -> Self

Create a new header with magic and version

Source

pub fn validate(&self) -> Result<()>

Validate header

Source

pub fn num_bps_blocks(&self) -> u32

Number of BPS blocks

Source

pub fn bps_size(&self) -> usize

Size of BPS data in bytes

Source

pub fn i8_size(&self) -> usize

Size of int8 embedding data in bytes

Source

pub fn stripe_size(&self) -> usize

Stripe size (number of vids per stripe)

Trait Implementations§

Source§

impl Clone for SegmentHeader

Source§

fn clone(&self) -> SegmentHeader

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SegmentHeader

Source§

impl Debug for SegmentHeader

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Pod for SegmentHeader

Source§

impl Zeroable for SegmentHeader

Source§

fn zeroed() -> Self

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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> AnyBitPattern for T
where T: Pod,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> NoUninit for T
where T: Pod,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more