Skip to main content

CmdExt

Trait CmdExt 

Source
pub trait CmdExt {
Show 22 methods // Required methods fn eappend<'a, S: ToRedisArgs, E: ToRedisArgs>( stream_id: S, event_name: E, options: EAppendOptions<'a>, ) -> Self; fn emappend<'a>( partition_key: Uuid, events: &'a [EMAppendEvent<'a>], ) -> Self; fn eget<'a>(event_id: Uuid) -> Self; fn epscan_by_key<'a>( partition_key: Uuid, start_sequence: u64, end_sequence: Option<u64>, count: Option<u64>, ) -> Self; fn epscan_by_id<'a>( partition_id: u16, start_sequence: u64, end_sequence: Option<u64>, count: Option<u64>, ) -> Self; fn escan<'a>( stream_id: &'a str, start_version: u64, end_version: Option<u64>, count: Option<u64>, ) -> Self; fn escan_with_partition_key<'a>( stream_id: &'a str, partition_key: Uuid, start_version: u64, end_version: Option<u64>, count: Option<u64>, ) -> Self; fn epseq_by_key<'a>(partition_key: Uuid) -> Self; fn epseq_by_id<'a>(partition_id: u16) -> Self; fn esver<'a>(stream_id: &'a str) -> Self; fn esver_with_partition_key<'a>( stream_id: &'a str, partition_key: Uuid, ) -> Self; fn esub<'a, S: ToRedisArgs>(stream_id: S) -> Self; fn esub_with_partition_key<'a, S: ToRedisArgs>( stream_id: S, partition_key: Uuid, ) -> Self; fn esub_from_version<'a, S: ToRedisArgs>( stream_id: S, from_version: u64, ) -> Self; fn esub_with_partition_and_version<'a, S: ToRedisArgs>( stream_id: S, partition_key: Uuid, from_version: u64, ) -> Self; fn epsub_by_key<'a>(partition_key: Uuid) -> Self; fn epsub_by_id<'a>(partition_id: u16) -> Self; fn epsub_by_key_from_sequence<'a>( partition_key: Uuid, from_sequence: u64, ) -> Self; fn epsub_by_id_from_sequence<'a>( partition_id: u16, from_sequence: u64, ) -> Self; fn hello<'a>(version: u32) -> Self; fn ping<'a>() -> Self; fn eack<'a>(subscription_id: Uuid, cursor: u64) -> Self;
}

Required Methods§

Source

fn eappend<'a, S: ToRedisArgs, E: ToRedisArgs>( stream_id: S, event_name: E, options: EAppendOptions<'a>, ) -> Self

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>(partition_key: Uuid, events: &'a [EMAppendEvent<'a>]) -> Self

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>(event_id: Uuid) -> Self

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>( partition_key: Uuid, start_sequence: u64, end_sequence: Option<u64>, count: Option<u64>, ) -> Self

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>( partition_id: u16, start_sequence: u64, end_sequence: Option<u64>, count: Option<u64>, ) -> Self

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>( stream_id: &'a str, start_version: u64, end_version: Option<u64>, count: Option<u64>, ) -> Self

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>( stream_id: &'a str, partition_key: Uuid, start_version: u64, end_version: Option<u64>, count: Option<u64>, ) -> Self

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>(partition_key: Uuid) -> Self

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>(partition_id: u16) -> Self

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>(stream_id: &'a str) -> Self

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>(stream_id: &'a str, partition_key: Uuid) -> Self

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>(stream_id: S) -> Self

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>( stream_id: S, partition_key: Uuid, ) -> Self

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>( stream_id: S, from_version: u64, ) -> Self

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>( stream_id: S, partition_key: Uuid, from_version: u64, ) -> Self

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>(partition_key: Uuid) -> Self

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>(partition_id: u16) -> Self

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>( partition_key: Uuid, from_sequence: u64, ) -> Self

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>(partition_id: u16, from_sequence: u64) -> Self

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>(version: u32) -> Self

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>() -> Self

Health check command.

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

Returns “PONG” string.

Source

fn eack<'a>(subscription_id: Uuid, cursor: u64) -> Self

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.

Implementations on Foreign Types§

Source§

impl CmdExt for Cmd

Source§

fn eappend<'a, S: ToRedisArgs, E: ToRedisArgs>( stream_id: S, event_name: E, options: EAppendOptions<'a>, ) -> Self

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>(partition_key: Uuid, events: &'a [EMAppendEvent<'a>]) -> Self

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>(event_id: Uuid) -> Self

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>( partition_key: Uuid, start_sequence: u64, end_sequence: Option<u64>, count: Option<u64>, ) -> Self

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>( partition_id: u16, start_sequence: u64, end_sequence: Option<u64>, count: Option<u64>, ) -> Self

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>( stream_id: &'a str, start_version: u64, end_version: Option<u64>, count: Option<u64>, ) -> Self

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>( stream_id: &'a str, partition_key: Uuid, start_version: u64, end_version: Option<u64>, count: Option<u64>, ) -> Self

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>(partition_key: Uuid) -> Self

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>(partition_id: u16) -> Self

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>(stream_id: &'a str) -> Self

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>(stream_id: &'a str, partition_key: Uuid) -> Self

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>(stream_id: S) -> Self

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>( stream_id: S, partition_key: Uuid, ) -> Self

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>( stream_id: S, from_version: u64, ) -> Self

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>( stream_id: S, partition_key: Uuid, from_version: u64, ) -> Self

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>(partition_key: Uuid) -> Self

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>(partition_id: u16) -> Self

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>( partition_key: Uuid, from_sequence: u64, ) -> Self

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>(partition_id: u16, from_sequence: u64) -> Self

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>(version: u32) -> Self

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>() -> Self

Health check command.

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

Returns “PONG” string.

Source§

fn eack<'a>(subscription_id: Uuid, cursor: u64) -> Self

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.

Implementors§