hermes_core/segment/builder/
config.rs1use std::path::PathBuf;
4
5use crate::compression::CompressionLevel;
6
7#[derive(Debug, Clone, Default)]
9pub struct SegmentBuilderStats {
10 pub num_docs: u32,
12 pub unique_terms: usize,
14 pub postings_in_memory: usize,
16 pub interned_strings: usize,
18 pub doc_field_lengths_size: usize,
20 pub estimated_memory_bytes: usize,
22 pub memory_breakdown: MemoryBreakdown,
24 pub unhinted_dynamic_docs: u64,
28}
29
30#[derive(Debug, Clone, Default)]
32pub struct MemoryBreakdown {
33 pub postings_bytes: usize,
35 pub index_overhead_bytes: usize,
37 pub interner_bytes: usize,
39 pub field_lengths_bytes: usize,
41 pub dense_vectors_bytes: usize,
43 pub dense_vector_count: usize,
45 pub sparse_vectors_bytes: usize,
47 pub position_index_bytes: usize,
49}
50
51#[derive(Clone)]
53pub struct SegmentBuilderConfig {
54 pub temp_dir: PathBuf,
56 pub compression_level: CompressionLevel,
58 pub num_compression_threads: usize,
61 pub interner_capacity: usize,
63 pub posting_map_capacity: usize,
65 pub optimization: crate::structures::IndexOptimization,
68 pub posting_codec: crate::structures::PostingCodec,
70}
71
72impl Default for SegmentBuilderConfig {
73 fn default() -> Self {
74 Self {
75 #[cfg(feature = "native")]
76 temp_dir: std::env::temp_dir(),
77 #[cfg(not(feature = "native"))]
78 temp_dir: PathBuf::from("/tmp"),
79 compression_level: CompressionLevel(3),
80 #[cfg(feature = "native")]
81 num_compression_threads: crate::default_compression_threads(),
82 #[cfg(not(feature = "native"))]
83 num_compression_threads: 1,
84 interner_capacity: 1_000_000,
85 posting_map_capacity: 500_000,
86 optimization: crate::structures::IndexOptimization::default(),
87 posting_codec: crate::structures::PostingCodec::default(),
88 }
89 }
90}