Skip to main content

AsyncTypedCommands

Trait AsyncTypedCommands 

Source
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§

Source

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 to
  • event_name: Name/type of the event
  • options: 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.

Source

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 to
  • events: 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.

Source

fn eget<'a>(&'a mut self, event_id: Uuid) -> RedisFuture<'a, Option<Event>>

Get an event by its unique identifier.

§Parameters
  • event_id: UUID of the event to retrieve
§Example
let event_id = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let event = conn.eget(event_id)?;
§Returns

Returns Some(Event) if found, None if the event doesn’t exist.

Source

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 scan
  • start_sequence: Starting sequence number
  • end_sequence: Ending sequence number (None means 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.

Source

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 number
  • end_sequence: Ending sequence number (None means 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.

Source

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 scan
  • start_version: Starting version number
  • end_version: Ending version number (None means 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.

Source

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 scan
  • partition_key: UUID to scan within a specific partition only
  • start_version: Starting version number
  • end_version: Ending version number (None means 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.

Source

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.

Source

fn epseq_by_id<'a>( &'a mut self, partition_id: u16, ) -> RedisFuture<'a, Option<u64>>

Get the current sequence number for a partition by partition ID.

§Parameters
  • partition_id: Numeric partition identifier (0-65535)
§Example
let sequence = conn.epseq_by_id(42)?;
§Returns

Returns the current sequence number for the partition.

Source

fn esver<'a>(&'a mut self, stream_id: &'a str) -> RedisFuture<'a, Option<u64>>

Get the current version number for a stream.

§Parameters
  • stream_id: Stream identifier to get version for
§Example
let version = conn.esver("my-stream")?;
§Returns

Returns the current version number for the stream.

Source

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 for
  • partition_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.

Source

fn esub<'a, S: ToRedisArgs + Send + Sync + 'a>( &'a mut self, stream_id: S, ) -> RedisFuture<'a, SubscriptionInfo>

Subscribe to events from a stream.

§Parameters
  • stream_id: Stream identifier to subscribe to
§Example
let subscription = conn.esub("my-stream")?;
§Returns

Returns subscription information.

Note: Establishes a persistent connection to receive real-time stream events.

Source

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 to
  • partition_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.

Source

fn esub_from_version<'a, S: ToRedisArgs + Send + Sync + 'a>( &'a mut self, stream_id: S, from_version: u64, ) -> RedisFuture<'a, SubscriptionInfo>

Subscribe to events from a stream starting from a specific version.

§Parameters
  • stream_id: Stream identifier to subscribe to
  • from_version: Start streaming from this version number
§Example
let subscription = conn.esub_from_version("my-stream", 100)?;
§Returns

Returns subscription information.

Source

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 to
  • partition_key: UUID to subscribe to specific partition
  • from_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.

Source

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.

Source

fn epsub_by_id<'a>( &'a mut self, partition_id: u16, ) -> RedisFuture<'a, SubscriptionInfo>

Subscribe to events from a partition by partition ID.

§Parameters
  • partition_id: Numeric partition identifier (0-65535)
§Example
let subscription = conn.epsub_by_id(42)?;
§Returns

Returns subscription information.

Source

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 to
  • from_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.

Source

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.

Source

fn hello<'a>(&'a mut self, version: u32) -> RedisFuture<'a, HelloResp>

Handshake with the SierraDB server.

§Parameters
  • version: Protocol version (must be 3)
§Example
let server_info = conn.hello(3)?;
§Returns

Returns server information including name, version, peer_id, and num_partitions.

Source

fn ping<'a>(&'a mut self) -> RedisFuture<'a, String>

Health check command.

§Example
let response = conn.ping()?;
§Returns

Returns “PONG” string.

Source

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 subscription
  • cursor: 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§

Source§

impl<T> AsyncTypedCommands for T
where T: ConnectionLike + Send + Sync + Sized,

Available on crate feature aio only.