pub struct MemObjectStore { /* private fields */ }Expand description
In-memory object store backed by FabricHashMap.
Objects are stored as serialized entries in a hash map over leased DRAM.
Large objects (>64 KiB) are split into 64 KiB chunks, each stored under
a derived key (<uri>#chunk/<n>), with the root entry holding metadata
and the chunk count.
§Example
use grafos_store::{MemObjectStore, ObjectStore, FabricUri};
let mut store = MemObjectStore::new(64)?;
let uri: FabricUri = "fabric://p/b/k".parse()?;
store.put(&uri, b"data", None)?;
let obj = store.get(&uri)?.unwrap();
assert_eq!(obj.data, b"data");Implementations§
Trait Implementations§
Source§impl ObjectStore for MemObjectStore
impl ObjectStore for MemObjectStore
Source§fn put(
&mut self,
uri: &FabricUri,
data: &[u8],
opts: Option<PutOptions>,
) -> Result<()>
fn put( &mut self, uri: &FabricUri, data: &[u8], opts: Option<PutOptions>, ) -> Result<()>
Store an object at the given URI. Read more
Source§fn get(&self, uri: &FabricUri) -> Result<Option<ObjectData>>
fn get(&self, uri: &FabricUri) -> Result<Option<ObjectData>>
Retrieve an object by URI. Read more
Source§fn head(&self, uri: &FabricUri) -> Result<Option<ObjectInfo>>
fn head(&self, uri: &FabricUri) -> Result<Option<ObjectInfo>>
Retrieve object metadata without reading the data.
Auto Trait Implementations§
impl Freeze for MemObjectStore
impl !RefUnwindSafe for MemObjectStore
impl !Send for MemObjectStore
impl !Sync for MemObjectStore
impl Unpin for MemObjectStore
impl !UnwindSafe for MemObjectStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more