Skip to content

Commit

Permalink
feat: Support s2:// URIs (#74)
Browse files Browse the repository at this point in the history
```
❯ s2 ls s2://vr-basin/pingtest
pingtest/express 2024-12-09T19:01:46Z
pingtest/standard 2024-12-09T19:02:18Z

❯ s2 list-streams --prefix 'pingtest/' vr-basin
pingtest/express 2024-12-09T19:01:46Z
pingtest/standard 2024-12-09T19:02:18Z

❯ s2 rm s2://vr-basin/pingtest/standard
✓ Stream deletion requested

❯ s2 get-basin-config s2://vr-basin
{
  "default_stream_config": null
}
```

Resolves: #73

---------

Signed-off-by: Vaibhav Rabber <[email protected]>
  • Loading branch information
vrongmeal authored Dec 13, 2024
1 parent 1db38a3 commit 0a50429
Show file tree
Hide file tree
Showing 6 changed files with 273 additions and 98 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ jobs:
- name: Failed
run: exit 1
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: install rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy
- name: install protoc
uses: arduino/setup-protoc@v3
- uses: Swatinem/rust-cache@v2
- name: Run cargo tests
run: cargo test
lint:
runs-on: ubuntu-latest
steps:
Expand Down
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ colored = "2.1.0"
config = "0.14.1"
dirs = "5.0.1"
futures = "0.3.31"
http = "1.2.0"
humantime = "2.1.0"
miette = { version = "7.2.0", features = ["fancy"] }
pin-project-lite = "0.2"
pin-utils = "0.1.0"
rand = "0.8.5"
serde = { version = "1.0.214", features = ["derive"] }
serde_json = "1.0.132"
streamstore = "0.3.0"
streamstore = "0.3.1"
thiserror = "2.0.6"
tokio = { version = "1.41.1", features = ["full"] }
tokio-stream = { version = "0.1.16", features = ["io-util"] }
toml = "0.8.19"
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }

17 changes: 14 additions & 3 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ pub enum S2CliError {
#[diagnostic(transparent)]
Config(#[from] S2ConfigError),

#[error(transparent)]
#[diagnostic(help("Are you trying to operate on an invalid basin?"))]
ConvertError(#[from] ConvertError),
#[error("Invalid CLI arguments: {0}")]
#[diagnostic(transparent)]
InvalidArgs(miette::Report),

#[error("Unable to load S2 endpoints from environment")]
#[diagnostic(help(
Expand Down Expand Up @@ -133,3 +133,14 @@ impl ServiceError {
}
}
}

#[derive(Debug, Error, Diagnostic)]
pub enum BasinNameOrUriParseError {
#[error(transparent)]
#[diagnostic(help("Are you trying to operate on an invalid basin?"))]
BasinName(#[from] ConvertError),

#[error("Invalid S2 URI: {0}")]
#[diagnostic(transparent)]
InvalidUri(miette::Report),
}
Loading

0 comments on commit 0a50429

Please sign in to comment.