pub struct ReplicaInfo { /* private fields */ }Expand description
In memory information about an open replica.
Implementations§
Source§impl ReplicaInfo
impl ReplicaInfo
Sourcepub fn new(capability: Capability) -> Self
pub fn new(capability: Capability) -> Self
Create a new replica.
Sourcepub fn subscribe(&mut self, sender: Sender<Event>)
pub fn subscribe(&mut self, sender: Sender<Event>)
Subscribe to insert events.
When subscribing to a replica, you must ensure that the corresponding [async_channel::Receiver] is
received from in a loop. If not receiving, local and remote inserts will hang waiting for
the receiver to be received from.
Sourcepub fn unsubscribe(&mut self, sender: &Sender<Event>)
pub fn unsubscribe(&mut self, sender: &Sender<Event>)
Explicitly unsubscribe a sender.
Simply dropping the receiver is fine too. If you cloned a single sender to subscribe to multiple replicas, you can use this method to explicitly unsubscribe the sender from this replica without having to drop the receiver.
Sourcepub fn subscribers_count(&self) -> usize
pub fn subscribers_count(&self) -> usize
Get the number of current event subscribers.
Sourcepub fn set_content_status_callback(&mut self, cb: ContentStatusCallback) -> bool
pub fn set_content_status_callback(&mut self, cb: ContentStatusCallback) -> bool
Set the content status callback.
Only one callback can be active at a time. If a previous callback was registered, this
will return false.
Sourcepub fn closed(&self) -> bool
pub fn closed(&self) -> bool
Returns true if the replica is closed.
If a replica is closed, no further operations can be performed. A replica cannot be closed
manually, it must be closed via store::Store::close_replica or
store::Store::remove_replica
Sourcepub fn merge_capability(
&mut self,
capability: Capability,
) -> Result<bool, CapabilityError>
pub fn merge_capability( &mut self, capability: Capability, ) -> Result<bool, CapabilityError>
Merge a capability.
The capability must refer to the the same namespace, otherwise an error will be returned.
This will upgrade the replica’s capability when passing a Capability::Write.
It is a no-op if capability is a Capability::Read`.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReplicaInfo
impl !RefUnwindSafe for ReplicaInfo
impl Send for ReplicaInfo
impl Sync for ReplicaInfo
impl Unpin for ReplicaInfo
impl !UnwindSafe for ReplicaInfo
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
§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>
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