Skip to main content

Module reload

Module reload 

Source
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:

SurfaceDiscipline
Scalar / aggregate / …Clean — no protocol step needed.
StorageBackendClean — old Storage continues until drained.
IndexKindProviderpersist() on old handle → open() on new.
BackgroundJobProviderClean — next tick picks up the new provider.
CdcOutputProvidercheckpoint() on old → start(lsn) on new.
CrdtKindProviderSchema-compat round-trip — hard error on mismatch.
LogicalTypeProviderArrow 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.
IndexHandoff
One live index handle and the new provider that will reopen it.
OldProviders
Pre-swap snapshot of the old plugin’s stateful providers.
ReloadDispatcher
Orchestrates per-kind reload discipline between drain and commit.
ReloadKindHandlers
Host-supplied handlers wiring per-kind in-flight resources into the reload pipeline.
ReloadOutcome
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.