Skip to main content

AuditLog

Struct AuditLog 

Source
pub struct AuditLog { /* private fields */ }

Implementations§

Source§

impl AuditLog

Source

pub fn open(path: &Path, retention: Duration) -> Result<AuditLog>

Open (creating and migrating) the log at path.

Source

pub fn in_memory() -> Result<AuditLog>

A throwaway in-memory log (tests).

Source

pub fn with_clock(self, clock: impl Fn() -> i64 + Send + Sync + 'static) -> Self

Replace the clock (unix milliseconds), for tests of retention.

Source

pub fn with_history_limits(self, retention: Duration, max_rows: i64) -> Self

Keep history rows for retention, and at most max_rows of them.

Source

pub fn path(&self) -> Option<&Path>

Source

pub fn retention(&self) -> Duration

Source

pub fn append(&self, n: NewEntry) -> Result<Entry>

Append one row, chained to the newest. Returns it.

Source

pub fn prune(&self) -> Result<usize>

Remove rows older than the retention, keeping the chain anchored. The only way rows ever leave.

Source

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).

Source

pub fn generation(&self) -> u64

The current append generation (see Self::wait_change).

Source

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

pub fn head(&self) -> Result<i64>

The newest id, 0 when empty.

Source

pub fn verify(&self) -> Result<Verified>

Walk the chain from the oldest kept row to the head.

Source§

impl AuditLog

Source

pub fn history_append(&self, n: NewRecord) -> Result<Record>

Append one history row, chained to the newest.

Source

pub fn history_last_time(&self) -> Result<Option<i64>>

The newest history row’s time, if any.

Source

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.

Source

pub fn history_after( &self, after: i64, vis: &Visibility, limit: usize, ) -> Result<Vec<Record>>

Rows appended after id after, oldest first (tailing).

Source

pub fn history_head(&self) -> Result<i64>

The newest history id, 0 when empty.

Source

pub fn history_verify(&self) -> Result<Verified>

Walk the history chain, as AuditLog::verify does the audit one.

Source

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.

Trait Implementations§

Source§

impl Debug for AuditLog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V