pub struct Replica { /* private fields */ }Expand description
A replica database with read-only access
Implementations§
Source§impl Replica
impl Replica
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 replica database with the given snapshot and additional logs.
Sourcepub async fn with_connection<A>(
&self,
f: impl FnOnce(&mut Connection) -> Result<A> + Send + 'static,
) -> Result<A>where
A: Send + 'static,
pub async fn with_connection<A>(
&self,
f: impl FnOnce(&mut Connection) -> Result<A> + Send + 'static,
) -> Result<A>where
A: Send + 'static,
Opens a read-only connection to the replica database and runs the provided function. The provided connection uses the rusqlite API.
Sourcepub async fn replicate(&mut self, log: &Log) -> Result<()>
pub async fn replicate(&mut self, log: &Log) -> Result<()>
Replicates a new log into the replica database.
Sourcepub fn into_primary(self) -> Result<Primary>
pub fn into_primary(self) -> Result<Primary>
Converts the replica database into a primary.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Replica
impl !RefUnwindSafe for Replica
impl Send for Replica
impl Sync for Replica
impl Unpin for Replica
impl !UnwindSafe for Replica
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