NoahKusaba opened a new pull request, #3286:
URL: https://github.com/apache/iceberg-rust/pull/3286
## Which issue does this PR close?
- Closes #3285.
## What changes are included in this PR?
Adds `with_runtime` to the loader's `BoxedCatalogBuilder`, so a catalog
built through `iceberg-catalog-loader` can be given the `Runtime` it and its
tables spawn their work on. It forwards to `CatalogBuilder::with_runtime`, the
same way `with_storage_factory` and `with_kms_client_factory` are forwarded
(the latter added in #2650):
```rust
let catalog = iceberg_catalog_loader::load("rest")?
.with_runtime(runtime)
.load("rest".to_string(), props)
.await?;
```
Every builder in the loader's registry already implements
`CatalogBuilder::with_runtime`, so no catalog changes. Without a call to
`with_runtime`, behaviour is unchanged: each builder falls back to
`Runtime::current()`.
Like the addition of `with_kms_client_factory`, this adds a required method
to the public `BoxedCatalogBuilder` trait. Types implementing `CatalogBuilder`
get it through the blanket impl; only a type implementing `BoxedCatalogBuilder`
directly would need to add it. `public-api.txt` is regenerated with `make
generate-public-api`, and its diff is exactly the two new methods.
`CatalogLoader`, which has no builder methods today (not even
`with_storage_factory`), is left as it is.
## Are these changes tested?
`test_with_runtime_reaches_the_catalog_builder` puts a `CatalogBuilder` that
records the runtime it receives behind a `Box<dyn BoxedCatalogBuilder>`, calls
`with_runtime` with a runtime built on a tokio runtime whose threads are named,
and loads the catalog. It then spawns a task on the recorded runtime and
asserts it runs on one of those named threads, so the test fails if the runtime
is dropped or replaced on the way.
`cargo fmt --all -- --check`, `cargo clippy --all-targets --all-features -p
iceberg-catalog-loader -- -D warnings`, `cargo test -p iceberg-catalog-loader
--lib`, `make check-license-notice` and `cargo public-api` (compared against
`public-api.txt`) pass locally.
## AI Disclosure
- Used Claude Code to write the test and draft this description and the
issue. I reviewed the change.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]