Skip to main content

Plan

Struct Plan 

Source
pub struct Plan {
    pub id: PlanId,
    pub groups: Vec<TransactionGroup>,
    pub intents: Vec<DestructiveIntent>,
    pub lint_waivers: Vec<LintWaiver>,
    pub step_overrides: Vec<StepOverride>,
    pub metadata: PlanMetadata,
    pub advisory_findings: Vec<RecordedFinding>,
}
Expand description

The canonical in-memory representation of a plan.

Fields§

§id: PlanId

Deterministic identity hash; see PlanId::compute.

§groups: Vec<TransactionGroup>

Steps partitioned into transaction groups; each step’s step_no and intent_id are filled in by Plan::from_grouped.

§intents: Vec<DestructiveIntent>

Destructive intents, one per destructive step, in step order.

§lint_waivers: Vec<LintWaiver>

Lint waivers loaded from [[lint_waiver]] rows in intent.toml.

When pgevolve plan detects unwaived LintAtPlan findings, it prints an example [[lint_waiver]] row to stderr for the user to copy into intent.toml; the field is omitted from serialized output when empty (skip_serializing_if = "Vec::is_empty"). The field is populated when reading back a plan directory whose intent.toml already contains [[lint_waiver]] rows.

§step_overrides: Vec<StepOverride>

Step overrides loaded from [[step_override]] rows in intent.toml.

Each row can suppress a specific auto-emitted step at apply time. The executor checks this list before running each step and skips (recording as skipped in the audit log) any step whose kind and primary target match an override with suppress = true.

§metadata: PlanMetadata

Plan metadata.

§advisory_findings: Vec<RecordedFinding>

Advisory (Warning-severity) lint findings produced at plan time.

These are informational — they never block plan construction — and are not persisted to disk. Callers (CLI, conformance tests) can inspect this field and print or assert on them as needed.

Currently populated by the pgevolve::api::build_plan shim from crate::lint::check_changeset (changeset-level rules such as storage-downgrade-not-retroactive and compression-change-not-retroactive).

Implementations§

Source§

impl Plan

Source

pub fn from_grouped( groups: Vec<TransactionGroup>, source: &Catalog, target: &Catalog, target_identity: String, source_rev: Option<String>, pgevolve_version: &str, planner_ruleset_version: u32, ) -> Result<Self, PlanError>

Assemble a Plan from a step-grouped output of the rewrite pass.

Walks groups in order to:

  1. Assign 1-indexed step_no to every step (continuous across groups).
  2. Allocate a DestructiveIntent (and intent_id) for every destructive step, in step order.
  3. Compute the deterministic PlanId over (source, target, version, ruleset_version).

target_identity is opaque to the planner — the executor binary computes it from (host, port, dbname, system_identifier) at apply time.

§Errors

Returns PlanError::Internal if the source or target catalog cannot be serialized to JSON for hashing (see PlanId::compute).

Source

pub fn approve_all_intents(&mut self)

Mark every destructive intent as approved = true.

Intended for test harnesses that build plans programmatically and want to bypass the intent.toml-based approval workflow. Production apply must continue to require explicit approval in intent.toml.

Trait Implementations§

Source§

impl Clone for Plan

Source§

fn clone(&self) -> Plan

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Plan

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Plan

Source§

fn eq(&self, other: &Plan) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Plan

Auto Trait Implementations§

§

impl Freeze for Plan

§

impl RefUnwindSafe for Plan

§

impl Send for Plan

§

impl Sync for Plan

§

impl Unpin for Plan

§

impl UnsafeUnpin for Plan

§

impl UnwindSafe for Plan

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.