pub struct DefinitionUpgrade { /* private fields */ }Expand description
One explicit, directed definition compatibility edge.
Implementations§
Source§impl DefinitionUpgrade
impl DefinitionUpgrade
Sourcepub fn new(
key: DefinitionUpgradeKey,
from: DefinitionIdentity,
to: DefinitionIdentity,
steps: impl IntoIterator<Item = StepDefinitionUpgrade>,
) -> Result<Self, DefinitionError>
pub fn new( key: DefinitionUpgradeKey, from: DefinitionIdentity, to: DefinitionIdentity, steps: impl IntoIterator<Item = StepDefinitionUpgrade>, ) -> Result<Self, DefinitionError>
Validates a direct, non-transitive compatibility edge.
The M2 edge preserves checkpoint and context bytes unchanged, so applications may use it only when the mapped steps retain the same state schemas and semantics.
§Errors
Rejects self-edges, empty mappings, and mappings that reuse a target.
Sourcepub fn transformed(
key: DefinitionUpgradeKey,
revision: DefinitionUpgradeRevision,
from: DefinitionIdentity,
to: DefinitionIdentity,
nodes: impl IntoIterator<Item = DefinitionNodeUpgrade>,
transforms: impl IntoIterator<Item = DefinitionStateTransform>,
) -> Result<Self, DefinitionError>
pub fn transformed( key: DefinitionUpgradeKey, revision: DefinitionUpgradeRevision, from: DefinitionIdentity, to: DefinitionIdentity, nodes: impl IntoIterator<Item = DefinitionNodeUpgrade>, transforms: impl IntoIterator<Item = DefinitionStateTransform>, ) -> Result<Self, DefinitionError>
Validates the full transformed compatible-upgrade descriptor.
Completeness against the source definition and committed durable state is checked by the restart path before lifecycle writes.
§Errors
Rejects self-edges, empty or non-injective node mappings, mappings or transform sets beyond their public bounds, duplicate transform identities, and transforms outside the declared node mapping.
Sourcepub const fn key(&self) -> &DefinitionUpgradeKey
pub const fn key(&self) -> &DefinitionUpgradeKey
Borrows the application-owned upgrade key.
Sourcepub const fn revision(&self) -> Option<&DefinitionUpgradeRevision>
pub const fn revision(&self) -> Option<&DefinitionUpgradeRevision>
Borrows the deterministic transformed-edge revision.
None identifies the legacy M2 identity-only edge shape.
Sourcepub const fn from(&self) -> &DefinitionIdentity
pub const fn from(&self) -> &DefinitionIdentity
Borrows the checkpoint-producing definition.
Sourcepub const fn to(&self) -> &DefinitionIdentity
pub const fn to(&self) -> &DefinitionIdentity
Borrows the proposed definition.
Sourcepub fn step_mapping(&self) -> &BTreeMap<StepName, StepName>
pub fn step_mapping(&self) -> &BTreeMap<StepName, StepName>
Borrows the durable source-to-target step mapping.
Durable adapters replay the mapping when they resolve a compatible restart, so the order is the validated declaration order.
Sourcepub fn node_mapping(&self) -> &BTreeMap<NodeId, NodeId>
pub fn node_mapping(&self) -> &BTreeMap<NodeId, NodeId>
Borrows the durable source-to-target node mapping.
Sourcepub fn transforms(&self) -> &[DefinitionStateTransform]
pub fn transforms(&self) -> &[DefinitionStateTransform]
Borrows deterministic state-transform declarations.
Sourcepub const fn is_transformed(&self) -> bool
pub const fn is_transformed(&self) -> bool
Reports whether the edge carries the M7 transformed descriptor shape.