pub struct InMemoryStore { /* private fields */ }Expand description
In-memory, contract-bounded durability store. Thread-safe via a single
mutex. Used directly as the TRANSIENT cold store, and as the hot tier
inside crate::TieredStore.
Implementations§
Source§impl InMemoryStore
impl InMemoryStore
Sourcepub fn with_default_contract(default_contract: Contract) -> Self
pub fn with_default_contract(default_contract: Contract) -> Self
New empty store with the given default contract (used for topics
without an explicit set_contract).
Trait Implementations§
Source§impl Default for InMemoryStore
impl Default for InMemoryStore
Source§fn default() -> InMemoryStore
fn default() -> InMemoryStore
Returns the “default value” for a type. Read more
Source§impl DurabilityStore for InMemoryStore
impl DurabilityStore for InMemoryStore
Source§fn set_contract(&self, topic: &str, contract: Contract) -> Result<()>
fn set_contract(&self, topic: &str, contract: Contract) -> Result<()>
Registers (or replaces) the retention
Contract for topic. The
daemon calls this when it starts serving a topic. Topics without an
explicit contract use the store’s default (Contract::default). Read moreSource§fn store(&self, sample: DurabilitySample) -> Result<()>
fn store(&self, sample: DurabilitySample) -> Result<()>
Persists
sample durably, enforcing the topic contract. Returns
StoreError::OutOfResources when a KEEP_ALL cap
is hit. Read moreSource§fn query(&self, topic: &str, selector: &Selector) -> Result<Page>
fn query(&self, topic: &str, selector: &Selector) -> Result<Page>
Returns one ordered
Page of samples for topic matching selector.
Ordering is (instance_key, sequence). Drive pagination via
Page::next + Selector::after_cursor. Read moreSource§fn unregister(
&self,
topic: &str,
instance_key: &[u8; 16],
now: SystemTime,
) -> Result<()>
fn unregister( &self, topic: &str, instance_key: &[u8; 16], now: SystemTime, ) -> Result<()>
Source§fn cleanup(&self, now: SystemTime) -> Result<usize>
fn cleanup(&self, now: SystemTime) -> Result<usize>
Purges instances whose
unregister time + cleanup-delay is <= now.
Returns the number of purged instances. Read moreSource§fn replay_for_topic(&self, topic: &str) -> Result<Vec<DurabilitySample>>
fn replay_for_topic(&self, topic: &str) -> Result<Vec<DurabilitySample>>
Auto Trait Implementations§
impl !Freeze for InMemoryStore
impl RefUnwindSafe for InMemoryStore
impl Send for InMemoryStore
impl Sync for InMemoryStore
impl Unpin for InMemoryStore
impl UnsafeUnpin for InMemoryStore
impl UnwindSafe for InMemoryStore
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