pub struct AuditLog { /* private fields */ }Implementations§
Source§impl AuditLog
impl AuditLog
Sourcepub fn open(path: &Path, retention: Duration) -> Result<AuditLog>
pub fn open(path: &Path, retention: Duration) -> Result<AuditLog>
Open (creating and migrating) the log at path.
Sourcepub fn with_clock(self, clock: impl Fn() -> i64 + Send + Sync + 'static) -> Self
pub fn with_clock(self, clock: impl Fn() -> i64 + Send + Sync + 'static) -> Self
Replace the clock (unix milliseconds), for tests of retention.
Sourcepub fn with_history_limits(self, retention: Duration, max_rows: i64) -> Self
pub fn with_history_limits(self, retention: Duration, max_rows: i64) -> Self
Keep history rows for retention, and at most max_rows of them.
pub fn path(&self) -> Option<&Path>
pub fn retention(&self) -> Duration
Sourcepub fn append(&self, n: NewEntry) -> Result<Entry>
pub fn append(&self, n: NewEntry) -> Result<Entry>
Append one row, chained to the newest. Returns it.
Sourcepub fn prune(&self) -> Result<usize>
pub fn prune(&self) -> Result<usize>
Remove rows older than the retention, keeping the chain anchored. The only way rows ever leave.
Sourcepub fn list(&self, q: &Query, vis: &Visibility) -> Result<Vec<Entry>>
pub fn list(&self, q: &Query, vis: &Visibility) -> Result<Vec<Entry>>
Rows matching q that vis may see: newest first, or oldest first
with after (for tailing).
Sourcepub fn generation(&self) -> u64
pub fn generation(&self) -> u64
The current append generation (see Self::wait_change).
Sourcepub fn wait_change(&self, seen: u64, timeout: Duration) -> u64
pub fn wait_change(&self, seen: u64, timeout: Duration) -> u64
Wait up to timeout for this process to append anything after
generation seen; returns the generation now. Other writers (the
CLI) show up at the next poll.
Source§impl AuditLog
impl AuditLog
Sourcepub fn history_append(&self, n: NewRecord) -> Result<Record>
pub fn history_append(&self, n: NewRecord) -> Result<Record>
Append one history row, chained to the newest.
Sourcepub fn history_last_time(&self) -> Result<Option<i64>>
pub fn history_last_time(&self) -> Result<Option<i64>>
The newest history row’s time, if any.
Sourcepub fn history_list(
&self,
q: &HistoryQuery,
vis: &Visibility,
upto: Option<i64>,
from: Option<i64>,
limit: usize,
) -> Result<Vec<Record>>
pub fn history_list( &self, q: &HistoryQuery, vis: &Visibility, upto: Option<i64>, from: Option<i64>, limit: usize, ) -> Result<Vec<Record>>
History rows matching q that vis may see, newest first (or
oldest first with ascending), time <= upto when given.
Sourcepub fn history_after(
&self,
after: i64,
vis: &Visibility,
limit: usize,
) -> Result<Vec<Record>>
pub fn history_after( &self, after: i64, vis: &Visibility, limit: usize, ) -> Result<Vec<Record>>
Rows appended after id after, oldest first (tailing).
Sourcepub fn history_head(&self) -> Result<i64>
pub fn history_head(&self) -> Result<i64>
The newest history id, 0 when empty.
Sourcepub fn history_verify(&self) -> Result<Verified>
pub fn history_verify(&self) -> Result<Verified>
Walk the history chain, as AuditLog::verify does the audit one.
Sourcepub fn timeline(
&self,
q: &HistoryQuery,
hvis: &Visibility,
avis: Option<&Visibility>,
) -> Result<Page>
pub fn timeline( &self, q: &HistoryQuery, hvis: &Visibility, avis: Option<&Visibility>, ) -> Result<Page>
The merged timeline: history rows hvis may see and, when avis is
given, audit rows it may see.