1#![allow(clippy::cast_precision_loss)]
10#![allow(clippy::significant_drop_tightening)]
13#![allow(clippy::manual_let_else)]
15#![allow(clippy::match_same_arms)]
17#![allow(clippy::or_fun_call)]
19#![allow(clippy::unused_self)]
21
22pub mod bulkhead;
23pub mod context_template;
24pub mod graph;
25#[cfg(feature = "group-scope")]
26pub mod group;
27pub mod index;
28pub mod migrations;
29pub mod persistence;
30pub mod prompt;
31pub mod resilience;
32pub mod traits;
33pub mod vector;
34
35pub use bulkhead::{
36 BulkheadIndexBackend, BulkheadPersistenceBackend, BulkheadVectorBackend, StorageBulkheadConfig,
37};
38pub use context_template::{
39 ContextTemplateBackendType, ContextTemplateDbStats, ContextTemplateStorage,
40 ContextTemplateStorageFactory, SqliteContextTemplateStorage,
41};
42pub use index::get_user_data_dir;
43pub use prompt::{
44 FilesystemPromptStorage, PostgresPromptStorage, PromptBackendType, PromptStorage,
45 PromptStorageFactory, RedisPromptStorage, SqlitePromptStorage,
46};
47pub use resilience::{
48 ResilientIndexBackend, ResilientPersistenceBackend, ResilientVectorBackend,
49 StorageResilienceConfig, is_retryable_storage_error, retry_connection,
50};
51pub use traits::{IndexBackend, PersistenceBackend, VectorBackend};
52
53#[cfg(feature = "group-scope")]
55pub use group::{GroupBackend, GroupBackendType, GroupStorageFactory, SqliteGroupBackend};
56
57pub struct CompositeStorage<P, I, V>
59where
60 P: PersistenceBackend,
61 I: IndexBackend,
62 V: VectorBackend,
63{
64 persistence: P,
65 index: I,
66 vector: V,
67}
68
69impl<P, I, V> CompositeStorage<P, I, V>
70where
71 P: PersistenceBackend,
72 I: IndexBackend,
73 V: VectorBackend,
74{
75 pub const fn new(persistence: P, index: I, vector: V) -> Self {
77 Self {
78 persistence,
79 index,
80 vector,
81 }
82 }
83
84 pub const fn persistence(&self) -> &P {
86 &self.persistence
87 }
88
89 pub const fn index(&self) -> &I {
91 &self.index
92 }
93
94 pub const fn vector(&self) -> &V {
96 &self.vector
97 }
98}