pub struct ModuleSubscriptions { /* private fields */ }Implementations§
Source§impl ModuleSubscriptions
impl ModuleSubscriptions
pub fn new( relational_db: Arc<RelationalDB>, subscriptions: Arc<RwLock<SubscriptionManager>>, broadcast_queue: BroadcastQueue, owner_identity: Identity, ) -> Self
Sourcepub fn for_test_new_runtime(
db: Arc<RelationalDB>,
) -> (ModuleSubscriptions, Runtime)
pub fn for_test_new_runtime( db: Arc<RelationalDB>, ) -> (ModuleSubscriptions, Runtime)
Construct a new ModuleSubscriptions for use in testing,
creating a new tokio::runtime::Runtime to run its send worker.
Sourcepub fn for_test_enclosing_runtime(db: Arc<RelationalDB>) -> ModuleSubscriptions
pub fn for_test_enclosing_runtime(db: Arc<RelationalDB>) -> ModuleSubscriptions
Construct a new ModuleSubscriptions for use in testing,
running its send worker on the dynamically enclosing tokio::runtime::Runtime
pub fn update_gauges(&self)
pub fn remove_gauges(&self)
Sourcepub fn add_single_subscription(
&self,
sender: Arc<ClientConnectionSender>,
request: SubscribeSingle,
timer: Instant,
_assert: Option<Arc<dyn Fn(&Tx)>>,
) -> Result<Option<ExecutionMetrics>, DBError>
pub fn add_single_subscription( &self, sender: Arc<ClientConnectionSender>, request: SubscribeSingle, timer: Instant, _assert: Option<Arc<dyn Fn(&Tx)>>, ) -> Result<Option<ExecutionMetrics>, DBError>
Add a subscription to a single query.
Sourcepub fn remove_single_subscription(
&self,
sender: Arc<ClientConnectionSender>,
request: Unsubscribe,
timer: Instant,
) -> Result<Option<ExecutionMetrics>, DBError>
pub fn remove_single_subscription( &self, sender: Arc<ClientConnectionSender>, request: Unsubscribe, timer: Instant, ) -> Result<Option<ExecutionMetrics>, DBError>
Remove a subscription for a single query.
Sourcepub fn remove_multi_subscription(
&self,
sender: Arc<ClientConnectionSender>,
request: UnsubscribeMulti,
timer: Instant,
) -> Result<Option<ExecutionMetrics>, DBError>
pub fn remove_multi_subscription( &self, sender: Arc<ClientConnectionSender>, request: UnsubscribeMulti, timer: Instant, ) -> Result<Option<ExecutionMetrics>, DBError>
Remove a client’s subscription for a set of queries.
Sourcepub fn send_client_message(
&self,
recipient: Arc<ClientConnectionSender>,
message: impl Into<SerializableMessage>,
_tx_id: &TxId,
) -> Result<(), BroadcastError>
pub fn send_client_message( &self, recipient: Arc<ClientConnectionSender>, message: impl Into<SerializableMessage>, _tx_id: &TxId, ) -> Result<(), BroadcastError>
Send a message to a client connection.
This will eventually be sent by the send-worker.
This takes a TxId, because this should be called while still holding a lock on the database.
pub fn add_multi_subscription( &self, sender: Arc<ClientConnectionSender>, request: SubscribeMulti, timer: Instant, _assert: Option<Arc<dyn Fn(&Tx)>>, ) -> Result<Option<ExecutionMetrics>, DBError>
Sourcepub fn add_legacy_subscriber(
&self,
sender: Arc<ClientConnectionSender>,
subscription: Subscribe,
timer: Instant,
_assert: Option<Arc<dyn Fn(&Tx)>>,
) -> Result<ExecutionMetrics, DBError>
pub fn add_legacy_subscriber( &self, sender: Arc<ClientConnectionSender>, subscription: Subscribe, timer: Instant, _assert: Option<Arc<dyn Fn(&Tx)>>, ) -> Result<ExecutionMetrics, DBError>
Add a subscriber to the module. NOTE: this function is blocking. This is used for the legacy subscription API which uses a set of queries.
pub fn remove_subscriber(&self, client_id: ClientActorId)
Sourcepub fn commit_and_broadcast_event(
&self,
caller: Option<Arc<ClientConnectionSender>>,
event: ModuleEvent,
tx: MutTx,
) -> Result<Result<(Arc<ModuleEvent>, ExecutionMetrics), WriteConflict>, DBError>
pub fn commit_and_broadcast_event( &self, caller: Option<Arc<ClientConnectionSender>>, event: ModuleEvent, tx: MutTx, ) -> Result<Result<(Arc<ModuleEvent>, ExecutionMetrics), WriteConflict>, DBError>
Commit a transaction and broadcast its ModuleEvent to all interested subscribers.
The returned ExecutionMetrics are reported in this method via report_tx_metrics.
They are returned for testing purposes but should not be reported separately.
Trait Implementations§
Source§impl Clone for ModuleSubscriptions
impl Clone for ModuleSubscriptions
Source§fn clone(&self) -> ModuleSubscriptions
fn clone(&self) -> ModuleSubscriptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ModuleSubscriptions
impl !RefUnwindSafe for ModuleSubscriptions
impl Send for ModuleSubscriptions
impl Sync for ModuleSubscriptions
impl Unpin for ModuleSubscriptions
impl !UnwindSafe for ModuleSubscriptions
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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