keeper

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: MIT Imports: 29 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

Functions

func CalcPositioningConstant added in v0.10.5

func CalcPositioningConstant(upkeepID int64, registryAddress ethkey.EIP55Address) (int32, error)

CalcPositioningConstant calculates a positioning constant. The positioning constant is fixed because upkeepID and registryAddress are immutable

func ValidatedKeeperSpec

func ValidatedKeeperSpec(tomlString string) (job.Job, error)

Types

type Config added in v0.10.11

type Config interface {
	KeeperDefaultTransactionQueueDepth() uint32
	KeeperMaximumGracePeriod() int64
	KeeperMinimumRequiredConfirmations() uint64
	KeeperRegistryCheckGasOverhead() uint64
	KeeperRegistryPerformGasOverhead() uint64
	KeeperRegistrySyncInterval() time.Duration
}

type Delegate

type Delegate struct {
	// contains filtered or unexported fields
}

func NewDelegate

func NewDelegate(
	db *gorm.DB,
	txm transmitter,
	jrm job.ORM,
	pr pipeline.Runner,
	ethClient eth.Client,
	headBroadcaster httypes.HeadBroadcaster,
	logBroadcaster log.Broadcaster,
	logger *logger.Logger,
	config Config,
) *Delegate

NewDelegate is the constructor of Delegate

func (Delegate) AfterJobCreated added in v0.10.11

func (Delegate) AfterJobCreated(spec job.Job)

func (Delegate) BeforeJobDeleted added in v0.10.11

func (Delegate) BeforeJobDeleted(spec job.Job)

func (*Delegate) JobType

func (d *Delegate) JobType() job.Type

JobType returns job type

func (*Delegate) ServicesForSpec

func (d *Delegate) ServicesForSpec(spec job.Job) (services []job.Service, err error)

type MailRoom added in v0.10.4

type MailRoom struct {
	// contains filtered or unexported fields
}

MailRoom holds the log mailboxes for all the log types that keeper cares about

type ORM

type ORM struct {
	DB *gorm.DB
	// contains filtered or unexported fields
}

ORM implements ORM layer using PostgreSQL

func NewORM

func NewORM(db *gorm.DB, txm transmitter, config Config, strategy bulletprooftxmanager.TxStrategy) ORM

NewORM is the constructor of postgresORM

func (ORM) BatchDeleteUpkeepsForJob added in v0.10.4

func (korm ORM) BatchDeleteUpkeepsForJob(ctx context.Context, jobID int32, upkeedIDs []int64) (int64, error)

func (ORM) CreateEthTransactionForUpkeep

func (korm ORM) CreateEthTransactionForUpkeep(ctx context.Context, upkeep UpkeepRegistration, payload []byte) (bulletprooftxmanager.EthTx, error)

func (ORM) EligibleUpkeepsForRegistry added in v0.10.8

func (korm ORM) EligibleUpkeepsForRegistry(
	ctx context.Context,
	registryAddress ethkey.EIP55Address,
	blockNumber, gracePeriod int64,
) (upkeeps []UpkeepRegistration, _ error)

func (ORM) LowestUnsyncedID

func (korm ORM) LowestUnsyncedID(ctx context.Context, regID int32) (nextID int64, err error)

LowestUnsyncedID returns the largest upkeepID + 1, indicating the expected next upkeepID to sync from the contract

func (ORM) Registries

func (korm ORM) Registries(ctx context.Context) (registries []Registry, _ error)

func (ORM) RegistryForJob added in v0.10.4

func (korm ORM) RegistryForJob(ctx context.Context, jobID int32) (registry Registry, _ error)

func (ORM) SetLastRunHeightForUpkeepOnJob added in v0.10.4

func (korm ORM) SetLastRunHeightForUpkeepOnJob(ctx context.Context, jobID int32, upkeepID, height int64) error

func (ORM) UpsertRegistry

func (korm ORM) UpsertRegistry(ctx context.Context, registry *Registry) error

func (ORM) UpsertUpkeep

func (korm ORM) UpsertUpkeep(ctx context.Context, registration *UpkeepRegistration) error

func (ORM) WithTransaction added in v1.0.0

func (korm ORM) WithTransaction(cb func(ctx context.Context) error) error

WithTransaction wraps the given handler into transaction context

type Registry

type Registry struct {
	ID                int32 `gorm:"primary_key"`
	BlockCountPerTurn int32
	CheckGas          int32
	ContractAddress   ethkey.EIP55Address
	FromAddress       ethkey.EIP55Address
	JobID             int32
	KeeperIndex       int32
	NumKeepers        int32
}

func (Registry) TableName

func (Registry) TableName() string

type RegistrySynchronizer

type RegistrySynchronizer struct {
	utils.StartStopOnce
	// contains filtered or unexported fields
}

func NewRegistrySynchronizer

func NewRegistrySynchronizer(
	job job.Job,
	contract *keeper_registry_wrapper.KeeperRegistry,
	orm ORM,
	jrm job.ORM,
	logBroadcaster log.Broadcaster,
	syncInterval time.Duration,
	minConfirmations uint64,
	logger *logger.Logger,
) *RegistrySynchronizer

NewRegistrySynchronizer is the constructor of RegistrySynchronizer

func (*RegistrySynchronizer) Close

func (rs *RegistrySynchronizer) Close() error

func (*RegistrySynchronizer) HandleLog added in v0.10.4

func (rs *RegistrySynchronizer) HandleLog(broadcast log.Broadcast)

func (*RegistrySynchronizer) HandleUpkeepRegistered added in v0.10.11

func (rs *RegistrySynchronizer) HandleUpkeepRegistered(broadcast log.Broadcast, registry Registry)

func (*RegistrySynchronizer) JobID added in v0.10.4

func (rs *RegistrySynchronizer) JobID() int32

func (*RegistrySynchronizer) Start

func (rs *RegistrySynchronizer) Start() error

type RevertReason added in v1.0.0

type RevertReason string

RevertReason represents the revert reason message

const (
	UpkeepNotNeededReason     RevertReason = "upkeep not needed"
	OutOfTurnReason           RevertReason = "keepers must take turns"
	PerformUpkeepFailedReason RevertReason = "call to perform upkeep failed"
	CheckTargetFailedReason   RevertReason = "call to check target failed"
	InsufficientFundsReason   RevertReason = "insufficient funds"
)

Revert reasons

func (RevertReason) IsOneOf added in v1.0.0

func (rr RevertReason) IsOneOf(revertReasons ...RevertReason) bool

IsOneOf returns true if the "rr" is one of the provided revert reasons.

type UpkeepExecuter added in v0.10.6

type UpkeepExecuter struct {
	utils.StartStopOnce
	// contains filtered or unexported fields
}

UpkeepExecuter implements the logic to communicate with KeeperRegistry

func NewUpkeepExecuter added in v0.10.6

func NewUpkeepExecuter(
	job job.Job,
	orm ORM,
	pr pipeline.Runner,
	ethClient eth.Client,
	headBroadcaster httypes.HeadBroadcaster,
	logger *logger.Logger,
	config Config,
) *UpkeepExecuter

NewUpkeepExecuter is the constructor of UpkeepExecuter

func (*UpkeepExecuter) Close added in v0.10.6

func (ex *UpkeepExecuter) Close() error

Close stops and closes upkeep executer

func (*UpkeepExecuter) OnNewLongestChain added in v0.10.6

func (ex *UpkeepExecuter) OnNewLongestChain(ctx context.Context, head models.Head)

OnNewLongestChain handles the given head of a new longest chain

func (*UpkeepExecuter) Start added in v0.10.6

func (ex *UpkeepExecuter) Start() error

Start starts the upkeep executer logic

type UpkeepRegistration

type UpkeepRegistration struct {
	ID                  int32 `gorm:"primary_key"`
	CheckData           []byte
	ExecuteGas          uint64
	LastRunBlockHeight  int64
	RegistryID          int32
	Registry            Registry
	UpkeepID            int64
	PositioningConstant int32
}

Jump to

Keyboard shortcuts

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