-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c5d333
commit 6f8fd93
Showing
6 changed files
with
151 additions
and
23 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ s2 = { git = "ssh://[email protected]/s2-streamstore/s2.rs.git", branch = "main" } | |
tokio = { version = "*", features = ["full"] } | ||
humantime = "2.1.0" | ||
miette = { version = "7.2.0", features = ["fancy"] } | ||
color-print = "0.3.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use s2::{ | ||
client::BasinClient, | ||
service_error::{ListStreamsError, ServiceError}, | ||
types::ListStreamsResponse, | ||
}; | ||
|
||
pub struct BasinService { | ||
client: BasinClient, | ||
} | ||
|
||
#[derive(Debug, thiserror::Error)] | ||
pub enum BasinServiceError { | ||
#[error("Failed to list streams: {0}")] | ||
ListStreams(#[from] ServiceError<ListStreamsError>), | ||
} | ||
|
||
impl BasinService { | ||
pub fn new(client: BasinClient) -> Self { | ||
Self { client } | ||
} | ||
|
||
pub async fn list_streams( | ||
&self, | ||
prefix: String, | ||
start_after: String, | ||
limit: usize, | ||
) -> Result<ListStreamsResponse, BasinServiceError> { | ||
let list_streams_req = s2::types::ListStreamsRequest::builder() | ||
.prefix(prefix) | ||
.start_after(start_after) | ||
.limit(limit) | ||
.build(); | ||
|
||
self.client | ||
.list_streams(list_streams_req) | ||
.await | ||
.map_err(BasinServiceError::ListStreams) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters