1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Storage layer with compression and persistence
//!
//! This module provides efficient storage capabilities for the Foxstash system,
//! including multiple compression codecs and persistence mechanisms.
//!
//! # Storage Types
//!
//! - [`FileStorage`]: Simple file-based persistence with compression
//! - [`IncrementalStorage`]: WAL-based incremental persistence for efficient updates
//!
//! # Incremental Storage
//!
//! For large indexes with frequent updates, use `IncrementalStorage` to avoid
//! rewriting the entire index on each change:
//!
//! ```no_run
//! use foxstash_core::storage::incremental::{IncrementalStorage, IncrementalConfig, IndexMetadata};
//! use foxstash_core::Document;
//!
//! fn main() -> Result<(), foxstash_core::RagError> {
//! let config = IncrementalConfig::default()
//! .with_checkpoint_threshold(10_000);
//!
//! let mut storage = IncrementalStorage::new("/tmp/index", config)?;
//!
//! // Log changes to WAL (fast append-only)
//! let document = Document {
//! id: "doc1".into(),
//! content: "Hello".into(),
//! embedding: vec![0.1; 128],
//! metadata: None,
//! };
//! storage.log_add(&document)?;
//!
//! // Periodic checkpoint (full snapshot)
//! let index_data: Vec<String> = vec!["doc1".into()];
//! let metadata = IndexMetadata {
//! document_count: 1,
//! embedding_dim: 128,
//! index_type: "hnsw".into(),
//! };
//! if storage.needs_checkpoint() {
//! storage.checkpoint(&index_data, metadata)?;
//! }
//! Ok(())
//! }
//! ```
pub use ;
pub use FileStorage;
pub use ;