#[non_exhaustive]pub struct ClientConnection {
pub replica_id: u64,
pub module: ModuleHost,
/* private fields */
}Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.replica_id: u64§module: ModuleHostImplementations§
Source§impl ClientConnection
impl ClientConnection
Sourcepub async fn call_client_connected_maybe_reject(
module_rx: &mut Receiver<ModuleHost>,
id: ClientActorId,
) -> Result<Connected, ClientConnectedError>
pub async fn call_client_connected_maybe_reject( module_rx: &mut Receiver<ModuleHost>, id: ClientActorId, ) -> Result<Connected, ClientConnectedError>
Call the database at module_rx’s client_connection reducer, if any,
and return Err if it signals rejecting this client’s connection.
Call this method before Self::spawn
and pass the returned [Connected] to Self::spawn as proof that the client is authorized.
Sourcepub async fn spawn<Fut>(
id: ClientActorId,
config: ClientConfig,
replica_id: u64,
module_rx: Receiver<ModuleHost>,
actor: impl FnOnce(ClientConnection, MeteredReceiver<SerializableMessage>) -> Fut,
_proof_of_client_connected_call: Connected,
) -> ClientConnection
pub async fn spawn<Fut>( id: ClientActorId, config: ClientConfig, replica_id: u64, module_rx: Receiver<ModuleHost>, actor: impl FnOnce(ClientConnection, MeteredReceiver<SerializableMessage>) -> Fut, _proof_of_client_connected_call: Connected, ) -> ClientConnection
Spawn a new ClientConnection for a WebSocket subscriber.
Callers should first call Self::call_client_connected_maybe_reject
to verify that the database at module_rx approves of this connection,
and should not invoke this method if that call returns an error,
and pass the returned [Connected] as _proof_of_client_connected_call.
pub fn dummy( id: ClientActorId, config: ClientConfig, replica_id: u64, module_rx: Receiver<ModuleHost>, ) -> Self
pub fn sender(&self) -> Arc<ClientConnectionSender>
pub fn handle_message( &self, message: impl Into<DataMessage>, timer: Instant, ) -> impl Future<Output = Result<(), MessageHandleError>> + '_
pub async fn watch_module_host(&mut self) -> Result<(), NoSuchModule>
pub async fn call_reducer( &self, reducer: &str, args: ReducerArgs, request_id: RequestId, timer: Instant, flags: CallReducerFlags, ) -> Result<ReducerCallResult, ReducerCallError>
pub async fn subscribe_single( &self, subscription: SubscribeSingle, timer: Instant, ) -> Result<Option<ExecutionMetrics>, DBError>
pub async fn unsubscribe( &self, request: Unsubscribe, timer: Instant, ) -> Result<Option<ExecutionMetrics>, DBError>
pub async fn subscribe_multi( &self, request: SubscribeMulti, timer: Instant, ) -> Result<Option<ExecutionMetrics>, DBError>
pub async fn unsubscribe_multi( &self, request: UnsubscribeMulti, timer: Instant, ) -> Result<Option<ExecutionMetrics>, DBError>
pub async fn subscribe( &self, subscription: Subscribe, timer: Instant, ) -> Result<ExecutionMetrics, DBError>
pub async fn one_off_query_json( &self, query: &str, message_id: &[u8], timer: Instant, ) -> Result<(), Error>
pub async fn one_off_query_bsatn( &self, query: &str, message_id: &[u8], timer: Instant, ) -> Result<(), Error>
pub async fn disconnect(self)
Methods from Deref<Target = ClientConnectionSender>§
pub fn is_cancelled(&self) -> bool
Sourcepub fn send_message(
&self,
message: impl Into<SerializableMessage>,
) -> Result<(), ClientSendError>
pub fn send_message( &self, message: impl Into<SerializableMessage>, ) -> Result<(), ClientSendError>
Send a message to the client. For data-related messages, you should probably use
BroadcastQueue::send to ensure that the client sees data messages in a consistent order.
Trait Implementations§
Source§impl Clone for ClientConnection
impl Clone for ClientConnection
Source§fn clone(&self) -> ClientConnection
fn clone(&self) -> ClientConnection
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 ClientConnection
impl !RefUnwindSafe for ClientConnection
impl Send for ClientConnection
impl Sync for ClientConnection
impl Unpin for ClientConnection
impl !UnwindSafe for ClientConnection
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