Skip to main content

FileStore

Struct FileStore 

Source
pub struct FileStore { /* private fields */ }
Expand description

File-per-sample durability store rooted at a directory.

Implementations§

Source§

impl FileStore

Source

pub fn open<P: Into<PathBuf>>( root: P, default_contract: Contract, ) -> Result<Self>

Opens (creating if absent) a file store at root, with default_contract for topics that have no explicit contract.

§Errors

Filesystem error creating the root directory.

Trait Implementations§

Source§

impl DurabilityStore for FileStore

Source§

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 more
Source§

fn set_topic_meta(&self, topic: &str, meta: TopicMeta) -> Result<()>

Persists what the durability service (or any other caller) needs to resume serving topic after a restart, with no writer or reader re-discovered first: its type name, keyedness, and the retention contract in force (see TopicMeta). Called once, when a topic is first served. Also becomes the contract store/cleanup enforce for topic (superseding a plain set_contract for the same topic — see its doc). Read more
Source§

fn topic_meta(&self, topic: &str) -> Result<Option<TopicMeta>>

The persisted TopicMeta for topic, if set_topic_meta was ever called for it. None for a topic that only ever saw set_contract (contract-only, no served type/keyedness known) or was never registered at all. Read more
Source§

fn store(&self, sample: DurabilitySample) -> Result<()>

Persists sample durably, enforcing the topic contract. Returns StoreError::OutOfResources when a KEEP_ALL cap is hit. Read more
Source§

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 more
Source§

fn unregister( &self, topic: &str, instance_key: &[u8; 16], now: SystemTime, ) -> Result<()>

Marks an instance as unregistered at now; its samples become eligible for purge after now + cleanup_delay (applied by cleanup). Read more
Source§

fn cleanup(&self, now: SystemTime) -> Result<usize>

Purges instances whose unregister time + cleanup-delay is <= now. Returns the number of purged instances. Read more
Source§

fn stats(&self, topic: &str) -> Result<StoreStats>

Aggregate counters for topic. Read more
Source§

fn replay_for_topic( &self, topic: &str, ) -> Result<Vec<DurabilitySample>, StoreError>

Convenience: drains the full contracted history for topic by paging through query. Prefer paged query for large contracts; this materializes everything into a Vec. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.