pub struct ReadSessionRequest {
pub start: ReadStart,
pub limit: ReadLimit,
pub until: Option<RangeTo<u64>>,
pub clamp: bool,
}s2-sdk. Please update your Cargo.toml to use s2-sdk instead.Expand description
Read session request.
Fieldsยง
ยงstart: ReadStarts2-sdk. Please update your Cargo.toml to use s2-sdk instead.Starting position for records. Retrieved batches will start at the first record whose position is greater than or equal to it.
limit: ReadLimits2-sdk. Please update your Cargo.toml to use s2-sdk instead.Limit on how many records can be returned. When a limit is specified, the session will be terminated as soon as the limit is met, or when the current tail of the stream is reached โ whichever occurs first. If no limit is specified, the session will remain open after catching up to the tail, and continue tailing as new messages are written to the stream.
until: Option<RangeTo<u64>>s2-sdk. Please update your Cargo.toml to use s2-sdk instead.Exclusive timestamp to read until.
If provided, this is applied as an additional constraint on top of the limit,
and will guarantee that all records returned have timestamps < the provided until.
clamp: bools2-sdk. Please update your Cargo.toml to use s2-sdk instead.Clamp the start position at the tail position.
Implementationsยง
Sourceยงimpl ReadSessionRequest
impl ReadSessionRequest
Sourcepub fn new(start: ReadStart) -> Self
๐Deprecated since 0.21.1: This crate has been renamed to s2-sdk. Please update your Cargo.toml to use s2-sdk instead.
pub fn new(start: ReadStart) -> Self
s2-sdk. Please update your Cargo.toml to use s2-sdk instead.Create a new request with the specified starting point.
Examples found in repository?
9async fn main() -> Result<(), Box<dyn std::error::Error>> {
10 let token = std::env::var("S2_ACCESS_TOKEN")?;
11 let config = ClientConfig::new(token);
12 let basin: BasinName = "my-favorite-basin".parse()?;
13 let stream = "my-favorite-stream";
14 let stream_client = StreamClient::new(config, basin, stream);
15
16 let start_seq_num = 0;
17 let read_session_request = ReadSessionRequest::new(ReadStart::SeqNum(start_seq_num));
18 let mut read_stream = stream_client.read_session(read_session_request).await?;
19
20 loop {
21 select! {
22 next_batch = read_stream.next() => {
23 let Some(next_batch) = next_batch else { break };
24 let next_batch = next_batch?;
25 println!("{next_batch:?}");
26 }
27 _ = tokio::signal::ctrl_c() => break,
28 }
29 }
30
31 Ok(())
32}Sourcepub fn with_limit(self, limit: ReadLimit) -> Self
๐Deprecated since 0.21.1: This crate has been renamed to s2-sdk. Please update your Cargo.toml to use s2-sdk instead.
pub fn with_limit(self, limit: ReadLimit) -> Self
s2-sdk. Please update your Cargo.toml to use s2-sdk instead.Overwrite limit.
Sourcepub fn with_until(self, until: RangeTo<u64>) -> Self
๐Deprecated since 0.21.1: This crate has been renamed to s2-sdk. Please update your Cargo.toml to use s2-sdk instead.
pub fn with_until(self, until: RangeTo<u64>) -> Self
s2-sdk. Please update your Cargo.toml to use s2-sdk instead.Provide an until timestamp.
Sourcepub fn with_clamp(self, clamp: bool) -> Self
๐Deprecated since 0.21.1: This crate has been renamed to s2-sdk. Please update your Cargo.toml to use s2-sdk instead.
pub fn with_clamp(self, clamp: bool) -> Self
s2-sdk. Please update your Cargo.toml to use s2-sdk instead.Clamp the start position at the tail position.
Trait Implementationsยง
Sourceยงimpl Clone for ReadSessionRequest
impl Clone for ReadSessionRequest
Sourceยงfn clone(&self) -> ReadSessionRequest
fn clone(&self) -> ReadSessionRequest
1.0.0 ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSourceยงimpl Debug for ReadSessionRequest
impl Debug for ReadSessionRequest
Sourceยงimpl Default for ReadSessionRequest
impl Default for ReadSessionRequest
Sourceยงfn default() -> ReadSessionRequest
fn default() -> ReadSessionRequest
Auto Trait Implementationsยง
impl Freeze for ReadSessionRequest
impl RefUnwindSafe for ReadSessionRequest
impl Send for ReadSessionRequest
impl Sync for ReadSessionRequest
impl Unpin for ReadSessionRequest
impl UnwindSafe for ReadSessionRequest
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
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Sourceยงfn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request