Skip to content

Commit

Permalink
chore: update proto and associated types for non-optional `start_seq_…
Browse files Browse the repository at this point in the history
…num` (#97)
  • Loading branch information
sgbalogh authored Dec 5, 2024
1 parent 924594f commit b1547bc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion proto
Submodule proto updated 1 files
+4 −4 s2/v1alpha/s2.proto
2 changes: 1 addition & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ fn read_resumption_stream(
}
if let Ok(types::ReadOutput::Batch(types::SequencedRecordBatch { records })) = &item {
if let Some(record) = records.last() {
request.set_start_seq_num(Some(record.seq_num + 1));
request.set_start_seq_num(record.seq_num + 1);
}
}
yield item;
Expand Down
2 changes: 1 addition & 1 deletion src/service/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl ReadSessionServiceRequest {
}
}

pub fn set_start_seq_num(&mut self, start_seq_num: Option<u64>) {
pub fn set_start_seq_num(&mut self, start_seq_num: u64) {
self.req.start_seq_num = start_seq_num;
}
}
Expand Down
24 changes: 8 additions & 16 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1361,19 +1361,15 @@ pub struct ReadLimit {
#[sync_docs]
#[derive(Debug, Clone, Default)]
pub struct ReadRequest {
pub start_seq_num: Option<u64>,
pub start_seq_num: u64,
pub limit: Option<ReadLimit>,
}

impl ReadRequest {
pub fn new() -> Self {
Self::default()
}

pub fn with_start_seq_num(self, start_seq_num: impl Into<u64>) -> Self {
pub fn new(start_seq_num: u64) -> Self {
Self {
start_seq_num: Some(start_seq_num.into()),
..self
start_seq_num,
..Default::default()
}
}

Expand Down Expand Up @@ -1532,19 +1528,15 @@ impl TryFrom<api::ReadResponse> for ReadOutput {
#[sync_docs]
#[derive(Debug, Clone, Default)]
pub struct ReadSessionRequest {
pub start_seq_num: Option<u64>,
pub start_seq_num: u64,
pub limit: Option<ReadLimit>,
}

impl ReadSessionRequest {
pub fn new() -> Self {
Self::default()
}

pub fn with_start_seq_num(self, start_seq_num: impl Into<u64>) -> Self {
pub fn new(start_seq_num: u64) -> Self {
Self {
start_seq_num: Some(start_seq_num.into()),
..self
start_seq_num,
..Default::default()
}
}

Expand Down

0 comments on commit b1547bc

Please sign in to comment.