Reference
What it does
The resources module defines the vocabulary of the marketplace: what a unit of CPU, memory, storage, or GPU means, how capacity is expressed, and how resource requirements are compared for matching. Every module that talks about capacity — deployments, orders, bids, usage records — uses these shared definitions.
Centralizing the resource model prevents drift: a bid can be checked against an order, and a usage record against a lease, because all three quantify resources identically.
Why it exists: Marketplaces fail on ambiguity. If tenant and provider disagree on what "one unit of compute" means, matching and settlement both break. A single, consensus-maintained resource model is what makes cross-provider price comparison and automated settlement possible.
State
Primary objects
| Concept | Definition |
|---|---|
Resource unit | The canonical quantification of CPU, memory, storage, or accelerator capacity. |
Capacity | A provider's leasable inventory, expressed in resource units for matching. |
Messages
Messages & queries
Message and query surfaces are documented at implementation level in the module docs ↗ and the source ↗. The objects above are the state those messages create and transition.
Connections
Module interactions
-
x/deploymentDeployment groups express requirements in shared resource units. -
x/marketOrder/bid matching compares resource specifications from this module. -
x/settlementUsage records quantify consumption in the same units they were leased in. -
x/benchmarkBenchmarks ground abstract units in measured hardware performance.
Flows
Core flow
- Define — Units are defined once. The module fixes what each unit of CPU, memory, storage, or accelerator capacity means.
- Express — Capacity and demand use them. Providers express inventory and deployments express requirements in the same shared units.
- Match — Orders meet bids. Matching compares specifications written in the shared vocabulary — no translation layer, no ambiguity.
- Settle — Usage bills in kind. Consumption is recorded and settled in the units it was leased in, with benchmarks qualifying abstract units by measured performance.
Questions
Asked about x/resources
Why centralize the resource model?
Marketplaces fail on ambiguity: if tenant and provider disagree on what one unit of compute means, matching and settlement both break. A single consensus-maintained model makes cross-provider comparison and automated settlement possible.
What do benchmarks add to units?
They ground abstract units in measured hardware performance — the same unit of compute qualified by what the underlying hardware actually measures.
Which modules use these definitions?
Every module that talks about capacity: deployments express requirements in them, orders and bids match on them, and usage records and settlement bill in them.
Related