Skip to main content

RateTable

Struct RateTable 

Source
pub struct RateTable { /* private fields */ }
Expand description

us-east-1 rates, pinned to when they were read and where from.

The three booleans and the absent increment are documented facts rather than settings, and they are fields because each one is a mistake someone would otherwise make in arithmetic: blending vCPU into a GB-second, adding a per-invoke charge by analogy with Lambda Functions, rounding a 200 ms exec up to a 1-second increment, or subtracting a free tier that does not exist.

§Why the rate fields are private (COST-9)

The Python’s RateTable was a plain frozen dataclass, so anyone could construct one — which is how pricing.py’s ARM refusal ended up guarding only the fetch path. Here the five rates are private and there are exactly two ways to obtain a table: the pinned pinned_rates, and RateTable::from_catalog, which refuses a catalog missing its ARM compute line rather than substituting the x86 one. So “compute is priced from the ARM rate” is a property of the type rather than of a code path that can be bypassed.

Implementations§

Source§

impl RateTable

Source

pub fn region(&self) -> &Region

The region these rates price.

Not a cosmetic label: eu-west-1 is 5.3% over us-east-1 on compute and 19% on snapshot storage, and ap-northeast-1 is 16.4% and 20%. A caller in Tokyo reading the us-east-1 table understates their snapshot write bill by 22.6%, which is not a rounding difference and would never show up as staleness.

Source

pub fn source_url(&self) -> &str

Where these figures came from, as an instruction a reader can act on.

Source

pub fn retrieved(&self) -> CalendarDate

When they were read.

Source

pub fn vcpu_second(&self) -> Decimal

Per vCPU-second, billed separately from memory.

Source

pub fn gb_second(&self) -> Decimal

Per GB-second of baseline memory, billed separately from vCPU.

Source

pub fn storage_gb_month(&self) -> Decimal

Per GB-month of snapshot storage.

The one derived figure: the Pricing API quotes this per GB-hour, and this table holds per GB-month. See HOURS_PER_MONTH.

Source

pub fn snapshot_read_gb(&self) -> Decimal

Per GB read on a launch or a resume.

Source

pub fn snapshot_write_gb(&self) -> Decimal

Per GB written on a suspend. Roughly 2.5x the read rate, so a cycle costed with one rate twice is wrong in whichever direction it picked.

Source

pub fn minimum_retention(&self) -> Duration

The documented storage minimum (COST-8).

On the rate row itself, so it applies to anything stored there.

Source

pub fn minimum_retention_days(&self) -> u64

The same minimum in whole days, which is the unit the note on a floored line item quotes.

Here rather than as an as_secs() / 86_400 at the one call site, because that spelling is a second place the seconds-to-days convention lives: the field is the only thing that knows how long the window is, and a division written beside the message would keep saying “7-day” after a rate row moved to a fortnight. Truncating rather than rounding is deliberate — a floor quoted as longer than it is would overstate the charge a reader is being told about.

Source

pub fn per_request(&self) -> Decimal

MicroVMs bills per second with no per-request charge.

A method returning a constant rather than a field, because it is a documented fact and not a table entry someone could edit into a different claim. The Lambda free tier is Functions-only and no MicroVMs free tier is published.

Source

pub fn bills_vcpu_and_memory_separately(&self) -> bool

vCPU and memory are two line items, as the pricing page prices them.

A blended GB-second figure cannot be reconciled against a Cost Explorer breakdown that keeps them apart.

Source

pub fn free_tier(&self) -> bool

No published free tier.

Source

pub fn minimum_billing_increment(&self) -> Option<Duration>

The minimum billing increment, which is not published.

None means not published, not “one second”. Nothing here rounds a duration up, because inventing an increment would overcharge every short exec in a report and there is no source for one.

Source

pub fn age_days(&self, today: CalendarDate) -> i64

How many days ago these rates were read.

Source

pub fn is_stale(&self, today: CalendarDate) -> bool

Whether the table is past STALE_AFTER_DAYS (COST-7).

Source

pub fn staleness(&self, today: CalendarDate) -> Option<String>

The warning text, or None when the table is fresh.

Text rather than a bool because the warning has to survive into whatever renders it, carrying the retrieval date and the URL — a figure copied out of a terminal loses everything else.

Source§

impl RateTable

Source

pub fn from_catalog( region: Region, source_url: impl Into<String>, retrieved: CalendarDate, catalog: &RateCatalog, ) -> Result<RateTable, Error>

A table for one region, built from a catalog — or a refusal (COST-9).

All or nothing. A partial table would price a run at less than it costs, and the caller has no way to see which field was quietly left at a stale value.

Four ways this refuses, each a way the catalog could change and still parse: a missing ARM compute line whose x86 sibling is present (the substitution that would look entirely healthy and inflate every estimate by 17.9%), a missing line with no sibling, a restated unit, and two products where there was one.

Trait Implementations§

Source§

impl Clone for RateTable

Source§

fn clone(&self) -> RateTable

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 RateTable

Source§

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

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

impl Eq for RateTable

Source§

impl PartialEq for RateTable

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RateTable

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

Source§

type Output = T

Should always be Self
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.