pub struct ResidencyComparison { /* private fields */ }Expand description
Running versus suspended for the same VM over the same wall time.
The gap is roughly two orders of magnitude over a month, which is the entire
argument for a warm suspended pool. cycles is here so the argument stays honest:
each suspend/resume pays a snapshot write plus a read, and a pool that churns
spends more on transitions than it saves on residency. The conclusion to draw is
“avoid churn”, not “avoid residency”.
Both sides exclude image build and storage. They are the same for either choice, and leaving them in would dilute the ratio the comparison exists to show — and drag an unpriced build into a figure whose whole job is to be comparable.
Implementations§
Source§impl ResidencyComparison
impl ResidencyComparison
pub fn size(&self) -> SizeClass
Sourcepub fn hold(&self) -> DurationP
pub fn hold(&self) -> DurationP
The wall time both sides cover. Always Provenance::Projected: a comparison
is a hypothetical about a hold nobody has taken yet.
pub fn cycles(&self) -> u32
Sourcepub fn running(&self) -> &CostReport
pub fn running(&self) -> &CostReport
The report for leaving the VM running.
Sourcepub fn suspended(&self) -> &CostReport
pub fn suspended(&self) -> &CostReport
The report for suspending it, transitions included.
Sourcepub fn ratio(&self) -> Decimal
pub fn ratio(&self) -> Decimal
How many times more the running VM costs.
Zero-safe by construction: snapshot storage always has the minimum-retention
floor (COST-8), so the denominator is never zero. Both totals are
Total::Exact because both sides exclude the unpriced build, which is what
makes reading their floors sound here.
Sourcepub fn per_cycle(&self) -> Result<EstimatedUsd, Error>
pub fn per_cycle(&self) -> Result<EstimatedUsd, Error>
One suspend/resume: a snapshot write plus a read, per GB.
Without it the honest conclusion inverts — “suspend constantly” reads as free.
Sourcepub fn break_even_seconds(&self) -> Result<Decimal, Error>
pub fn break_even_seconds(&self) -> Result<Decimal, Error>
How long a VM must stay suspended for the cycle to pay for itself.
Below this, suspending and resuming costs more than having left the VM running — which is the number a pool scheduler actually needs, and the one a bare “100x cheaper” headline hides.
Returns a Decimal where the Python returned a float, so the seconds
figure stays in the same representation as the money it was derived from. See
ResidencyComparison::break_even_seconds_f64 for the lossy step, which is
named as one.
Sourcepub fn break_even_seconds_f64(&self) -> Result<f64, Error>
pub fn break_even_seconds_f64(&self) -> Result<f64, Error>
The break-even hold as an f64, for a JSON envelope.
Lossy, and named so. The exact answer is
ResidencyComparison::break_even_seconds; this exists because cli.py emits
breakEvenSeconds as a JSON number and the two clients have to agree on it.
Seconds, not dollars — no money figure has an f64 accessor (COST-2).
Trait Implementations§
Source§impl Clone for ResidencyComparison
impl Clone for ResidencyComparison
Source§fn clone(&self) -> ResidencyComparison
fn clone(&self) -> ResidencyComparison
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResidencyComparison
impl Debug for ResidencyComparison
impl Eq for ResidencyComparison
Source§impl PartialEq for ResidencyComparison
impl PartialEq for ResidencyComparison
impl StructuralPartialEq for ResidencyComparison
Auto Trait Implementations§
impl Freeze for ResidencyComparison
impl RefUnwindSafe for ResidencyComparison
impl Send for ResidencyComparison
impl Sync for ResidencyComparison
impl Unpin for ResidencyComparison
impl UnsafeUnpin for ResidencyComparison
impl UnwindSafe for ResidencyComparison
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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