event

package
v0.1.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package event provides additional chain-event subscription support for the provider. It supplements pkg.akt.dev/go/util/events (which only reads tx events) by also publishing typed events emitted in `FinalizeBlockEvents` (BeginBlock + EndBlock), where contract-driven module events land when the chain's AutomationKeeper executes scheduled tasks during EndBlock.

Without this supplement, the provider's bidengine never sees `EventLeaseCreated` for leases that the ha-multilease-orchestrator auto-accepts via SudoMsg::Tick, the bidengine times out the bid and the freshly-created lease auto-closes as `lease_closed_invalid` before the provider ever provisions the workload.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterDeployment

type ClusterDeployment struct {
	LeaseID mtypes.LeaseID
	Group   *mani.Group
	Status  ClusterDeploymentStatus
}

ClusterDeployment stores leaseID, group details and deployment status

type ClusterDeploymentStatus

type ClusterDeploymentStatus string

ClusterDeploymentStatus represents status of the cluster deployment

const (
	ClusterDeploymentUnknown ClusterDeploymentStatus = "unknown"
	// ClusterDeploymentUpdated is used whenever the deployment in the cluster is updated but may not be functional
	ClusterDeploymentUpdated ClusterDeploymentStatus = "updated"
	// ClusterDeploymentPending is used when cluster deployment status is pending
	ClusterDeploymentPending ClusterDeploymentStatus = "pending"
	// ClusterDeploymentDeployed is used when cluster deployment status is deployed
	ClusterDeploymentDeployed ClusterDeploymentStatus = "deployed"
)

type FinalizeBlockEventStream

type FinalizeBlockEventStream interface {
	// Shutdown gracefully stops the stream.
	Shutdown()
}

FinalizeBlockEventStream subscribes to block headers, then for each block pulls `block_results` and publishes any typed Akash events found in `FinalizeBlockEvents` onto the provider's pubsub. It deliberately uses a distinct subscription name so it doesn't collide with `pkg.akt.dev/go/util/events.NewEvents` (which uses "<name>-blk-hdr").

func NewFinalizeBlockEventStream

func NewFinalizeBlockEventStream(
	pctx context.Context,
	node sdkclient.CometRPC,
	name string,
	bus pubsub.Bus,
	logger log.Logger,
) (FinalizeBlockEventStream, error)

NewFinalizeBlockEventStream starts a goroutine that mirrors the typed Akash `FinalizeBlockEvents` (BeginBlock + EndBlock) for every new block onto the provider's pubsub bus. The caller must call Shutdown() to stop it.

Implementation note: this poller deliberately does NOT use the WebSocket subscription path that `pkg.akt.dev/go/util/events` uses. CometBFT's `WSEvents` stores active subscriptions in a `map[query]channel` (see cometbft/rpc/client/http/http.go `WSEvents.Subscribe`), so two independent subscriptions to the same query (e.g. `tm.event='NewBlockHeader'`) silently overwrite each other and only the last one receives events. Instead we poll `Status` once per second for the latest committed height and request `BlockResults` for every height we haven't seen yet. The local lab block time is ~6s, so 1s polling adds at most one extra RPC per block compared to a subscription.

Parameters mirror events.NewEvents from pkg.akt.dev/go for symmetry.

type LeaseAddFundsMonitor

type LeaseAddFundsMonitor struct {
	mtypes.LeaseID
	IsNewLease bool
}

type LeaseRemoveFundsMonitor

type LeaseRemoveFundsMonitor struct {
	mtypes.LeaseID
}

type LeaseWon

type LeaseWon struct {
	LeaseID mtypes.LeaseID
	Group   *dtypes.Group
	Price   sdk.DecCoin
}

LeaseWon is the data structure that includes leaseID, group and price

type ManifestReceived

type ManifestReceived struct {
	LeaseID    mtypes.LeaseID
	Manifest   *mani.Manifest
	Deployment *dtypes.QueryDeploymentResponse
	Group      *dtypes.Group
}

ManifestReceived stores leaseID, manifest received, deployment and group details to be provisioned by the Provider.

func (ManifestReceived) ManifestGroup

func (ev ManifestReceived) ManifestGroup() *mani.Group

ManifestGroup returns group if present in manifest or nil

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL