You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2fb65e9
Browse filesBrowse the repository at this point in the historyBrowse files
refactor: make the decoder storage private and ExtensionPlanParts a struct
Addresses review feedback on apache#24631.
`ExtensionPlanParts` was a public tuple alias; it is now a struct with named
`payload` / `children` fields.
`ExecutionPlanDecoder` was a public `fn`-pointer alias — a trait with one method
spelled as a type. Its doc claimed `try_from_proto` is an inherent function "so
it can return `Arc<dyn ExecutionPlan>`", which is simply wrong:
`ExecutionPlan::with_new_children` returns exactly that from an object-safe
trait. The real constraint is that `try_from_proto` is a *constructor* — a
receiver-less associated function has no `self` to dispatch on, so it cannot be
reached through a trait object, and a fn pointer is what a registry can hold.
So the fn pointer stays, but as a private storage detail:
* `ExecutionPlanDecoder` is no longer public, and its doc now states the actual
reason.
* `ExecutionPlanRegistry::decoder` (which handed the pointer out) is replaced by
`decode(name, node, ctx) -> Option<Result<..>>`, which also makes the
"not mine" / "mine and it failed" distinction explicit at the type level, and
by `contains(name)`.
* `register_decoder` and its partner `encode_extension_named` are dropped. They
existed only to register a decoder that is not a single type's constant, which
no caller needs yet, and they were the only reason the decoder type had to be
public. Re-adding them later — over a `dyn` decoder object, which would also
admit stateful and closure decoders — is additive.
`ExtensionExecutionPlan` is now the whole public contract for authoring one, and
the registry's storage can change without a breaking change. `RegisteredPlan`
loses its `Option<TypeId>`, since every entry now has a type.
Test coverage moves with the API: the by-name-alias dispatch test goes away with
the feature, and the empty-name check now runs through `register::<T>()` with a
plan whose `PLAN_NAME` is empty.
Part of apache#24625.
Co-Authored-By: Claude Opus 5 <[email protected]>
0 commit comments