pub struct CreateIndexParams {
pub directory_path: PathBuf,
pub vector_size: usize,
pub shard_size: usize,
pub batch_write_interval_ms: u64,
pub wal_segment_size: usize,
pub bloom_filter_size: usize,
pub default_slop_factor: u32,
}Expand description
Parameters for creating a new Shardex index
This struct contains all the configuration parameters needed to create
a new index, derived from the ShardexConfig structure but focused
specifically on the creation operation.
Fields§
§directory_path: PathBufDirectory path where the index will be stored
vector_size: usizeSize of embedding vectors in dimensions
shard_size: usizeMaximum number of entries per shard
batch_write_interval_ms: u64Interval between batch writes in milliseconds
wal_segment_size: usizeSize of each WAL segment in bytes
bloom_filter_size: usizeSize of bloom filters in bits
default_slop_factor: u32Default slop factor for search operations
Implementations§
Source§impl CreateIndexParams
impl CreateIndexParams
Sourcepub fn builder() -> CreateIndexParamsBuilder
pub fn builder() -> CreateIndexParamsBuilder
Create a new parameter builder
Sourcepub fn high_performance(directory: PathBuf) -> Self
pub fn high_performance(directory: PathBuf) -> Self
Create high-performance configuration parameters
Creates a configuration optimized for high throughput and performance with larger vectors and shard sizes suitable for production workloads.
§Arguments
directory- Directory path where the index will be stored
§Example
use shardex::api::parameters::CreateIndexParams;
use std::path::PathBuf;
let params = CreateIndexParams::high_performance(PathBuf::from("./high_perf_index"));
assert_eq!(params.vector_size, 256);
assert_eq!(params.shard_size, 15000);Sourcepub fn memory_optimized(directory: PathBuf) -> Self
pub fn memory_optimized(directory: PathBuf) -> Self
Create memory-optimized configuration parameters
Creates a configuration optimized for memory usage with smaller vectors and shard sizes suitable for resource-constrained environments.
§Arguments
directory- Directory path where the index will be stored
§Example
use shardex::api::parameters::CreateIndexParams;
use std::path::PathBuf;
let params = CreateIndexParams::memory_optimized(PathBuf::from("./memory_opt_index"));
assert_eq!(params.vector_size, 128);
assert_eq!(params.shard_size, 5000);Sourcepub fn from_shardex_config(config: ShardexConfig) -> Self
pub fn from_shardex_config(config: ShardexConfig) -> Self
Create parameters from a ShardexConfig
Converts a ShardexConfig into CreateIndexParams, allowing
configurations to be used with the ApiThing pattern.
§Arguments
config- The ShardexConfig to convert
§Example
use shardex::api::parameters::CreateIndexParams;
use shardex::ShardexConfig;
let config = ShardexConfig::new()
.directory_path("./config_index")
.vector_size(512)
.shard_size(25000);
let params = CreateIndexParams::from_shardex_config(config);
assert_eq!(params.vector_size, 512);
assert_eq!(params.shard_size, 25000);Trait Implementations§
Source§impl ApiOperation<ShardexContext, CreateIndexParams> for CreateIndex
impl ApiOperation<ShardexContext, CreateIndexParams> for CreateIndex
Source§type Error = ShardexError
type Error = ShardexError
Source§fn execute(
context: &mut ShardexContext,
parameters: &CreateIndexParams,
) -> Result<Self::Output, Self::Error>
fn execute( context: &mut ShardexContext, parameters: &CreateIndexParams, ) -> Result<Self::Output, Self::Error>
Source§impl Clone for CreateIndexParams
impl Clone for CreateIndexParams
Source§fn clone(&self) -> CreateIndexParams
fn clone(&self) -> CreateIndexParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CreateIndexParams
impl Debug for CreateIndexParams
Source§impl From<ShardexConfig> for CreateIndexParams
impl From<ShardexConfig> for CreateIndexParams
Source§fn from(config: ShardexConfig) -> Self
fn from(config: ShardexConfig) -> Self
Auto Trait Implementations§
impl Freeze for CreateIndexParams
impl RefUnwindSafe for CreateIndexParams
impl Send for CreateIndexParams
impl Sync for CreateIndexParams
impl Unpin for CreateIndexParams
impl UnwindSafe for CreateIndexParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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