-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_storage_with_dict.rs
More file actions
32 lines (27 loc) · 1.16 KB
/
test_storage_with_dict.rs
File metadata and controls
32 lines (27 loc) · 1.16 KB
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
use janus::storage::segmented_storage::StreamingSegmentedStorage;
use janus::storage::util::StreamingConfig;
fn main() {
let config = StreamingConfig {
segment_base_path: "./data/test_storage".to_string(),
max_batch_bytes: 10485760,
max_batch_age_seconds: 5,
max_batch_events: 100_000,
sparse_interval: 1000,
entries_per_index_block: 1024,
};
let storage = StreamingSegmentedStorage::new(config).expect("Failed to load storage");
let events = storage.query(0, u64::MAX).expect("Query failed");
println!("Total events in storage: {}", events.len());
if !events.is_empty() {
let dict = storage.get_dictionary().read().unwrap();
println!("\nDecoded first 5 events:");
for (i, e) in events.iter().take(5).enumerate() {
println!("\nEvent {}:", i + 1);
println!(" timestamp: {}", e.timestamp);
println!(" subject: {:?}", dict.decode(e.subject));
println!(" predicate: {:?}", dict.decode(e.predicate));
println!(" object: {:?}", dict.decode(e.object));
println!(" graph: {:?}", dict.decode(e.graph));
}
}
}