Documentation
¶
Index ¶
- Constants
- func HealthStatusToString(status int32) string
- func ParseHealthStatus(s string) int32
- type EscrowInfo
- type EscrowKeeper
- type HealthAttestationData
- type HealthAttestationMsg
- type HealthAttestationWithFreshness
- type IKeeper
- type Keeper
- func (k Keeper) BidCountForOrder(ctx sdk.Context, id mv1.OrderID) uint32
- func (k Keeper) Codec() codec.BinaryCodec
- func (k Keeper) CreateBid(ctx sdk.Context, id mv1.BidID, price sdk.DecCoin, roffer types.ResourcesOffer) (types.Bid, error)
- func (k Keeper) CreateLease(ctx sdk.Context, bid types.Bid) error
- func (k Keeper) CreateOrder(ctx sdk.Context, gid dtypes.GroupID, spec dtypesBeta.GroupSpec) (types.Order, error)
- func (k Keeper) DeleteManifestRef(ctx sdk.Context, owner string, dseq uint64)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetBid(ctx sdk.Context, id mv1.BidID) (types.Bid, bool)
- func (k Keeper) GetDeploymentEscrow(ctx sdk.Context, owner string, dseq uint64) (EscrowInfo, bool)
- func (k Keeper) GetDeploymentEscrowForLease(ctx sdk.Context, leaseID mv1.LeaseID) (EscrowInfo, bool)
- func (k Keeper) GetHealthAttestation(ctx sdk.Context, leaseID mv1.LeaseID) (HealthAttestationData, bool)
- func (k Keeper) GetHealthAttestationWithFreshness(ctx sdk.Context, leaseID mv1.LeaseID, healthThreshold int64) HealthAttestationWithFreshness
- func (k Keeper) GetHealthAttestationsForOwner(ctx sdk.Context, owner string) []HealthAttestationData
- func (k Keeper) GetLease(ctx sdk.Context, id mv1.LeaseID) (mv1.Lease, bool)
- func (k Keeper) GetManifestRef(ctx sdk.Context, owner string, dseq uint64) (ManifestRef, bool)
- func (k Keeper) GetOrder(ctx sdk.Context, id mv1.OrderID) (types.Order, bool)
- func (k Keeper) GetParams(ctx sdk.Context) (p types.Params)
- func (k Keeper) GetUnhealthyLeases(ctx sdk.Context, owner string, healthThreshold int64) []mv1.LeaseID
- func (k Keeper) HasManifestRef(ctx sdk.Context, owner string, dseq uint64) bool
- func (k Keeper) IsLeaseHealthy(ctx sdk.Context, leaseID mv1.LeaseID, healthThreshold int64) bool
- func (k Keeper) LeaseForOrder(ctx sdk.Context, bs types.Bid_State, oid mv1.OrderID) (mv1.Lease, bool)
- func (k Keeper) NewQuerier() Querier
- func (k Keeper) OnBidClosed(ctx sdk.Context, bid types.Bid) error
- func (k Keeper) OnBidLost(ctx sdk.Context, bid types.Bid)
- func (k Keeper) OnBidMatched(ctx sdk.Context, bid types.Bid)
- func (k Keeper) OnGroupClosed(ctx sdk.Context, id dtypes.GroupID) error
- func (k Keeper) OnLeaseClosed(ctx sdk.Context, lease mv1.Lease, state mv1.Lease_State, ...) error
- func (k Keeper) OnOrderClosed(ctx sdk.Context, order types.Order) error
- func (k Keeper) OnOrderMatched(ctx sdk.Context, order types.Order)
- func (k Keeper) SetManifestRef(ctx sdk.Context, owner string, dseq uint64, hash []byte, sdl string) error
- func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error
- func (k Keeper) StoreKey() storetypes.StoreKey
- func (k Keeper) SubmitHealthAttestation(ctx sdk.Context, msg *HealthAttestationMsg) error
- func (k Keeper) WithBids(ctx sdk.Context, fn func(types.Bid) bool)
- func (k Keeper) WithBidsForOrder(ctx sdk.Context, id mv1.OrderID, state types.Bid_State, ...)
- func (k Keeper) WithLeases(ctx sdk.Context, fn func(mv1.Lease) bool)
- func (k Keeper) WithOrders(ctx sdk.Context, fn func(types.Order) bool)
- func (k Keeper) WithOrdersForGroup(ctx sdk.Context, id dtypes.GroupID, state types.Order_State, ...)
- type ManifestRef
- type Querier
- func (k Querier) Bid(c context.Context, req *types.QueryBidRequest) (*types.QueryBidResponse, error)
- func (k Querier) Bids(c context.Context, req *types.QueryBidsRequest) (*types.QueryBidsResponse, error)
- func (k Querier) Lease(c context.Context, req *types.QueryLeaseRequest) (*types.QueryLeaseResponse, error)
- func (k Querier) Leases(c context.Context, req *types.QueryLeasesRequest) (*types.QueryLeasesResponse, error)
- func (k Querier) Order(c context.Context, req *types.QueryOrderRequest) (*types.QueryOrderResponse, error)
- func (k Querier) Orders(c context.Context, req *types.QueryOrdersRequest) (*types.QueryOrdersResponse, error)
- func (k Querier) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Constants ¶
const ( // HealthAttestationPrefix is the prefix for health attestation storage HealthAttestationPrefix = "health/" // Health status constants HealthStatusUnknown int32 = 0 HealthStatusHealthy int32 = 1 HealthStatusDegraded int32 = 2 HealthStatusFailed int32 = 3 )
const ( // LowEscrowThreshold defines the minimum blocks remaining before escrow is considered low LowEscrowThreshold int64 = 100 // ~8 minutes at 5 second blocks )
const (
// ManifestRefPrefix is the prefix for manifest reference storage
ManifestRefPrefix = "manifest_ref/"
)
Variables ¶
This section is empty.
Functions ¶
func HealthStatusToString ¶
HealthStatusToString converts health status to string
func ParseHealthStatus ¶
ParseHealthStatus converts a string to health status
Types ¶
type EscrowInfo ¶
type EscrowInfo struct {
Owner string
DSeq uint64
Balance string
Transferred string
Settled string
State string
IsLow bool
BlocksRemaining int64
}
EscrowInfo contains deployment escrow information
type EscrowKeeper ¶
type HealthAttestationData ¶
type HealthAttestationData struct {
LeaseID mv1.LeaseID
Provider string
Status int32
BlockHeight int64
Timestamp int64
Message string
}
HealthAttestationData is the stored health attestation data
type HealthAttestationMsg ¶
type HealthAttestationMsg struct {
LeaseID mv1.LeaseID
Provider string
Status int32 // 0=unknown, 1=healthy, 2=degraded, 3=failed
Timestamp int64
Message string
}
HealthAttestationMsg is the input for submitting health attestations
type HealthAttestationWithFreshness ¶
type HealthAttestationWithFreshness struct {
Attestation HealthAttestationData
Found bool
IsFresh bool
AttestationAge int64
CurrentBlock int64
IsHealthy bool
}
HealthAttestationWithFreshness contains attestation data plus computed freshness
type IKeeper ¶
type IKeeper interface {
NewQuerier() Querier
Codec() codec.BinaryCodec
StoreKey() storetypes.StoreKey
CreateOrder(ctx sdk.Context, gid dtypes.GroupID, spec dtypesBeta.GroupSpec) (types.Order, error)
CreateBid(ctx sdk.Context, id mv1.BidID, price sdk.DecCoin, roffer types.ResourcesOffer) (types.Bid, error)
CreateLease(ctx sdk.Context, bid types.Bid) error
OnOrderMatched(ctx sdk.Context, order types.Order)
OnBidMatched(ctx sdk.Context, bid types.Bid)
OnBidLost(ctx sdk.Context, bid types.Bid)
OnBidClosed(ctx sdk.Context, bid types.Bid) error
OnOrderClosed(ctx sdk.Context, order types.Order) error
OnLeaseClosed(ctx sdk.Context, lease mv1.Lease, state mv1.Lease_State, reason mv1.LeaseClosedReason) error
OnGroupClosed(ctx sdk.Context, id dtypes.GroupID) error
GetOrder(ctx sdk.Context, id mv1.OrderID) (types.Order, bool)
GetBid(ctx sdk.Context, id mv1.BidID) (types.Bid, bool)
GetLease(ctx sdk.Context, id mv1.LeaseID) (mv1.Lease, bool)
LeaseForOrder(ctx sdk.Context, bs types.Bid_State, oid mv1.OrderID) (mv1.Lease, bool)
WithOrders(ctx sdk.Context, fn func(types.Order) bool)
WithBids(ctx sdk.Context, fn func(types.Bid) bool)
WithBidsForOrder(ctx sdk.Context, id mv1.OrderID, state types.Bid_State, fn func(types.Bid) bool)
WithLeases(ctx sdk.Context, fn func(mv1.Lease) bool)
WithOrdersForGroup(ctx sdk.Context, id dtypes.GroupID, state types.Order_State, fn func(types.Order) bool)
BidCountForOrder(ctx sdk.Context, id mv1.OrderID) uint32
GetParams(ctx sdk.Context) (params types.Params)
SetParams(ctx sdk.Context, params types.Params) error
GetAuthority() string
// Health attestation methods
SubmitHealthAttestation(ctx sdk.Context, msg *HealthAttestationMsg) error
GetHealthAttestation(ctx sdk.Context, leaseID mv1.LeaseID) (HealthAttestationData, bool)
IsLeaseHealthy(ctx sdk.Context, leaseID mv1.LeaseID, healthThreshold int64) bool
// Manifest reference methods
SetManifestRef(ctx sdk.Context, owner string, dseq uint64, hash []byte, sdl string) error
GetManifestRef(ctx sdk.Context, owner string, dseq uint64) (ManifestRef, bool)
HasManifestRef(ctx sdk.Context, owner string, dseq uint64) bool
// Escrow methods
GetDeploymentEscrow(ctx sdk.Context, owner string, dseq uint64) (EscrowInfo, bool)
}
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, skey storetypes.StoreKey, ekeeper EscrowKeeper, authority string) IKeeper
NewKeeper creates and returns an instance for Market keeper
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the market store
func (Keeper) BidCountForOrder ¶
func (Keeper) CreateBid ¶
func (k Keeper) CreateBid(ctx sdk.Context, id mv1.BidID, price sdk.DecCoin, roffer types.ResourcesOffer) (types.Bid, error)
CreateBid creates a bid for a order with given orderID, price for bid and provider
func (Keeper) CreateLease ¶
CreateLease creates lease for bid with given bidID. Should only be called by the EndBlock handler or unit tests.
func (Keeper) CreateOrder ¶
func (k Keeper) CreateOrder(ctx sdk.Context, gid dtypes.GroupID, spec dtypesBeta.GroupSpec) (types.Order, error)
CreateOrder creates a new order with given group id and specifications. It returns created order
func (Keeper) DeleteManifestRef ¶
DeleteManifestRef removes the manifest reference for a deployment
func (Keeper) GetAuthority ¶
GetAuthority returns the x/mint module's authority.
func (Keeper) GetDeploymentEscrow ¶
GetDeploymentEscrow returns escrow information for a deployment It looks up the active lease for the deployment and queries the escrow account
func (Keeper) GetDeploymentEscrowForLease ¶
func (k Keeper) GetDeploymentEscrowForLease(ctx sdk.Context, leaseID mv1.LeaseID) (EscrowInfo, bool)
GetDeploymentEscrowForLease returns escrow info for a specific lease
func (Keeper) GetHealthAttestation ¶
func (k Keeper) GetHealthAttestation(ctx sdk.Context, leaseID mv1.LeaseID) (HealthAttestationData, bool)
GetHealthAttestation retrieves the latest health attestation for a lease
func (Keeper) GetHealthAttestationWithFreshness ¶
func (k Keeper) GetHealthAttestationWithFreshness(ctx sdk.Context, leaseID mv1.LeaseID, healthThreshold int64) HealthAttestationWithFreshness
GetHealthAttestationWithFreshness returns attestation with computed freshness metadata
func (Keeper) GetHealthAttestationsForOwner ¶
func (k Keeper) GetHealthAttestationsForOwner(ctx sdk.Context, owner string) []HealthAttestationData
GetHealthAttestationsForOwner retrieves all health attestations for a deployment owner
func (Keeper) GetManifestRef ¶
GetManifestRef retrieves the manifest reference for a deployment
func (Keeper) GetUnhealthyLeases ¶
func (k Keeper) GetUnhealthyLeases(ctx sdk.Context, owner string, healthThreshold int64) []mv1.LeaseID
GetUnhealthyLeases returns all leases that have exceeded the health threshold
func (Keeper) HasManifestRef ¶
HasManifestRef checks if a manifest reference exists
func (Keeper) IsLeaseHealthy ¶
IsLeaseHealthy checks if a lease is healthy based on its latest attestation
func (Keeper) LeaseForOrder ¶
func (k Keeper) LeaseForOrder(ctx sdk.Context, bs types.Bid_State, oid mv1.OrderID) (mv1.Lease, bool)
LeaseForOrder returns lease for order with given ID and lease found status
func (Keeper) NewQuerier ¶
func (Keeper) OnBidClosed ¶
OnBidClosed updates bid state to closed
func (Keeper) OnBidMatched ¶
OnBidMatched updates bid state to matched
func (Keeper) OnGroupClosed ¶
OnGroupClosed updates state of all orders, bids and leases in group to closed
func (Keeper) OnLeaseClosed ¶
func (k Keeper) OnLeaseClosed(ctx sdk.Context, lease mv1.Lease, state mv1.Lease_State, reason mv1.LeaseClosedReason) error
OnLeaseClosed updates lease state to closed
func (Keeper) OnOrderClosed ¶
OnOrderClosed updates order state to closed
func (Keeper) OnOrderMatched ¶
OnOrderMatched updates order state to matched
func (Keeper) SetManifestRef ¶
func (k Keeper) SetManifestRef(ctx sdk.Context, owner string, dseq uint64, hash []byte, sdl string) error
SetManifestRef stores a manifest reference for a deployment
func (Keeper) SubmitHealthAttestation ¶
func (k Keeper) SubmitHealthAttestation(ctx sdk.Context, msg *HealthAttestationMsg) error
SubmitHealthAttestation stores a health attestation for a lease
func (Keeper) WithBidsForOrder ¶
func (k Keeper) WithBidsForOrder(ctx sdk.Context, id mv1.OrderID, state types.Bid_State, fn func(types.Bid) bool)
WithBidsForOrder iterates all bids of an order in market with given OrderID
func (Keeper) WithLeases ¶
WithLeases iterates all leases in market
func (Keeper) WithOrders ¶
WithOrders iterates all orders in market
type ManifestRef ¶
type ManifestRef struct {
Owner string `json:"owner"`
DSeq uint64 `json:"dseq"`
Hash []byte `json:"hash"` // SHA256 hash of manifest bytes
HashHex string `json:"hash_hex"` // Hex-encoded hash for easy lookup
Version uint32 `json:"version"` // Schema version
SDL string `json:"sdl"` // Original SDL (optional, for debugging)
CreatedAt int64 `json:"created_at"` // Block height when created
UpdatedAt int64 `json:"updated_at"` // Block height when last updated
}
ManifestRef contains metadata about a manifest stored off-chain
type Querier ¶
type Querier struct {
Keeper
}
Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper
func (Querier) Bid ¶
func (k Querier) Bid(c context.Context, req *types.QueryBidRequest) (*types.QueryBidResponse, error)
Bid returns bid details based on BidID
func (Querier) Bids ¶
func (k Querier) Bids(c context.Context, req *types.QueryBidsRequest) (*types.QueryBidsResponse, error)
Bids returns bids based on filters
func (Querier) Lease ¶
func (k Querier) Lease(c context.Context, req *types.QueryLeaseRequest) (*types.QueryLeaseResponse, error)
Lease returns lease details based on LeaseID
func (Querier) Leases ¶
func (k Querier) Leases(c context.Context, req *types.QueryLeasesRequest) (*types.QueryLeasesResponse, error)
Leases returns leases based on filters
func (Querier) Order ¶
func (k Querier) Order(c context.Context, req *types.QueryOrderRequest) (*types.QueryOrderResponse, error)
Order returns order details based on OrderID
func (Querier) Orders ¶
func (k Querier) Orders(c context.Context, req *types.QueryOrdersRequest) (*types.QueryOrdersResponse, error)
Orders returns orders based on filters
func (Querier) Params ¶
func (k Querier) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)