Documentation ¶
Index ¶
- Variables
- func GetORMAdvisoryLockClassID(oi ORM) int32
- func GetORMClaimedJobIDs(oi ORM) (ids []int32)
- func NewORM(db *gorm.DB, cfg Config, pipelineORM pipeline.ORM, ...) *orm
- func NewSpawner(orm ORM, config Config, jobTypeDelegates map[Type]Delegate, ...) *spawner
- func PreloadAllJobTypes(db *gorm.DB) *gorm.DB
- func SetORMClaimedJobs(oi ORM, jobs []Job)
- type Config
- type CronSpec
- type Delegate
- type DirectRequestSpec
- type ExternalInitiatorWebhookSpec
- type FluxMonitorSpec
- type Job
- type KeeperSpec
- type NullDelegate
- type ORM
- type OffchainReportingOracleSpec
- func (s *OffchainReportingOracleSpec) BeforeCreate(db *gorm.DB) error
- func (s *OffchainReportingOracleSpec) BeforeSave(db *gorm.DB) error
- func (s OffchainReportingOracleSpec) GetID() string
- func (s *OffchainReportingOracleSpec) SetID(value string) error
- func (OffchainReportingOracleSpec) TableName() string
- type PipelineRun
- type Service
- type Spawner
- type SpecError
- type Type
- type VRFSpec
- type WebhookSpec
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoSuchPeerID = errors.New("no such peer id exists") ErrNoSuchKeyBundle = errors.New("no such key bundle exists") ErrNoSuchTransmitterAddress = errors.New("no such transmitter address exists") ErrNoSuchPublicKey = errors.New("no such public key exists") )
var ( ErrNoPipelineSpec = errors.New("pipeline spec not specified") ErrInvalidJobType = errors.New("invalid job type") ErrInvalidSchemaVersion = errors.New("invalid schema version") )
var (
ErrViolatesForeignKeyConstraint = errors.New("violates foreign key constraint")
)
Functions ¶
func GetORMAdvisoryLockClassID ¶ added in v0.9.9
func GetORMClaimedJobIDs ¶ added in v0.9.9
func NewORM ¶
func NewORM(db *gorm.DB, cfg Config, pipelineORM pipeline.ORM, eventBroadcaster postgres.EventBroadcaster, advisoryLocker postgres.AdvisoryLocker) *orm
func NewSpawner ¶
func SetORMClaimedJobs ¶ added in v0.9.9
Types ¶
type Config ¶
type Config interface { DatabaseMaximumTxDuration() time.Duration DatabaseURL() url.URL OCRBlockchainTimeout(time.Duration) time.Duration OCRContractConfirmations(uint16) uint16 OCRContractPollInterval(time.Duration) time.Duration OCRContractSubscribeInterval(time.Duration) time.Duration OCRObservationTimeout(time.Duration) time.Duration TriggerFallbackDBPollInterval() time.Duration }
type CronSpec ¶ added in v0.10.5
type Delegate ¶
type Delegate interface { JobType() Type // ServicesForSpec returns services to be started and stopped for this // job. In case a given job type relies upon well-defined startup/shutdown // ordering for services, they are started in the order they are given // and stopped in reverse order. ServicesForSpec(spec Job) ([]Service, error) AfterJobCreated(spec Job) BeforeJobDeleted(spec Job) }
TODO(spook): I can't wait for Go generics
type DirectRequestSpec ¶ added in v0.9.9
type DirectRequestSpec struct { ID int32 `toml:"-" gorm:"primary_key"` ContractAddress ethkey.EIP55Address `toml:"contractAddress"` Requesters models.AddressCollection `toml:"requesters"` MinIncomingConfirmations clnull.Uint32 `toml:"minIncomingConfirmations"` MinContractPayment *assets.Link `toml:"minContractPaymentLinkJuels"` CreatedAt time.Time `toml:"-"` UpdatedAt time.Time `toml:"-"` }
func (DirectRequestSpec) TableName ¶ added in v0.9.9
func (DirectRequestSpec) TableName() string
type ExternalInitiatorWebhookSpec ¶ added in v0.10.11
type ExternalInitiatorWebhookSpec struct { ExternalInitiatorID int64 ExternalInitiator models.ExternalInitiator `gorm:"foreignkey:ExternalInitiatorID;->"` WebhookSpecID int32 WebhookSpec WebhookSpec `gorm:"foreignkey:WebhookSpecID;->"` Spec models.JSON }
type FluxMonitorSpec ¶ added in v0.9.9
type FluxMonitorSpec struct { ID int32 `toml:"-" gorm:"primary_key"` ContractAddress ethkey.EIP55Address `toml:"contractAddress"` Threshold float32 `toml:"threshold,float"` // AbsoluteThreshold is the maximum absolute change allowed in a fluxmonitored // value before a new round should be kicked off, so that the current value // can be reported on-chain. AbsoluteThreshold float32 `toml:"absoluteThreshold,float" gorm:"type:float;not null"` PollTimerPeriod time.Duration PollTimerDisabled bool IdleTimerPeriod time.Duration IdleTimerDisabled bool DrumbeatSchedule string DrumbeatRandomDelay time.Duration DrumbeatEnabled bool MinPayment *assets.Link CreatedAt time.Time `toml:"-"` UpdatedAt time.Time `toml:"-"` }
type Job ¶ added in v0.10.3
type Job struct { ID int32 `toml:"-" gorm:"primary_key"` ExternalJobID uuid.UUID `toml:"externalJobID"` OffchainreportingOracleSpecID *int32 OffchainreportingOracleSpec *OffchainReportingOracleSpec CronSpecID *int32 CronSpec *CronSpec DirectRequestSpecID *int32 DirectRequestSpec *DirectRequestSpec FluxMonitorSpecID *int32 FluxMonitorSpec *FluxMonitorSpec KeeperSpecID *int32 KeeperSpec *KeeperSpec VRFSpecID *int32 VRFSpec *VRFSpec WebhookSpecID *int32 WebhookSpec *WebhookSpec PipelineSpecID int32 PipelineSpec *pipeline.Spec JobSpecErrors []SpecError `gorm:"foreignKey:JobID"` Type Type SchemaVersion uint32 Name null.String MaxTaskDuration models.Interval Pipeline pipeline.Pipeline `toml:"observationSource" gorm:"-"` }
func GetORMClaimedJobs ¶ added in v0.9.9
func (Job) ExternalIDEncodeBytesToTopic ¶ added in v0.10.10
The external job ID (UUID) can also be encoded into a log topic (32 bytes) by taking the 16 bytes undelying the UUID and right padding it.
func (Job) ExternalIDEncodeStringToTopic ¶ added in v0.10.10
The external job ID (UUID) can be encoded into a log topic (32 bytes) by taking the string representation of the UUID, removing the dashes so that its 32 characters long and then encoding those characters to bytes.
type KeeperSpec ¶ added in v0.10.3
type KeeperSpec struct { ID int32 `toml:"-" gorm:"primary_key"` ContractAddress ethkey.EIP55Address `toml:"contractAddress"` FromAddress ethkey.EIP55Address `toml:"fromAddress"` CreatedAt time.Time `toml:"-"` UpdatedAt time.Time `toml:"-"` }
type NullDelegate ¶ added in v0.10.8
type NullDelegate struct {
Type Type
}
func (*NullDelegate) AfterJobCreated ¶ added in v0.10.11
func (*NullDelegate) AfterJobCreated(spec Job)
func (*NullDelegate) BeforeJobDeleted ¶ added in v0.10.11
func (*NullDelegate) BeforeJobDeleted(spec Job)
func (*NullDelegate) JobType ¶ added in v0.10.8
func (n *NullDelegate) JobType() Type
func (*NullDelegate) ServicesForSpec ¶ added in v0.10.8
func (n *NullDelegate) ServicesForSpec(spec Job) (s []Service, err error)
type ORM ¶
type ORM interface { ListenForNewJobs() (postgres.Subscription, error) ListenForDeletedJobs() (postgres.Subscription, error) ClaimUnclaimedJobs(ctx context.Context) ([]Job, error) CreateJob(ctx context.Context, jobSpec *Job, pipeline pipeline.Pipeline) (Job, error) JobsV2(offset, limit int) ([]Job, int, error) FindJobTx(id int32) (Job, error) FindJob(ctx context.Context, id int32) (Job, error) FindJobIDsWithBridge(name string) ([]int32, error) DeleteJob(ctx context.Context, id int32) error RecordError(ctx context.Context, jobID int32, description string) DismissError(ctx context.Context, errorID int32) error UnclaimJob(ctx context.Context, id int32) error CheckForDeletedJobs(ctx context.Context) (deletedJobIDs []int32, err error) Close() error PipelineRuns(offset, size int) ([]pipeline.Run, int, error) PipelineRunsByJobID(jobID int32, offset, size int) ([]pipeline.Run, int, error) }
type OffchainReportingOracleSpec ¶ added in v0.9.9
type OffchainReportingOracleSpec struct { ID int32 `toml:"-" gorm:"primary_key"` ContractAddress ethkey.EIP55Address `toml:"contractAddress"` P2PPeerID *p2pkey.PeerID `toml:"p2pPeerID" gorm:"column:p2p_peer_id;default:null"` P2PBootstrapPeers pq.StringArray `toml:"p2pBootstrapPeers" gorm:"column:p2p_bootstrap_peers;type:text[]"` IsBootstrapPeer bool `toml:"isBootstrapPeer"` EncryptedOCRKeyBundleID *models.Sha256Hash `toml:"keyBundleID" gorm:"type:bytea"` TransmitterAddress *ethkey.EIP55Address `toml:"transmitterAddress"` ObservationTimeout models.Interval `toml:"observationTimeout" gorm:"type:bigint;default:null"` BlockchainTimeout models.Interval `toml:"blockchainTimeout" gorm:"type:bigint;default:null"` ContractConfigTrackerSubscribeInterval models.Interval `toml:"contractConfigTrackerSubscribeInterval" gorm:"default:null"` ContractConfigTrackerPollInterval models.Interval `toml:"contractConfigTrackerPollInterval" gorm:"type:bigint;default:null"` ContractConfigConfirmations uint16 `toml:"contractConfigConfirmations"` CreatedAt time.Time `toml:"-"` UpdatedAt time.Time `toml:"-"` }
TODO: remove pointers when upgrading to gormv2 which has https://github.com/go-gorm/gorm/issues/2748 fixed.
func (*OffchainReportingOracleSpec) BeforeCreate ¶ added in v0.9.9
func (s *OffchainReportingOracleSpec) BeforeCreate(db *gorm.DB) error
func (*OffchainReportingOracleSpec) BeforeSave ¶ added in v0.9.9
func (s *OffchainReportingOracleSpec) BeforeSave(db *gorm.DB) error
func (OffchainReportingOracleSpec) GetID ¶ added in v0.9.9
func (s OffchainReportingOracleSpec) GetID() string
func (*OffchainReportingOracleSpec) SetID ¶ added in v0.9.9
func (s *OffchainReportingOracleSpec) SetID(value string) error
func (OffchainReportingOracleSpec) TableName ¶ added in v0.9.9
func (OffchainReportingOracleSpec) TableName() string
type PipelineRun ¶ added in v0.9.9
type PipelineRun struct {
ID int64 `json:"-" gorm:"primary_key"`
}
func (PipelineRun) GetID ¶ added in v0.9.9
func (pr PipelineRun) GetID() string
func (*PipelineRun) SetID ¶ added in v0.9.9
func (pr *PipelineRun) SetID(value string) error
type Spawner ¶
type Spawner interface { service.Service CreateJob(ctx context.Context, spec Job, name null.String) (Job, error) DeleteJob(ctx context.Context, jobID int32) error ActiveJobs() map[int32]Job }
The job spawner manages the spinning up and spinning down of the long-running services that perform the work described by job specs. Each active job spec has 1 or more of these services associated with it.
type SpecError ¶ added in v0.9.9
type Type ¶
type Type string
func ValidateSpec ¶ added in v0.10.11
Common spec validation
func (Type) RequiresPipelineSpec ¶ added in v0.10.11
func (Type) SupportsAsync ¶ added in v0.10.11
type WebhookSpec ¶ added in v0.10.8
type WebhookSpec struct { ID int32 `toml:"-" gorm:"primary_key"` ExternalInitiatorWebhookSpecs []ExternalInitiatorWebhookSpec CreatedAt time.Time `json:"createdAt" toml:"-"` UpdatedAt time.Time `json:"updatedAt" toml:"-"` }
func (WebhookSpec) GetID ¶ added in v0.10.8
func (w WebhookSpec) GetID() string
func (*WebhookSpec) SetID ¶ added in v0.10.8
func (w *WebhookSpec) SetID(value string) error
func (WebhookSpec) TableName ¶ added in v0.10.8
func (WebhookSpec) TableName() string