pub struct FileActivityJournal { /* private fields */ }Expand description
File-backed activity journal using NDJSON format.
All entries are appended to a single file. A write mutex ensures line-level atomicity. The entry count is tracked in-memory and incremented on every successful append.
Implementations§
Source§impl FileActivityJournal
impl FileActivityJournal
Sourcepub async fn new(path: PathBuf) -> Result<Self, StoreError>
pub async fn new(path: PathBuf) -> Result<Self, StoreError>
Open (or create) an activity journal at the given file path.
Parent directories are created automatically. The initial entry count is determined by scanning the existing file.
§Errors
Returns a backend error if the directory cannot be created or the file cannot be opened for the first scan.
Trait Implementations§
Source§impl ActivityJournalPort for FileActivityJournal
impl ActivityJournalPort for FileActivityJournal
Source§fn append<'life0, 'async_trait>(
&'life0 self,
entry: ActivityEntry,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn append<'life0, 'async_trait>(
&'life0 self,
entry: ActivityEntry,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Append an entry to the journal.
Source§fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 ActivityQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<ActivityEntry>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 ActivityQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<ActivityEntry>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Query entries within a time window.
Auto Trait Implementations§
impl !Freeze for FileActivityJournal
impl !RefUnwindSafe for FileActivityJournal
impl Send for FileActivityJournal
impl Sync for FileActivityJournal
impl Unpin for FileActivityJournal
impl UnsafeUnpin for FileActivityJournal
impl !UnwindSafe for FileActivityJournal
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