pub struct ImageHeader {Show 18 fields
pub kind: u8,
pub bits: u8,
pub metric: u8,
pub dim: u32,
pub partitions: u32,
pub seed: u64,
pub members: u64,
pub slots: u32,
pub posting: u32,
pub probe: u32,
pub rerank: u32,
pub sweep: u32,
pub widen: u32,
pub spill: u32,
pub slack: f32,
pub patience: u32,
pub centroids: Chain,
pub keys: Chain,
}Expand description
The root of an image: everything the index is, apart from the members.
The two chains here and the partition table after it are addresses into the log, so this is small whatever the collection’s size: a few dozen bytes plus sixteen per partition.
Fields§
§kind: u8Which index this is an image of. See image_kind.
bits: u8How wide one coordinate is written in a code, which is 1 or 4.
metric: u8What nearness means here. See metric.
dim: u32How many coordinates a vector has.
partitions: u32How many partitions the index has grown to.
seed: u64What the rotation was built from. Without it the codes are noise.
members: u64How many vectors the collection held, for a check after loading.
slots: u32How many slots the vector table had, which is the largest id plus one.
An id is a slot rather than a name, and a collection that has had members removed has holes in it, so the count of live members does not say how far the ids go. Writing it down means a loader allocates the table once and can refuse an id that is past the end of it before it is used to index anything.
posting: u32The size a partition wants.
probe: u32How many partitions a search scans.
rerank: u32How many candidates are reranked per answer.
sweep: u32How many neighbours a split sweeps.
widen: u32How much further a filtered search looks.
spill: u32How many partitions one vector may be written into.
Part of the image rather than left to whatever the loader happens to be tuned to, because it says how the collection was built. A collection built with boundary copies and reopened without them keeps the copies it has and stops making new ones, which is a recall curve that changes under the caller for a reason nothing reports.
slack: f32How much further than the nearest centroid a copy is still made, as a fraction.
patience: u32How many partitions in a row may add nothing before a search stops.
centroids: ChainWhere the centroids are, and how many bytes of them there are.
keys: ChainWhere the key table is, and how long it is.
Implementations§
Source§impl ImageHeader
impl ImageHeader
Sourcepub fn encode(&self, into: &mut [u8]) -> Result<usize>
pub fn encode(&self, into: &mut [u8]) -> Result<usize>
Writes the header into the first IMAGE_HEADER_LEN bytes of into.
§Errors
Code::Invalid if into is shorter than a whole root, header and
partition table both, because a header written into a buffer that cannot
hold the table it describes is a root nobody can read.
Sourcepub fn decode(bytes: &[u8]) -> Result<ImageHeader>
pub fn decode(bytes: &[u8]) -> Result<ImageHeader>
Reads a header back and checks that the bytes behind it are a whole partition table.
§Errors
Code::Corrupt if the tag is wrong, if a reserved field is set, if the
dimension or the code width is not one this version writes, or if the
buffer is not as long as the partition count says it is.
Trait Implementations§
Source§impl Clone for ImageHeader
impl Clone for ImageHeader
Source§fn clone(&self) -> ImageHeader
fn clone(&self) -> ImageHeader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more