Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add builder interface for making servers #1122

Merged
merged 22 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1

jobs:
check-style:
Expand Down
48 changes: 48 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,54 @@

https://github.com/oxidecomputer/dropshot/compare/v0.12.0\...HEAD[Full list of commits]

* https://github.com/oxidecomputer/dropshot/pull/1122[#1122] Adds a new `ServerBuilder` as the primary way of constructing a Dropshot server. This replaces `HttpServerStarter::new()` and `HttpServerStarter::new_with_tls()`. These older functions still exist for compatibility. They may be removed in an upcoming release, along with the `HttpServerStarter`.
+
In this release, using the builder interface is not very different from using these older functions. But as we look at adding new construction-time options (e.g., for API versioning), those will only be added to the builder.
+
The builder also provides structured errors rather than the `GenericError` provided by these older functions.
+
Most non-TLS callers were using `HttpServerStarter::new()` and then calling `start()` right away. In that case, you can replace:
+
```rust
HttpServerStarter::new(&config, api, private, &log).map_err(...)?.start()
```
+
with:
+
```rust
ServerBuilder::new(api, private, log).config(config).start().map_err(...)?
```
+
If you were using `HttpServerStarter::new_with_tls()`, you'd similarly replace:
+
```rust
HttpServerStarter::new_with_tls(&config, api, private, &log, tls).map_err(...)?.start()
```
+
with:
+
```rust
ServerBuilder::new(api, private, log).config(config).tls(tls).start().map_err(...)?
```
+
If you were _not_ invoking `start()` immediately before, you can still construct an intermediate starter object with `build_starter()`. If you were doing this:
+
```rust
let starter = HttpServerStarter::new(&config, api, private, &log).map_err(...)?;
...
starter.start()
```
+
Then you can now do:
+
```rust
let starter = ServerBuilder::new(api, private, log).config(config).build_starter().map_err(...)?;
...
starter.start()
```
+
We'd like to remove the `HttpServerStarter` altogether, so let us know if you're still using it for some reason.

== 0.12.0 (released 2024-09-26)

https://github.com/oxidecomputer/dropshot/compare/v0.11.0\...v0.12.0[Full list of commits]
Expand Down
Loading