pub struct ConnectedRedisBroker { /* private fields */ }Expand description
The typed witness that Broker::connect succeeded: it owns the live fred pool.
Every subscription and every publisher is reached from here, so “not connected” is not
representable. ConnectedBroker::shutdown consumes it, which makes a publish or subscribe
after shutdown a compile error for the owner of the handle.
Implementations§
Source§impl ConnectedRedisBroker
impl ConnectedRedisBroker
Sourcepub async fn subscribe(
&self,
def: RedisStream,
) -> Result<RedisSubscriber, RedisError>
pub async fn subscribe( &self, def: RedisStream, ) -> Result<RedisSubscriber, RedisError>
Opens a stream subscription described by def.
Ensures the consumer group exists (XGROUP CREATE ... MKSTREAM, ignoring an
already-existing group) before returning the subscriber.
§Errors
Returns RedisError::ShutDown when the connection was already torn down,
RedisError::InvalidOptions when def names no consumer group, or
RedisError::Subscribe when the group cannot be created.
Sourcepub async fn subscribe_pubsub(
&self,
def: RedisPubSub,
) -> Result<RedisPubSubSubscriber, RedisError>
pub async fn subscribe_pubsub( &self, def: RedisPubSub, ) -> Result<RedisPubSubSubscriber, RedisError>
Opens a Pub/Sub subscription described by def on a dedicated client.
§Errors
Returns RedisError::InvalidOptions for an invalid mode/pattern combination,
RedisError::ShutDown when the connection was already torn down,
RedisError::Connect when the dedicated client cannot connect, or
RedisError::Subscribe when the subscribe command fails.
Sourcepub async fn subscribe_list(
&self,
def: RedisList,
) -> Result<RedisListSubscriber, RedisError>
pub async fn subscribe_list( &self, def: RedisList, ) -> Result<RedisListSubscriber, RedisError>
Opens a list (work-queue) subscription described by def.
§Errors
Returns RedisError::ShutDown when the connection was already torn down, or
RedisError::InvalidOptions when def names a recovery ZSET without a min_idle.
Sourcepub fn publisher(&self) -> RedisPublisher
pub fn publisher(&self) -> RedisPublisher
Returns a stream publisher (XADD) bound to this connection.
Sourcepub fn pubsub_publisher(
&self,
publish: RedisPubSubPublish,
) -> RedisPubSubPublisher
pub fn pubsub_publisher( &self, publish: RedisPubSubPublish, ) -> RedisPubSubPublisher
Returns a Pub/Sub publisher configured by publish (mode and envelope codec).
Sourcepub fn list_publisher(&self, publish: RedisListPublish) -> RedisListPublisher
pub fn list_publisher(&self, publish: RedisListPublish) -> RedisListPublisher
Returns a list publisher (LPUSH) configured by publish (envelope codec and key TTL).
Sourcepub fn pool_handle(&self) -> Result<Pool, RedisError>
pub fn pool_handle(&self) -> Result<Pool, RedisError>
Returns a clone of the underlying pool, for advanced operations not covered by the wrapper.
§Errors
Returns RedisError::ShutDown once the connection was torn down.
Trait Implementations§
Source§impl ConnectedBroker for ConnectedRedisBroker
impl ConnectedBroker for ConnectedRedisBroker
Source§async fn shutdown(self) -> Result<Self::Closed, Self::Error>
async fn shutdown(self) -> Result<Self::Closed, Self::Error>
Closes every pooled connection and marks the shared connection dead, so publishers handed
out earlier report RedisError::ShutDown instead of running against a closed pool.
§Errors
Returns RedisError::Connect when the QUIT roundtrip fails.
Source§type Error = RedisError
type Error = RedisError
Source§impl Debug for ConnectedRedisBroker
impl Debug for ConnectedRedisBroker
Source§impl DefaultPublish for ConnectedRedisBroker
impl DefaultPublish for ConnectedRedisBroker
Source§type Policy = RedisPublish
type Policy = RedisPublish
Source§impl PublishPolicy<ConnectedRedisBroker> for RedisListPublish
impl PublishPolicy<ConnectedRedisBroker> for RedisListPublish
Source§type Live = RedisListPublisher
type Live = RedisListPublisher
Publisher for a leaf policy, or the live
wiring form for a combinator stack (a typed publisher over a policy pairs into the same
typed publisher over the live leaf).Source§impl PublishPolicy<ConnectedRedisBroker> for RedisPublish
impl PublishPolicy<ConnectedRedisBroker> for RedisPublish
Source§type Live = RedisPublisher
type Live = RedisPublisher
Publisher for a leaf policy, or the live
wiring form for a combinator stack (a typed publisher over a policy pairs into the same
typed publisher over the live leaf).Source§impl PublishPolicy<ConnectedRedisBroker> for RedisPubSubPublish
impl PublishPolicy<ConnectedRedisBroker> for RedisPubSubPublish
Source§type Live = RedisPubSubPublisher
type Live = RedisPubSubPublisher
Publisher for a leaf policy, or the live
wiring form for a combinator stack (a typed publisher over a policy pairs into the same
typed publisher over the live leaf).Source§impl Subscribe for ConnectedRedisBroker
impl Subscribe for ConnectedRedisBroker
Source§type Subscriber = RedisSubscriber
type Subscriber = RedisSubscriber
Source§impl SubscriptionSource<ConnectedRedisBroker> for RedisList
impl SubscriptionSource<ConnectedRedisBroker> for RedisList
Source§type Subscriber = RedisListSubscriber
type Subscriber = RedisListSubscriber
Source§async fn subscribe(
self,
connected: &ConnectedRedisBroker,
) -> Result<Self::Subscriber, RedisError>
async fn subscribe( self, connected: &ConnectedRedisBroker, ) -> Result<Self::Subscriber, RedisError>
Source§impl SubscriptionSource<ConnectedRedisBroker> for RedisPubSub
impl SubscriptionSource<ConnectedRedisBroker> for RedisPubSub
Source§type Subscriber = RedisPubSubSubscriber
type Subscriber = RedisPubSubSubscriber
Source§async fn subscribe(
self,
connected: &ConnectedRedisBroker,
) -> Result<Self::Subscriber, RedisError>
async fn subscribe( self, connected: &ConnectedRedisBroker, ) -> Result<Self::Subscriber, RedisError>
Source§impl SubscriptionSource<ConnectedRedisBroker> for RedisStream
impl SubscriptionSource<ConnectedRedisBroker> for RedisStream
Source§type Subscriber = RedisSubscriber
type Subscriber = RedisSubscriber
Source§async fn subscribe(
self,
connected: &ConnectedRedisBroker,
) -> Result<Self::Subscriber, RedisError>
async fn subscribe( self, connected: &ConnectedRedisBroker, ) -> Result<Self::Subscriber, RedisError>
Auto Trait Implementations§
impl !RefUnwindSafe for ConnectedRedisBroker
impl !UnwindSafe for ConnectedRedisBroker
impl Freeze for ConnectedRedisBroker
impl Send for ConnectedRedisBroker
impl Sync for ConnectedRedisBroker
impl Unpin for ConnectedRedisBroker
impl UnsafeUnpin for ConnectedRedisBroker
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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