Module mz_catalog::durable::objects::state_update
source · Expand description
This module contains various representations of a single catalog update and the logic necessary for converting between representations.
The general lifecycle of a single update when read from persist is as follows:
- The update is stored in persist as a
PersistStateUpdate
. - After being read from persist the update is immediately converted into a
StateUpdate<StateUpdateKindJson>
, which models the update as a JSON. - The
StateUpdateKindJson
is converted into a protobuf message,proto::StateUpdateKind
. - The update is then converted into a
StateUpdate<StateUpdateKind>
, which is a strongly typed Rust object. - Finally, the update is converted into an
Option<memory::objects::StateUpdate>
, andSome
variants are given to the in-memory catalog. The in-memory catalog is only interested in a subset of catalog updates which is why theOption
is necessary.
TLDR: PersistStateUpdate
-> StateUpdate<StateUpdateKindJson>
->
proto::StateUpdateKind
-> StateUpdate<StateUpdateKind>
->
Option<memory::objects::StateUpdate>
The process of writing a catalog update to persist is the exact opposite.
When running catalog protobuf upgrades/migrations we may need to take a detour and convert the
StateUpdateKindJson
to some proto::object_v{x}::StateUpdateKind
before applying specific
upgrades to get us to a valid proto::StateUpdateKind
.
Structs§
- A single update to the catalog state.
- Version of
StateUpdateKind
to allow reading/writing raw json from/to persist.
Enums§
- The contents of a single state update.
Traits§
- Trait for objects that can be converted to/from a
StateUpdateKindJson
. - Trait for objects that can be converted to/from a
StateUpdateKind
.
Type Aliases§
- Version of
StateUpdateKind
that is stored directly in persist.