Documentation
¶
Overview ¶
Package sync provides a sync engine that maps chain events to local store CRUD operations. The engine does not run background goroutines — callers invoke HandleEvent for each event received from the pubsub bus.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackoffDelay ¶
BackoffDelay returns the reconnection delay for the given attempt per SPEC §6.5. Uses exponential backoff with jitter: 1s, 2s, 4s, 8s, 16s, 32s, 60s cap.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine processes chain events and persists them to the local store.
func (*Engine) HandleEvent ¶
HandleEvent processes a single chain event via type-switch. Events for owners not in the tracked set are silently ignored. Unknown event types are also ignored (no error).
func (*Engine) Reconcile ¶
Reconcile performs startup reconciliation per SPEC §6.4. On first launch (no SyncState), it does a full reconciliation. On subsequent launches, it checks the block gap and either does a full reconciliation (gap > 1000) or updates the sync state.
func (*Engine) ReconcileNow ¶ added in v0.0.4
ReconcileNow performs the full reconciliation of SPEC §6.4 unconditionally and reports what it wrote. It backs `akt store sync` (SPEC §2.5): a user who asks for a sync is asking for chain state to be re-read, not for the block gap to be consulted.
type Querier ¶
type Querier interface {
CurrentHeight(ctx context.Context) (int64, error)
Deployments(ctx context.Context, owner string) ([]*store.DeploymentRecord, error)
Leases(ctx context.Context, owner string, dseq uint64) ([]*store.LeaseRecord, error)
Bids(ctx context.Context, owner string, dseq uint64) ([]*store.BidRecord, error)
}
Querier abstracts the chain queries needed for reconciliation. Implementations typically wrap the chain-sdk query clients.
func NewChainQuerier ¶ added in v0.0.4
func NewChainQuerier(cl aclient.LightClient) Querier
NewChainQuerier returns the Querier that reconciliation (SPEC §6.4) uses to read on-chain state through an Akash node client. Only queries are needed, so a LightClient suffices and no keyring or signer is involved.