Expand description
Per-kind hot-reload discipline orchestration.
ReloadDispatcher is invoked between the drain and commit
phases of Uni::reload. By the time it runs, the old plugin has
already been removed from the registry (so new captures cannot see
its surfaces), but in-flight queries that captured Arc<dyn Foo>
before the swap still operate against the old instances.
The dispatcher’s job is to run the per-kind handoff each surface needs before committing the new plugin’s registrations. The handoffs are spelled out below:
| Surface | Discipline |
|---|---|
| Scalar / aggregate / … | Clean — no protocol step needed. |
StorageBackend | Clean — old Storage continues until drained. |
IndexKindProvider | persist() on old handle → open() on new. |
BackgroundJobProvider | Clean — next tick picks up the new provider. |
CdcOutputProvider | checkpoint() on old → start(lsn) on new. |
CrdtKindProvider | Schema-compat round-trip — hard error on mismatch. |
LogicalTypeProvider | Arrow extension contract unchanged — hard error. |
Per-kind handoffs that the trait surface already exposes (e.g.,
CdcStream::checkpoint) are invoked directly. Surfaces that need
a richer contract (CRDT / logical-type schema-compat) get a
default-method on the trait (schema_compat_check, compat_check)
that providers can override.
Stateful surfaces with in-flight private resources (live
IndexHandles, open CdcStreams) are reload-managed by the host
that owns those resources — the dispatcher receives them through
the ReloadKindHandlers builder rather than by registry walk,
because the registry only tracks providers, not the per-instance
resources those providers spawn.
Structs§
- CdcHandoff
- One live CDC stream and the new provider that will resume it.
- Index
Handoff - One live index handle and the new provider that will reopen it.
- OldProviders
- Pre-swap snapshot of the old plugin’s stateful providers.
- Reload
Dispatcher - Orchestrates per-kind reload discipline between drain and commit.
- Reload
Kind Handlers - Host-supplied handlers wiring per-kind in-flight resources into the reload pipeline.
- Reload
Outcome - The outcome of a successful reload — opaque container for any new in-flight resources the dispatcher constructed (reopened index handles, restarted CDC streams) so the host can re-attach them.