Skip to main content

Crate spacedb_meter

Crate spacedb_meter 

Source
Expand description

§spacedb-meter — SpaceDB Layer 6 (metering & settlement)

SpaceDB measures; it does not price or pay. This crate computes the three resource amounts deterministically — storage (Usage::storage, bytes × time × replica_count), compute (Usage::compute, fuel + invocations), and transit (Usage::transit, bilaterally-corroborated served bytes) — accumulates them in a MeterLedger, and drains them into amounts-only UsageClaims.

Pricing (RateCard), the agent spend cap (Budget), and pre-deploy cost estimates are open-core too. Settlement is the seam: the bundled LocalSettlement is enough for a self-hoster, while a host implements Settlement over its own money plane — for MATA that is the existing UsageClaim → Maestro counter-sign → EarningRecord → Iron Bank loop — so SpaceDB usage settles through it without ever depending on it.

Open-core (MIT). No spacedb-* / mata-* dependencies.

Structs§

Budget
A remaining spend allowance, in micro-$MATA.
LocalSettlement
The bundled, marketplace-free settlement: price against a rate card and tally per customer. No $MATA is minted — that is a host’s concern.
MeterLedger
Accumulates usage per customer mID until drained into claims.
ProofRef
A content-addressed link to the artifact that backs a claim — e.g. a FunctionRun digest (M6) or a proof-of-storage probe response.
RateCard
Prices per resource unit, in micro-$MATA.
Settled
A priced settlement receipt (the open-core analogue of an EarningRecord).
Totals
Accumulated amounts for one customer.
UsageClaim
A unit of metered work, ready for settlement. Amounts only.

Enums§

MeterError
ProofKind
What kind of proof backs a claim (mirrors maestro’s ProofKind).
Resource
The class of a resource — the settlement bucket.
Usage
A measured amount of one resource class over a period.

Traits§

Settlement
Consumes usage claims and settles them. A host plugs its money plane in here.

Type Aliases§

MeterResult