cold: type-erased backend via DynColdStorageBackend#63
Open
prestwich wants to merge 8 commits into
Open
Conversation
Cosmetic: one blank-line-separated group per module + its re-export. No semantic change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Also fix infinite recursion in the Arc<dyn DynColdStorageBackend> ColdStorageRead impl: get_logs and produce_log_stream were cycling back through the blanket DynColdStorageBackend impl. Fixed by calling DynColdStorageBackend::dyn_* directly on the inner trait object via Arc::as_ref(), bypassing the blanket dispatch loop. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Workspace doc build runs with -D warnings which enables rustdoc::redundant_explicit_links. The label already auto-resolves to crate::Filter via the prelude, so the explicit target is rejected. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Claude Code]
Summary
DynColdStorageBackend, an object-safe mirror ofColdStorageBackendwithPin<Box<dyn Future>>returns, auto-implemented for everyB: ColdStorageBackendvia a blanket impl.Arc<dyn DynColdStorageBackend>is wired to satisfyColdStorageBackend, andColdStorage<B>defaultsBto that erased form plus anew_erasedconstructor — so downstream code can write plainColdStoragewithout a turbofish when it wants runtime backend swappability, orColdStorage<MyBackend>for full monomorphization.get_logs/produce_log_streamon the erased path eagerly clone theFilterbecause the unified-lifetime dyn signature cannot bridge the independent-lifetime strong-trait signature without an owned filter. All other methods dispatch with zero overhead. ConcreteColdStorage<B>is unaffected. See the module docs indyn_backend.rs.conformance_erasedentry point so the existing conformance suite runs againstArc<dyn DynColdStorageBackend>, and a focused unit test that verifies a backend'sdrain_aboveoverride survives erasure. Writing those tests caught and fixed an infinite-recursion hazard in the clone-form methods (the clonedArc<dyn ...>resolved the blanket impl back into the strong-trait impl — fix: qualified-path dispatch viaArc::as_ref()). The recursion hazard is documented in a maintainer note for any future borrowed-arg method.Test plan
cargo +nightly fmt -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo clippy --workspace --all-targets --no-default-features -- -D warningscargo t -p signet-cold --all-features— including newerased_conformanceanddyn_drain_above_invokes_backend_overridetests🤖 Generated with Claude Code