pub struct Primary { /* private fields */ }Expand description
A primary database with read-write access
Implementations§
Source§impl Primary
impl Primary
Sourcepub async fn open(
last_snapshot: &Snapshot,
additional_logs: &[Log],
) -> Result<Self>
pub async fn open( last_snapshot: &Snapshot, additional_logs: &[Log], ) -> Result<Self>
Opens a primary database with the given snapshot and additional logs.
Sourcepub fn capture_frames(&mut self) -> Frames
pub fn capture_frames(&mut self) -> Frames
Captures a live stream of frames from the primary database.
Sourcepub async fn checkpoint(
&self,
save_log: impl FnOnce(Log) -> BoxFuture<'static, ()> + Send + 'static,
) -> Result<impl Future<Output = Option<FrameNo>>>
pub async fn checkpoint( &self, save_log: impl FnOnce(Log) -> BoxFuture<'static, ()> + Send + 'static, ) -> Result<impl Future<Output = Option<FrameNo>>>
Checkpoints the primary database and returns a future that resolves to the last safely written frame number.
The save_log function should save the log to a durable storage, is async, and is not allowed to fail.
Checkpoints are exclusive, so only one checkpoint can be in progress at a time.
Sourcepub async fn with_connection<A>(
&self,
f: impl FnOnce(&mut Connection) -> Result<A> + Send + 'static,
) -> Result<Ack<A>>
pub async fn with_connection<A>( &self, f: impl FnOnce(&mut Connection) -> Result<A> + Send + 'static, ) -> Result<Ack<A>>
Opens a read-write connection to the primary database and runs the provided function. The provided connection uses the rusqlite API.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Primary
impl !RefUnwindSafe for Primary
impl Send for Primary
impl Sync for Primary
impl Unpin for Primary
impl !UnwindSafe for Primary
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request