pub struct Client { /* private fields */ }Expand description
A single Redis endpoint housing an audit log.
Implementations§
Source§impl Client
impl Client
Sourcepub fn connect(url: &str) -> AudisResult<Client>
pub fn connect(url: &str) -> AudisResult<Client>
Connect to a Redis instance, by URL.
This implementation understands the same URL formats
that the underlying redis crate understands.
Primarily, this means the following should work:
- redis://127.0.0.1:6379
- redis://localhost
- unix:/path/to/redis.sock
Sourcepub fn background(
&self,
n: usize,
) -> AudisResult<(SyncSender<Event>, JoinHandle<()>)>
pub fn background( &self, n: usize, ) -> AudisResult<(SyncSender<Event>, JoinHandle<()>)>
Delegate event logging to a background thread.
This function spins up a new thread, with a copy of the audis Client object, and returns a channel for sending new audis::Event objects to be logged, and the thread JoinHandle for waiting on the thread to finish.
The sending channel is buffered, and will have enough
space to keep n Event objects in memory. If n is
passed as zero, a suitable default will be used instead.
If the background thread encounters an error while trying to log an Event to the Redis backend, it will print out the error and attempt to recover.
To shut down the background thread, drop the returned
SyncSender
Sourcepub fn subjects(&self) -> AudisResult<Vec<String>>
pub fn subjects(&self) -> AudisResult<Vec<String>>
Return the list of all known subjects.
Sourcepub fn log(&self, e: &Event) -> AudisResult<&Client>
pub fn log(&self, e: &Event) -> AudisResult<&Client>
Log an event to the audit log.
Sourcepub fn retrieve(&self, log: &str) -> AudisResult<Vec<Event>>
pub fn retrieve(&self, log: &str) -> AudisResult<Vec<Event>>
Retrieve the full list of events for the given subject.
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl UnwindSafe for Client
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
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>
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>
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