pub struct InMemoryAuditStore { /* private fields */ }Available on crate feature
audit only.Expand description
An AuditStore in memory: for tests and for deployments that ship
records elsewhere and keep none. Everything is lost on restart, which is
no use as a log of record.
Implementations§
Source§impl InMemoryAuditStore
impl InMemoryAuditStore
Sourcepub fn new() -> InMemoryAuditStore
pub fn new() -> InMemoryAuditStore
An empty store.
Trait Implementations§
Source§impl AuditStore for InMemoryAuditStore
impl AuditStore for InMemoryAuditStore
Source§fn delete_through_unless_held<'a>(
&'a self,
chain: &'a str,
seq: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, A2aError>> + Send + 'a>>
fn delete_through_unless_held<'a>( &'a self, chain: &'a str, seq: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, A2aError>> + Send + 'a>>
Reads the holds and deletes under the holds’ read lock, which
place_hold needs to write: no hold lands between the two. The order
(holds, then chains) is the only one any method takes both in.
Source§fn append_next_naming<'a>(
&'a self,
chain: &'a str,
sids: &'a [String],
seal: &'a (dyn Fn(Option<(u64, String)>, Option<i64>) -> Pin<Box<dyn Future<Output = Result<AuditRecord, A2aError>> + Send + 'a>> + Send + Sync),
) -> Pin<Box<dyn Future<Output = Result<NamedAppend, A2aError>> + Send + 'a>>
fn append_next_naming<'a>( &'a self, chain: &'a str, sids: &'a [String], seal: &'a (dyn Fn(Option<(u64, String)>, Option<i64>) -> Pin<Box<dyn Future<Output = Result<AuditRecord, A2aError>> + Send + 'a>> + Send + Sync), ) -> Pin<Box<dyn Future<Output = Result<NamedAppend, A2aError>> + Send + 'a>>
Under the keys’ read lock, which a deletion needs to write: no key goes between the check and the store.
Source§fn delete_subject_key_unless_named<'a>(
&'a self,
chain: &'a str,
lookup: &'a str,
sid: &'a str,
scanned_through: u64,
) -> Pin<Box<dyn Future<Output = Result<bool, A2aError>> + Send + 'a>>
fn delete_subject_key_unless_named<'a>( &'a self, chain: &'a str, lookup: &'a str, sid: &'a str, scanned_through: u64, ) -> Pin<Box<dyn Future<Output = Result<bool, A2aError>> + Send + 'a>>
Under the keys’ write lock, which an append that names keys needs to read.
Source§fn delete_subject_keys_unless_held<'a>(
&'a self,
chain: &'a str,
lookups: &'a [String],
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<String>>, A2aError>> + Send + 'a>>
fn delete_subject_keys_unless_held<'a>( &'a self, chain: &'a str, lookups: &'a [String], ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<String>>, A2aError>> + Send + 'a>>
Under the holds’ read lock, which place_hold needs to write.
Source§fn is_process_local(&self) -> bool
fn is_process_local(&self) -> bool
Whether this store keeps its state in this process alone. Read more
Source§fn head<'a>(
&'a self,
chain: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<(u64, String)>, A2aError>> + Send + 'a>>
fn head<'a>( &'a self, chain: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<(u64, String)>, A2aError>> + Send + 'a>>
The highest
seq stored in chain and that record’s hash.Source§fn append<'a>(
&'a self,
record: &'a AuditRecord,
) -> Pin<Box<dyn Future<Output = Result<Appended, A2aError>> + Send + 'a>>
fn append<'a>( &'a self, record: &'a AuditRecord, ) -> Pin<Box<dyn Future<Output = Result<Appended, A2aError>> + Send + 'a>>
Stores a sealed record, unless its
(chain, seq) is already taken.Source§fn read<'a>(
&'a self,
chain: &'a str,
after: u64,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<AuditRecord>, A2aError>> + Send + 'a>>
fn read<'a>( &'a self, chain: &'a str, after: u64, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<AuditRecord>, A2aError>> + Send + 'a>>
Up to
limit records of chain with seq above after, in order.Source§fn chains(
&self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, A2aError>> + Send + '_>>
fn chains( &self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, A2aError>> + Send + '_>>
Every chain that holds a record or a checkpoint.
Source§fn put_checkpoint<'a>(
&'a self,
checkpoint: &'a Checkpoint,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
fn put_checkpoint<'a>( &'a self, checkpoint: &'a Checkpoint, ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
Stores a checkpoint, replacing one of the same chain,
seq and kind.Source§fn checkpoints<'a>(
&'a self,
chain: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Checkpoint>, A2aError>> + Send + 'a>>
fn checkpoints<'a>( &'a self, chain: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Checkpoint>, A2aError>> + Send + 'a>>
Every checkpoint of
chain, in seq order.Source§fn last_before<'a>(
&'a self,
chain: &'a str,
cutoff_ms: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<(u64, String)>, A2aError>> + Send + 'a>>
fn last_before<'a>( &'a self, chain: &'a str, cutoff_ms: i64, ) -> Pin<Box<dyn Future<Output = Result<Option<(u64, String)>, A2aError>> + Send + 'a>>
The last record of
chain sealed before cutoff_ms (Unix
milliseconds), as (seq, hash).Source§fn delete_through<'a>(
&'a self,
chain: &'a str,
seq: u64,
) -> Pin<Box<dyn Future<Output = Result<u64, A2aError>> + Send + 'a>>
fn delete_through<'a>( &'a self, chain: &'a str, seq: u64, ) -> Pin<Box<dyn Future<Output = Result<u64, A2aError>> + Send + 'a>>
Deletes the records of
chain up to and including seq, and the
checkpoints below seq (an anchor at seq itself is kept). Returns
how many records went.Source§fn place_hold<'a>(
&'a self,
hold: &'a LegalHold,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
fn place_hold<'a>( &'a self, hold: &'a LegalHold, ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
Places a hold on
chain, replacing any reason already given.Source§fn release_hold<'a>(
&'a self,
chain: &'a str,
) -> Pin<Box<dyn Future<Output = Result<bool, A2aError>> + Send + 'a>>
fn release_hold<'a>( &'a self, chain: &'a str, ) -> Pin<Box<dyn Future<Output = Result<bool, A2aError>> + Send + 'a>>
Lifts the hold on
chain; returns whether there was one.Source§fn holds(
&self,
) -> Pin<Box<dyn Future<Output = Result<Vec<LegalHold>, A2aError>> + Send + '_>>
fn holds( &self, ) -> Pin<Box<dyn Future<Output = Result<Vec<LegalHold>, A2aError>> + Send + '_>>
Every hold in place.
Source§fn supports_subject_keys(&self) -> bool
fn supports_subject_keys(&self) -> bool
Whether this store keeps subject keys.
AuditLog::with_privacy
refuses a store that answers false.Source§fn subject_key<'a>(
&'a self,
chain: &'a str,
lookup: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<SubjectKey>, A2aError>> + Send + 'a>>
fn subject_key<'a>( &'a self, chain: &'a str, lookup: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<SubjectKey>, A2aError>> + Send + 'a>>
Source§fn subject_key_by_sid<'a>(
&'a self,
chain: &'a str,
sid: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<SubjectKey>, A2aError>> + Send + 'a>>
fn subject_key_by_sid<'a>( &'a self, chain: &'a str, sid: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<SubjectKey>, A2aError>> + Send + 'a>>
Source§fn subject_keys<'a>(
&'a self,
chain: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectKey>, A2aError>> + Send + 'a>>
fn subject_keys<'a>( &'a self, chain: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Vec<SubjectKey>, A2aError>> + Send + 'a>>
Every subject key of
chain, for dropping those no record names. Read moreSource§fn put_subject_key<'a>(
&'a self,
chain: &'a str,
key: &'a SubjectKey,
) -> Pin<Box<dyn Future<Output = Result<bool, A2aError>> + Send + 'a>>
fn put_subject_key<'a>( &'a self, chain: &'a str, key: &'a SubjectKey, ) -> Pin<Box<dyn Future<Output = Result<bool, A2aError>> + Send + 'a>>
Stores
key for chain unless a key with its lookup is there;
false when one was, and nothing was stored. Atomic: of two writers
racing on one lookup, exactly one stores. Read moreSource§fn delete_subject_key<'a>(
&'a self,
chain: &'a str,
lookup: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, A2aError>> + Send + 'a>>
fn delete_subject_key<'a>( &'a self, chain: &'a str, lookup: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, A2aError>> + Send + 'a>>
Deletes the key of
chain whose lookup is lookup, returning its
sid, or None when there was none. Must not leave a copy: what it
deletes is what erasure destroys. Read moreSource§fn append_next<'a>(
&'a self,
chain: &'a str,
seal: &'a (dyn Fn(Option<(u64, String)>, Option<i64>) -> Pin<Box<dyn Future<Output = Result<AuditRecord, A2aError>> + Send + 'a>> + Send + Sync),
) -> Pin<Box<dyn Future<Output = Result<Option<AuditRecord>, A2aError>> + Send + 'a>>
fn append_next<'a>( &'a self, chain: &'a str, seal: &'a (dyn Fn(Option<(u64, String)>, Option<i64>) -> Pin<Box<dyn Future<Output = Result<AuditRecord, A2aError>> + Send + 'a>> + Send + Sync), ) -> Pin<Box<dyn Future<Output = Result<Option<AuditRecord>, A2aError>> + Send + 'a>>
Appends the next record of
chain: reads its head, has seal build the
record that follows it, and stores that. Ok(None) when another writer
took the position first: nothing was stored, and the caller asks again. Read moreSource§impl Debug for InMemoryAuditStore
impl Debug for InMemoryAuditStore
Source§impl Default for InMemoryAuditStore
impl Default for InMemoryAuditStore
Source§fn default() -> InMemoryAuditStore
fn default() -> InMemoryAuditStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for InMemoryAuditStore
impl !RefUnwindSafe for InMemoryAuditStore
impl Forget for InMemoryAuditStore
impl Move for InMemoryAuditStore
impl Send for InMemoryAuditStore
impl Sync for InMemoryAuditStore
impl Unpin for InMemoryAuditStore
impl UnsafeUnpin for InMemoryAuditStore
impl UnwindSafe for InMemoryAuditStore
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].