pub trait AsyncTypedCommands:
ConnectionLike
+ Send
+ Sized {
Show 22 methods
// Provided methods
fn eappend<'a, S: ToRedisArgs + Send + Sync + 'a, E: ToRedisArgs + Send + Sync + 'a>(
&'a mut self,
stream_id: S,
event_name: E,
options: EAppendOptions<'a>,
) -> RedisFuture<'a, AppendInfo> { ... }
fn emappend<'a>(
&'a mut self,
partition_key: Uuid,
events: &'a [EMAppendEvent<'a>],
) -> RedisFuture<'a, MultiAppendInfo> { ... }
fn eget<'a>(&'a mut self, event_id: Uuid) -> RedisFuture<'a, Option<Event>> { ... }
fn epscan_by_key<'a>(
&'a mut self,
partition_key: Uuid,
start_sequence: u64,
end_sequence: Option<u64>,
count: Option<u64>,
) -> RedisFuture<'a, EventBatch> { ... }
fn epscan_by_id<'a>(
&'a mut self,
partition_id: u16,
start_sequence: u64,
end_sequence: Option<u64>,
count: Option<u64>,
) -> RedisFuture<'a, EventBatch> { ... }
fn escan<'a>(
&'a mut self,
stream_id: &'a str,
start_version: u64,
end_version: Option<u64>,
count: Option<u64>,
) -> RedisFuture<'a, EventBatch> { ... }
fn escan_with_partition_key<'a>(
&'a mut self,
stream_id: &'a str,
partition_key: Uuid,
start_version: u64,
end_version: Option<u64>,
count: Option<u64>,
) -> RedisFuture<'a, EventBatch> { ... }
fn epseq_by_key<'a>(
&'a mut self,
partition_key: Uuid,
) -> RedisFuture<'a, Option<u64>> { ... }
fn epseq_by_id<'a>(
&'a mut self,
partition_id: u16,
) -> RedisFuture<'a, Option<u64>> { ... }
fn esver<'a>(
&'a mut self,
stream_id: &'a str,
) -> RedisFuture<'a, Option<u64>> { ... }
fn esver_with_partition_key<'a>(
&'a mut self,
stream_id: &'a str,
partition_key: Uuid,
) -> RedisFuture<'a, Option<u64>> { ... }
fn esub<'a, S: ToRedisArgs + Send + Sync + 'a>(
&'a mut self,
stream_id: S,
) -> RedisFuture<'a, SubscriptionInfo> { ... }
fn esub_with_partition_key<'a, S: ToRedisArgs + Send + Sync + 'a>(
&'a mut self,
stream_id: S,
partition_key: Uuid,
) -> RedisFuture<'a, SubscriptionInfo> { ... }
fn esub_from_version<'a, S: ToRedisArgs + Send + Sync + 'a>(
&'a mut self,
stream_id: S,
from_version: u64,
) -> RedisFuture<'a, SubscriptionInfo> { ... }
fn esub_with_partition_and_version<'a, S: ToRedisArgs + Send + Sync + 'a>(
&'a mut self,
stream_id: S,
partition_key: Uuid,
from_version: u64,
) -> RedisFuture<'a, SubscriptionInfo> { ... }
fn epsub_by_key<'a>(
&'a mut self,
partition_key: Uuid,
) -> RedisFuture<'a, SubscriptionInfo> { ... }
fn epsub_by_id<'a>(
&'a mut self,
partition_id: u16,
) -> RedisFuture<'a, SubscriptionInfo> { ... }
fn epsub_by_key_from_sequence<'a>(
&'a mut self,
partition_key: Uuid,
from_sequence: u64,
) -> RedisFuture<'a, SubscriptionInfo> { ... }
fn epsub_by_id_from_sequence<'a>(
&'a mut self,
partition_id: u16,
from_sequence: u64,
) -> RedisFuture<'a, SubscriptionInfo> { ... }
fn hello<'a>(&'a mut self, version: u32) -> RedisFuture<'a, HelloResp> { ... }
fn ping<'a>(&'a mut self) -> RedisFuture<'a, String> { ... }
fn eack<'a>(
&'a mut self,
subscription_id: Uuid,
cursor: u64,
) -> RedisFuture<'a, String> { ... }
}Expand description
Implements common redis commands over asynchronous connections.
The return types are concrete and opinionated. If you want to choose the return type you should use the AsyncCommands trait.
Provided Methods§
Sourcefn eappend<'a, S: ToRedisArgs + Send + Sync + 'a, E: ToRedisArgs + Send + Sync + 'a>(
&'a mut self,
stream_id: S,
event_name: E,
options: EAppendOptions<'a>,
) -> RedisFuture<'a, AppendInfo>
fn eappend<'a, S: ToRedisArgs + Send + Sync + 'a, E: ToRedisArgs + Send + Sync + 'a>( &'a mut self, stream_id: S, event_name: E, options: EAppendOptions<'a>, ) -> RedisFuture<'a, AppendInfo>
Append an event to a stream.
§Parameters
stream_id: Stream identifier to append the event toevent_name: Name/type of the eventoptions: Configuration for optional parameters (event_id, partition_key, expected_version, payload, metadata)
§Example
let options = EAppendOptions::new()
.payload(br#"{"name":"john"}"#)
.metadata(br#"{"source":"api"}"#);
conn.eappend("my-stream", "UserCreated", options)?;§Returns
Returns an AppendInfo containing event metadata.
Sourcefn emappend<'a>(
&'a mut self,
partition_key: Uuid,
events: &'a [EMAppendEvent<'a>],
) -> RedisFuture<'a, MultiAppendInfo>
fn emappend<'a>( &'a mut self, partition_key: Uuid, events: &'a [EMAppendEvent<'a>], ) -> RedisFuture<'a, MultiAppendInfo>
Append multiple events to streams in a single transaction.
§Parameters
partition_key: UUID that determines which partition all events will be written toevents: Array of events to append, each with their own configuration
§Example
let events = [
EMAppendEvent::new("stream1", "EventA").payload(br#"{"data":"value1"}"#),
EMAppendEvent::new("stream2", "EventB").payload(br#"{"data":"value2"}"#),
];
conn.emappend(partition_key, &events)?;Note: All events are appended atomically in a single transaction.
§Returns
Returns transaction result information.
Sourcefn epscan_by_key<'a>(
&'a mut self,
partition_key: Uuid,
start_sequence: u64,
end_sequence: Option<u64>,
count: Option<u64>,
) -> RedisFuture<'a, EventBatch>
fn epscan_by_key<'a>( &'a mut self, partition_key: Uuid, start_sequence: u64, end_sequence: Option<u64>, count: Option<u64>, ) -> RedisFuture<'a, EventBatch>
Scan events in a partition by partition key.
§Parameters
partition_key: UUID key to determine which partition to scanstart_sequence: Starting sequence numberend_sequence: Ending sequence number (Nonemeans scan to end)count: Maximum number of events to return (defaults to 100)
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let batch = conn.epscan_by_key(partition_key, 0, Some(100), Some(50))?;§Returns
Returns an EventBatch containing events and pagination info.
Sourcefn epscan_by_id<'a>(
&'a mut self,
partition_id: u16,
start_sequence: u64,
end_sequence: Option<u64>,
count: Option<u64>,
) -> RedisFuture<'a, EventBatch>
fn epscan_by_id<'a>( &'a mut self, partition_id: u16, start_sequence: u64, end_sequence: Option<u64>, count: Option<u64>, ) -> RedisFuture<'a, EventBatch>
Scan events in a partition by partition ID.
§Parameters
partition_id: Numeric partition identifier (0-65535)start_sequence: Starting sequence numberend_sequence: Ending sequence number (Nonemeans scan to end)count: Maximum number of events to return (defaults to 100)
§Example
let batch = conn.epscan_by_id(42, 100, Some(200), Some(50))?;§Returns
Returns an EventBatch containing events and pagination info.
Sourcefn escan<'a>(
&'a mut self,
stream_id: &'a str,
start_version: u64,
end_version: Option<u64>,
count: Option<u64>,
) -> RedisFuture<'a, EventBatch>
fn escan<'a>( &'a mut self, stream_id: &'a str, start_version: u64, end_version: Option<u64>, count: Option<u64>, ) -> RedisFuture<'a, EventBatch>
Scan events in a stream by stream ID.
§Parameters
stream_id: Stream identifier to scanstart_version: Starting version numberend_version: Ending version number (Nonemeans scan to end)count: Maximum number of events to return (defaults to 100)
§Example
let events = conn.escan("my-stream", 0, Some(100), Some(50))?;§Returns
Returns events from the stream across all partitions.
Sourcefn escan_with_partition_key<'a>(
&'a mut self,
stream_id: &'a str,
partition_key: Uuid,
start_version: u64,
end_version: Option<u64>,
count: Option<u64>,
) -> RedisFuture<'a, EventBatch>
fn escan_with_partition_key<'a>( &'a mut self, stream_id: &'a str, partition_key: Uuid, start_version: u64, end_version: Option<u64>, count: Option<u64>, ) -> RedisFuture<'a, EventBatch>
Scan events in a stream by stream ID within a specific partition.
§Parameters
stream_id: Stream identifier to scanpartition_key: UUID to scan within a specific partition onlystart_version: Starting version numberend_version: Ending version number (Nonemeans scan to end)count: Maximum number of events to return (defaults to 100)
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let batch = conn.escan_with_partition_key("my-stream", partition_key, 0, Some(100), Some(50))?;§Returns
Returns an EventBatch containing events from the specified partition only.
Sourcefn epseq_by_key<'a>(
&'a mut self,
partition_key: Uuid,
) -> RedisFuture<'a, Option<u64>>
fn epseq_by_key<'a>( &'a mut self, partition_key: Uuid, ) -> RedisFuture<'a, Option<u64>>
Get the current sequence number for a partition by partition key.
§Parameters
partition_key: UUID key to determine which partition to query
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let sequence = conn.epseq_by_key(partition_key)?;§Returns
Returns the current sequence number for the partition.
Sourcefn epseq_by_id<'a>(
&'a mut self,
partition_id: u16,
) -> RedisFuture<'a, Option<u64>>
fn epseq_by_id<'a>( &'a mut self, partition_id: u16, ) -> RedisFuture<'a, Option<u64>>
Sourcefn esver_with_partition_key<'a>(
&'a mut self,
stream_id: &'a str,
partition_key: Uuid,
) -> RedisFuture<'a, Option<u64>>
fn esver_with_partition_key<'a>( &'a mut self, stream_id: &'a str, partition_key: Uuid, ) -> RedisFuture<'a, Option<u64>>
Get the current version number for a stream within a specific partition.
§Parameters
stream_id: Stream identifier to get version forpartition_key: UUID to check specific partition
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let version = conn.esver_with_partition_key("my-stream", partition_key)?;§Returns
Returns the current version number for the stream in the specified partition.
Sourcefn esub<'a, S: ToRedisArgs + Send + Sync + 'a>(
&'a mut self,
stream_id: S,
) -> RedisFuture<'a, SubscriptionInfo>
fn esub<'a, S: ToRedisArgs + Send + Sync + 'a>( &'a mut self, stream_id: S, ) -> RedisFuture<'a, SubscriptionInfo>
Sourcefn esub_with_partition_key<'a, S: ToRedisArgs + Send + Sync + 'a>(
&'a mut self,
stream_id: S,
partition_key: Uuid,
) -> RedisFuture<'a, SubscriptionInfo>
fn esub_with_partition_key<'a, S: ToRedisArgs + Send + Sync + 'a>( &'a mut self, stream_id: S, partition_key: Uuid, ) -> RedisFuture<'a, SubscriptionInfo>
Subscribe to events from a stream with partition key.
§Parameters
stream_id: Stream identifier to subscribe topartition_key: UUID to subscribe to specific partition
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let subscription = conn.esub_with_partition_key("my-stream", partition_key)?;§Returns
Returns subscription information.
Sourcefn esub_from_version<'a, S: ToRedisArgs + Send + Sync + 'a>(
&'a mut self,
stream_id: S,
from_version: u64,
) -> RedisFuture<'a, SubscriptionInfo>
fn esub_from_version<'a, S: ToRedisArgs + Send + Sync + 'a>( &'a mut self, stream_id: S, from_version: u64, ) -> RedisFuture<'a, SubscriptionInfo>
Sourcefn esub_with_partition_and_version<'a, S: ToRedisArgs + Send + Sync + 'a>(
&'a mut self,
stream_id: S,
partition_key: Uuid,
from_version: u64,
) -> RedisFuture<'a, SubscriptionInfo>
fn esub_with_partition_and_version<'a, S: ToRedisArgs + Send + Sync + 'a>( &'a mut self, stream_id: S, partition_key: Uuid, from_version: u64, ) -> RedisFuture<'a, SubscriptionInfo>
Subscribe to events from a stream with partition key and version.
§Parameters
stream_id: Stream identifier to subscribe topartition_key: UUID to subscribe to specific partitionfrom_version: Starting version number
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let subscription = conn.esub_with_partition_and_version("my-stream", partition_key, 100)?;§Returns
Returns subscription information.
Sourcefn epsub_by_key<'a>(
&'a mut self,
partition_key: Uuid,
) -> RedisFuture<'a, SubscriptionInfo>
fn epsub_by_key<'a>( &'a mut self, partition_key: Uuid, ) -> RedisFuture<'a, SubscriptionInfo>
Subscribe to events from a partition by partition key.
§Parameters
partition_key: UUID key to determine which partition to subscribe to
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let subscription = conn.epsub_by_key(partition_key)?;§Returns
Returns subscription information.
Sourcefn epsub_by_id<'a>(
&'a mut self,
partition_id: u16,
) -> RedisFuture<'a, SubscriptionInfo>
fn epsub_by_id<'a>( &'a mut self, partition_id: u16, ) -> RedisFuture<'a, SubscriptionInfo>
Sourcefn epsub_by_key_from_sequence<'a>(
&'a mut self,
partition_key: Uuid,
from_sequence: u64,
) -> RedisFuture<'a, SubscriptionInfo>
fn epsub_by_key_from_sequence<'a>( &'a mut self, partition_key: Uuid, from_sequence: u64, ) -> RedisFuture<'a, SubscriptionInfo>
Subscribe to events from a partition by partition key, starting from a specific sequence.
§Parameters
partition_key: UUID key to determine which partition to subscribe tofrom_sequence: Start streaming from this sequence number
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let subscription = conn.epsub_by_key_from_sequence(partition_key, 1000)?;§Returns
Returns subscription information.
Sourcefn epsub_by_id_from_sequence<'a>(
&'a mut self,
partition_id: u16,
from_sequence: u64,
) -> RedisFuture<'a, SubscriptionInfo>
fn epsub_by_id_from_sequence<'a>( &'a mut self, partition_id: u16, from_sequence: u64, ) -> RedisFuture<'a, SubscriptionInfo>
Subscribe to events from a partition by partition ID, starting from a specific sequence.
§Parameters
partition_id: Numeric partition identifier (0-65535)from_sequence: Start streaming from this sequence number
§Example
let subscription = conn.epsub_by_id_from_sequence(42, 1000)?;§Returns
Returns subscription information.
Sourcefn hello<'a>(&'a mut self, version: u32) -> RedisFuture<'a, HelloResp>
fn hello<'a>(&'a mut self, version: u32) -> RedisFuture<'a, HelloResp>
Sourcefn ping<'a>(&'a mut self) -> RedisFuture<'a, String>
fn ping<'a>(&'a mut self) -> RedisFuture<'a, String>
Sourcefn eack<'a>(
&'a mut self,
subscription_id: Uuid,
cursor: u64,
) -> RedisFuture<'a, String>
fn eack<'a>( &'a mut self, subscription_id: Uuid, cursor: u64, ) -> RedisFuture<'a, String>
Acknowledge events up to a specific cursor for a subscription.
§Parameters
subscription_id: UUID of the subscriptioncursor: Cursor number to acknowledge up to
§Example
let subscription_id = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
conn.eack(subscription_id, 100)?;§Returns
Returns “OK” on success.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl<T> AsyncTypedCommands for T
aio only.