Skip to main content

MirrorReconcileResult

Enum MirrorReconcileResult 

Source
pub enum MirrorReconcileResult {
    Planned {
        capsules: u32,
        reclaims: u32,
        creates: u32,
        estimated_cost_dig_base_units: u64,
        url_advertised: Vec<String>,
        url_current: Vec<String>,
    },
    Refused {
        reason: MirrorReconcileRefusal,
        url_current: Option<Vec<String>>,
    },
    Completed {
        reclaimed: u32,
        created: u32,
        url: Vec<String>,
    },
    Partial {
        reclaimed: u32,
        created: u32,
        remaining: u32,
        reason: String,
    },
}
Expand description

control.mirror.reconcile — reconcile this node’s mirror coins to its CURRENT advertise URL: reclaim every coin advertising a stale URL, then recreate it advertising the URL this node advertises TODAY. Shared by the manual “reset mirrors” action and dig-node#570’s automatic epoch-boundary pass — ONE reconcile primitive, exposed two ways (dig_ecosystem#3203).

§Four outcomes, and a client MUST be able to tell them apart

They mean different things about the user’s money, which is why this is a tagged union rather than a single struct with optional fields:

  • Planneddry_run: true only. A PRICED PLAN; nothing was spent.
  • Refused — nothing was spent. See MirrorReconcileRefusal for why.
  • Completed — the whole plan ran: every reclaim confirmed, every create confirmed.
  • Partial — the affordable PREFIX ran; the rest did not start.

§Refused MUST mean nothing was spent, unconditionally

A caller distinguishes refused from partial precisely so it never has to guess whether a “no” cost money. An implementation that spends anything under a Refused outcome breaks the one guarantee this contract exists to give the operator.

§A dry run that would in fact refuse reports Refused, never Planned

Planned prices a plan the node believes it CAN execute — computed against the same validation (corroborated URL, changed URL, affordability) a real run performs. A dry run whose candidate URL is uncorroborated, unchanged, or otherwise refusable answers Refused exactly like a real run would, so a caller previewing a reset sees the same refusal a real attempt would hit rather than a plan for a call that cannot execute.

§Reclaim-first ordering is why Partial is safe to report at all

dig-node’s mirror-collateral runner reclaims before it creates — a reclaim returns collateral, which may fund the create behind it — so a partial run still leaves the node in a COHERENT state, never worse off than before the call: every reclaim that ran completed, and no create ran without its funding reclaim already having confirmed.

Variants§

§

Planned

dry_run: true only — a priced plan. Nothing was spent.

Fields

§capsules: u32

How many (store, root) capsules this plan would touch.

§reclaims: u32

How many of this node’s existing mirror coins the plan would reclaim.

§creates: u32

How many new mirror coins the plan would create, advertising the new URL.

§estimated_cost_dig_base_units: u64

The total cost of the whole plan, in DIG base units (3 decimals, one base unit is 0.001 DIG — NEVER mojos, which are XCH’s 1e-12 unit).

§url_advertised: Vec<String>

The URL(s) this plan would advertise once it completes.

§url_current: Vec<String>

The URL(s) this node’s existing mirror coins advertise TODAY — the plan exists to close the gap between this and url_advertised.

§

Refused

Refused. Nothing was spent — see MirrorReconcileRefusal for why.

Fields

§reason: MirrorReconcileRefusal

Which of the six reasons this refusal is.

§url_current: Option<Vec<String>>

The URL(s) this node’s existing mirror coins advertise, where the node can state it. None when the refusal itself means the node cannot say — e.g. no_mirror_coins leaves no bond to read a URL from at all.

§

Completed

The whole plan completed: every reclaim confirmed, every create confirmed.

Fields

§reclaimed: u32

How many mirror coins were reclaimed.

§created: u32

How many new mirror coins were created, advertising the new URL.

§url: Vec<String>

The URL(s) now advertised by the newly created coins.

§

Partial

The AFFORDABLE PREFIX completed; the rest did not run.

Fields

§reclaimed: u32

How many mirror coins were reclaimed before the plan stopped.

§created: u32

How many new mirror coins were created before the plan stopped.

§remaining: u32

How many capsules the plan did NOT reach.

§reason: String

Why the plan stopped rather than completing.

Trait Implementations§

Source§

impl Clone for MirrorReconcileResult

Source§

fn clone(&self) -> MirrorReconcileResult

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 MirrorReconcileResult

Source§

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

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

impl<'de> Deserialize<'de> for MirrorReconcileResult

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for MirrorReconcileResult

Source§

impl PartialEq for MirrorReconcileResult

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for MirrorReconcileResult

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for MirrorReconcileResult

Auto Trait Implementations§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.