pub trait StreamModel: Sized + Send {
type Data: ToRedisArgs + FromRedisValue + Sync;
Show 14 methods
// Required methods
fn stream_key() -> &'static str;
fn group_name(&self) -> &str;
fn consumer_name(&self) -> &str;
// Provided methods
fn publish<'life0, 'life1, 'async_trait, C>(
data: &'life0 Self::Data,
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<String>> + Send + 'async_trait>>
where C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn ensure_group_stream<'life0, 'life1, 'async_trait, C>(
&'life0 self,
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>
where C: 'async_trait + ConnectionLike + Send,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn read<'life0, 'life1, 'async_trait, C>(
&'life0 self,
read_count: Option<usize>,
block_interval: Option<usize>,
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>
where C: 'async_trait + ConnectionLike + Send,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn read_no_group<'life0, 'async_trait, C>(
id: impl 'async_trait + AsRef<str> + Send,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>
where C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait { ... }
fn autoclaim<'life0, 'async_trait, C>(
group: impl 'async_trait + AsRef<str> + Send,
consumer: impl 'async_trait + AsRef<str> + Send,
min_idle_time: usize,
last_autocalim_id: impl 'async_trait + AsRef<str> + Send,
read_count: Option<usize>,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<(String, Vec<Message>)>> + Send + 'async_trait>>
where C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait { ... }
fn ack<'life0, 'life1, 'async_trait, C, I>(
group: impl 'async_trait + ToRedisArgs + Send,
ids: &'life0 [I],
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>
where C: 'async_trait + ConnectionLike + Send,
I: 'async_trait + ToRedisArgs + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn len<'life0, 'async_trait, C>(
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<usize>> + Send + 'async_trait>>
where C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait { ... }
fn trim<'life0, 'async_trait, C>(
maxlen: StreamMaxlen,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>
where C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait { ... }
fn range_count<'life0, 'async_trait, C, S, E, N>(
start: S,
end: E,
count: N,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>
where C: 'async_trait + ConnectionLike + Send,
S: 'async_trait + ToRedisArgs + Send,
E: 'async_trait + ToRedisArgs + Send,
N: 'async_trait + ToRedisArgs + Send,
Self: 'async_trait,
'life0: 'async_trait { ... }
fn range<'life0, 'async_trait, C, S, E>(
start: S,
end: E,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>
where C: 'async_trait + ConnectionLike + Send,
S: 'async_trait + ToRedisArgs + Send,
E: 'async_trait + ToRedisArgs + Send,
Self: 'async_trait,
'life0: 'async_trait { ... }
fn range_all<'life0, 'async_trait, C>(
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>
where C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
Stream Model for consuming and subscribing to redis stream data type
Required Associated Types§
Sourcetype Data: ToRedisArgs + FromRedisValue + Sync
type Data: ToRedisArgs + FromRedisValue + Sync
Data that will published and consumed from the stream
Required Methods§
Sourcefn stream_key() -> &'static str
fn stream_key() -> &'static str
Redis Stream Key
Sourcefn group_name(&self) -> &str
fn group_name(&self) -> &str
Group Name
Sourcefn consumer_name(&self) -> &str
fn consumer_name(&self) -> &str
Consumer Name
Provided Methods§
Sourcefn publish<'life0, 'life1, 'async_trait, C>(
data: &'life0 Self::Data,
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<String>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn publish<'life0, 'life1, 'async_trait, C>(
data: &'life0 Self::Data,
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<String>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Publish self to stream, returning event id
Sourcefn ensure_group_stream<'life0, 'life1, 'async_trait, C>(
&'life0 self,
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ensure_group_stream<'life0, 'life1, 'async_trait, C>(
&'life0 self,
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Ensure group stream exists for Self::stream_key
, creates a new if it doesn’t exists.
Errors if it fails to ensure stream
Sourcefn read<'life0, 'life1, 'async_trait, C>(
&'life0 self,
read_count: Option<usize>,
block_interval: Option<usize>,
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait, C>(
&'life0 self,
read_count: Option<usize>,
block_interval: Option<usize>,
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read from Self::stream_key
with group name and consumer name.
Sourcefn read_no_group<'life0, 'async_trait, C>(
id: impl 'async_trait + AsRef<str> + Send,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait,
fn read_no_group<'life0, 'async_trait, C>(
id: impl 'async_trait + AsRef<str> + Send,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait,
Abstraction with default options and without a group.
Sourcefn autoclaim<'life0, 'async_trait, C>(
group: impl 'async_trait + AsRef<str> + Send,
consumer: impl 'async_trait + AsRef<str> + Send,
min_idle_time: usize,
last_autocalim_id: impl 'async_trait + AsRef<str> + Send,
read_count: Option<usize>,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<(String, Vec<Message>)>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait,
fn autoclaim<'life0, 'async_trait, C>(
group: impl 'async_trait + AsRef<str> + Send,
consumer: impl 'async_trait + AsRef<str> + Send,
min_idle_time: usize,
last_autocalim_id: impl 'async_trait + AsRef<str> + Send,
read_count: Option<usize>,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<(String, Vec<Message>)>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait,
Autoclaim an event and return a stream of messages found during the autoclaim.
Sourcefn ack<'life0, 'life1, 'async_trait, C, I>(
group: impl 'async_trait + ToRedisArgs + Send,
ids: &'life0 [I],
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
I: 'async_trait + ToRedisArgs + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ack<'life0, 'life1, 'async_trait, C, I>(
group: impl 'async_trait + ToRedisArgs + Send,
ids: &'life0 [I],
conn: &'life1 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
I: 'async_trait + ToRedisArgs + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Acknowledge a given list of ids for group
Sourcefn len<'life0, 'async_trait, C>(
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<usize>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait,
fn len<'life0, 'async_trait, C>(
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<usize>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait,
Return the length of the stream
Sourcefn trim<'life0, 'async_trait, C>(
maxlen: StreamMaxlen,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait,
fn trim<'life0, 'async_trait, C>(
maxlen: StreamMaxlen,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait,
Trim a stream to a MAXLEN count.
Sourcefn range_count<'life0, 'async_trait, C, S, E, N>(
start: S,
end: E,
count: N,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
S: 'async_trait + ToRedisArgs + Send,
E: 'async_trait + ToRedisArgs + Send,
N: 'async_trait + ToRedisArgs + Send,
Self: 'async_trait,
'life0: 'async_trait,
fn range_count<'life0, 'async_trait, C, S, E, N>(
start: S,
end: E,
count: N,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
S: 'async_trait + ToRedisArgs + Send,
E: 'async_trait + ToRedisArgs + Send,
N: 'async_trait + ToRedisArgs + Send,
Self: 'async_trait,
'life0: 'async_trait,
Returns a range of messages.
Set start
to -
to begin at the first message.
Set end
to +
to end the most recent message.
You can pass message id
to both start
and end
.
Sourcefn range<'life0, 'async_trait, C, S, E>(
start: S,
end: E,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
S: 'async_trait + ToRedisArgs + Send,
E: 'async_trait + ToRedisArgs + Send,
Self: 'async_trait,
'life0: 'async_trait,
fn range<'life0, 'async_trait, C, S, E>(
start: S,
end: E,
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
S: 'async_trait + ToRedisArgs + Send,
E: 'async_trait + ToRedisArgs + Send,
Self: 'async_trait,
'life0: 'async_trait,
A method for paginating the stream
Sourcefn range_all<'life0, 'async_trait, C>(
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait,
fn range_all<'life0, 'async_trait, C>(
conn: &'life0 mut C,
) -> Pin<Box<dyn Future<Output = RedisResult<Vec<Message>>> + Send + 'async_trait>>where
C: 'async_trait + ConnectionLike + Send,
Self: 'async_trait,
'life0: 'async_trait,
A helper method for automatically returning all messages in a stream by key
.
Use with caution!
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.