1use log::info;
7
8use super::storage::HTTStorage;
9use super::config::HTTStorageConfig;
10use super::tree_tensor::{SharedHTT, HyperbolicTreeTensor, IntegrationResult};
11
12pub fn initialize_htt_storage(config: HTTStorageConfig) -> IntegrationResult<HTTStorage> {
14 info!("Initializing HTT storage components");
15
16 let storage = HTTStorage::new(config);
17
18 info!("HTT storage components initialized");
19 Ok(storage)
20}
21
22pub fn with_htt<R, F>(
27 htt: &SharedHTT,
28 f: F,
29) -> IntegrationResult<R>
30where
31 F: FnOnce(&HyperbolicTreeTensor) -> IntegrationResult<R>,
32{
33 f(htt)
34}
35
36#[cfg(test)]
37mod tests {
38 use super::*;
39
40 #[test]
41 fn test_htt_initialization() {
42 let config = HTTStorageConfig::default();
43 let result = initialize_htt_storage(config);
44 assert!(result.is_ok());
45
46 let storage = result.unwrap();
47 assert!(storage.exists("/"));
48 }
49
50 #[test]
51 fn test_htt_with_custom_config() {
52 let config = HTTStorageConfig::new(
53 8,
54 2000,
55 200,
56 None,
57 120,
58 false,
59 );
60 let result = initialize_htt_storage(config);
61 assert!(result.is_ok());
62 }
63}