NoahKusaba opened a new pull request, #3406: URL: https://github.com/apache/iceberg-rust/pull/3406
## Which issue does this PR close? - Closes #3405. ## What changes are included in this PR? Adds `Table::with_runtime`, which returns the table bound to another `Runtime` and keeps its `ObjectCache`: ```rust let table = cached_table.clone().with_runtime(Runtime::try_current()?); ``` Work the returned table spawns runs on the new runtime, and it shares the manifests and manifest lists already loaded with the original, since the cache is held in an `Arc`. It takes `self` and returns `Self`, like the crate-private `with_metadata` and `with_metadata_location`. The only alternative today is to rebuild the table with `Table::builder()`, which creates a new, empty cache. This only adds to the API. `public-api.txt` is regenerated with `cargo public-api`, and its diff is the one new method. ## Are these changes tested? `test_table_with_runtime_moves_work_and_keeps_object_cache` builds a table on a separate tokio runtime, shuts that runtime down, and rebinds the table to the test's runtime. It asserts that both tables hold the same `ObjectCache`, and that a task spawned on the rebound table's runtime runs. Without the `with_runtime` call, that spawn fails with `spawned task failed`, since it lands on the shut-down runtime. `cargo fmt --all -- --check`, `cargo clippy -p iceberg --all-targets -- -D warnings`, `cargo test -p iceberg --lib table::tests` and `cargo public-api -p iceberg` (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. -- 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]
