From b1547bcd55a4f3b5b76104a6ffd374014671d617 Mon Sep 17 00:00:00 2001 From: Stephen Balogh Date: Thu, 5 Dec 2024 15:33:36 -0800 Subject: [PATCH] chore: update proto and associated types for non-optional `start_seq_num` (#97) --- proto | 2 +- src/client.rs | 2 +- src/service/stream.rs | 2 +- src/types.rs | 24 ++++++++---------------- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/proto b/proto index 15780ff..bba10bc 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 15780ff233532f66a82e43e952ec9354ac5dd79c +Subproject commit bba10bc43dc34aac3b098437e41f6eb20bc949e0 diff --git a/src/client.rs b/src/client.rs index c96ed78..114262b 100644 --- a/src/client.rs +++ b/src/client.rs @@ -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; diff --git a/src/service/stream.rs b/src/service/stream.rs index c19027c..fda8e33 100644 --- a/src/service/stream.rs +++ b/src/service/stream.rs @@ -122,7 +122,7 @@ impl ReadSessionServiceRequest { } } - pub fn set_start_seq_num(&mut self, start_seq_num: Option) { + pub fn set_start_seq_num(&mut self, start_seq_num: u64) { self.req.start_seq_num = start_seq_num; } } diff --git a/src/types.rs b/src/types.rs index 5e817b6..c0ee1fe 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1361,19 +1361,15 @@ pub struct ReadLimit { #[sync_docs] #[derive(Debug, Clone, Default)] pub struct ReadRequest { - pub start_seq_num: Option, + pub start_seq_num: u64, pub limit: Option, } impl ReadRequest { - pub fn new() -> Self { - Self::default() - } - - pub fn with_start_seq_num(self, start_seq_num: impl Into) -> Self { + pub fn new(start_seq_num: u64) -> Self { Self { - start_seq_num: Some(start_seq_num.into()), - ..self + start_seq_num, + ..Default::default() } } @@ -1532,19 +1528,15 @@ impl TryFrom for ReadOutput { #[sync_docs] #[derive(Debug, Clone, Default)] pub struct ReadSessionRequest { - pub start_seq_num: Option, + pub start_seq_num: u64, pub limit: Option, } impl ReadSessionRequest { - pub fn new() -> Self { - Self::default() - } - - pub fn with_start_seq_num(self, start_seq_num: impl Into) -> Self { + pub fn new(start_seq_num: u64) -> Self { Self { - start_seq_num: Some(start_seq_num.into()), - ..self + start_seq_num, + ..Default::default() } }