Documentation
¶
Index ¶
Constants ¶
View Source
const ( StateVersion uint32 = 1 HashDomainSnapshotV1Full = "akash.inventory.snapshot.v1/full-payload/no-nonce" )
Variables ¶
View Source
var (
ErrProviderSnapshotNotFound = errors.New("provider snapshot record not found")
)
View Source
var (
ErrStateNotFound = errors.New("snapshot poster state not found")
)
Functions ¶
This section is empty.
Types ¶
type Broadcaster ¶
type Decision ¶
type Decision struct {
Post bool
Reason DecisionReason
}
func ShouldPost ¶
func ShouldPost(input DecisionInput) Decision
type DecisionInput ¶
type DecisionInput struct {
SnapshotHash []byte
Record *verificationv1.ProviderSnapshotRecord
Now time.Time
PostBeforeDeadline time.Duration
}
type DecisionReason ¶
type DecisionReason string
const ( DecisionReasonNone DecisionReason = "" DecisionReasonMissingRecord DecisionReason = "missing-record" DecisionReasonSuspended DecisionReason = "suspended" DecisionReasonHashChanged DecisionReason = "hash-changed" DecisionReasonMissingDeadline DecisionReason = "missing-deadline" DecisionReasonDeadlineDue DecisionReason = "deadline-due" DecisionReasonDeadlineUnchanged DecisionReason = "deadline-unchanged" )
type PreparedSnapshotHash ¶
type PreparedSnapshotHash struct {
Snapshot *aepinventory.Snapshot
Payload inventoryv1.SnapshotPayload
Msg *verificationv1.MsgPostSnapshotHash
}
func BuildMsg ¶
func BuildMsg(ctx context.Context, snapshotter Snapshotter) (*PreparedSnapshotHash, error)
type QueryClient ¶
type QueryClient interface {
ProviderSnapshot(context.Context, string) (*verificationv1.ProviderSnapshotRecord, error)
Params(context.Context) (verificationv1.Params, error)
}
func NewQueryAdapter ¶
func NewQueryAdapter(client verificationv1.QueryClient) (QueryClient, error)
type RunOnceResult ¶
type RunOnceResult struct {
Prepared *PreparedSnapshotHash
Params verificationv1.Params
Record *verificationv1.ProviderSnapshotRecord
Decision Decision
State State
Response *sdk.TxResponse
}
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func NewRunner ¶
func NewRunner(cfg RunnerConfig) (*Runner, error)
type RunnerConfig ¶
type RunnerConfig struct {
Snapshotter Snapshotter
Query QueryClient
Broadcaster Broadcaster
State StateStore
Log log.Logger
Interval time.Duration
IntervalJitter time.Duration
RetryDelay time.Duration
RetryJitter time.Duration
MaxRetries uint
PostBeforeDeadline time.Duration
Now func() time.Time
}
type Snapshotter ¶
type Snapshotter interface {
Build(context.Context, aepinventory.SnapshotRequest) (*aepinventory.Snapshot, error)
}
type State ¶
type State struct {
Version uint32 `json:"version"`
HashDomain string `json:"hash_domain"`
Provider string `json:"provider"`
SnapshotHash []byte `json:"snapshot_hash,omitempty"`
SnapshotTimestamp time.Time `json:"snapshot_timestamp,omitempty"`
ResourceSummary verificationv1.ResourceSummary `json:"resource_summary"`
ComplianceDeadline time.Time `json:"compliance_deadline,omitempty"`
Suspended bool `json:"suspended"`
LastDecision string `json:"last_decision,omitempty"`
LastTxHash string `json:"last_tx_hash,omitempty"`
LastAttemptAt time.Time `json:"last_attempt_at,omitempty"`
LastSuccessAt time.Time `json:"last_success_at,omitempty"`
LastError string `json:"last_error,omitempty"`
}
type StateStore ¶
func NewPersistentStateStore ¶
func NewPersistentStateStore(store pconfig.Verification) (StateStore, error)
Click to show internal directories.
Click to hide internal directories.