grafos_store/
lib.rs

1//! Universal object storage convention for grafOS.
2//!
3//! This crate provides an [`ObjectStore`] trait and three backends:
4//!
5//! | Backend | Backing | Use case |
6//! |---------|---------|----------|
7//! | [`MemObjectStore`] | FabricHashMap (leased DRAM) | Hot/ephemeral objects |
8//! | [`BlockObjectStore`] | Block storage (leased NVMe/SD) | Durable objects |
9//! | [`TieredObjectStore`] | Mem (hot) + Block (cold) | Auto-tiered with LRU eviction |
10//!
11//! Objects are addressed by [`FabricUri`] (`fabric://pool/bucket/key`).
12//! All writes are CRC32-checksummed; reads verify integrity.
13//!
14//! # Quick start
15//!
16//! ```rust
17//! use grafos_store::{MemObjectStore, ObjectStore, FabricUri};
18//!
19//! # grafos_std::host::reset_mock();
20//! # grafos_std::host::mock_set_fbmu_arena_size(1_048_576);
21//! let mut store = MemObjectStore::new(64)?;
22//! let uri: FabricUri = "fabric://default/mybucket/hello".parse()?;
23//! store.put(&uri, b"world", None)?;
24//! let obj = store.get(&uri)?.unwrap();
25//! assert_eq!(obj.data, b"world");
26//! # Ok::<(), grafos_std::FabricError>(())
27//! ```
28//!
29//! # Feature flags
30//!
31//! | Feature | Default | Effect |
32//! |---------|---------|--------|
33//! | `std` | Yes | Enables `std` in grafos-std |
34//! | `versioning` | No | Enables object versioning (version history on put) |
35//! | `observe` | No | Enables grafos-observe metrics |
36
37#![cfg_attr(not(feature = "std"), no_std)]
38
39extern crate alloc;
40
41mod block_store;
42mod bucket;
43mod bucket_config;
44mod bucket_handle;
45mod bucket_locator;
46mod crc;
47mod mem_store;
48mod meta;
49mod store;
50mod tiered_store;
51mod uri;
52
53#[cfg(feature = "observe")]
54pub mod observe_hooks;
55
56pub use block_store::BlockObjectStore;
57pub use bucket::BucketManager;
58pub use bucket_config::{BucketConfig, BucketTier};
59pub use bucket_handle::BucketHandle;
60pub use bucket_locator::BucketLocator;
61pub use mem_store::MemObjectStore;
62#[cfg(feature = "versioning")]
63pub use meta::VersionInfo;
64pub use meta::{ObjectInfo, ObjectMeta, PutOptions};
65pub use store::{ObjectData, ObjectStore};
66pub use tiered_store::TieredObjectStore;
67pub use uri::FabricUri;