Versions in this module Expand all Collapse all v0 v0.0.2 Mar 12, 2021 Changes in this version + const BatchSize + var ErrInvalid = errors.New("env var invalid") + var ErrNoAdvisoryLock = errors.New("can't acquire advisory lock") + var ErrOptimisticUpdateConflict = errors.New("conflict while updating record") + var ErrReleaseLockFailed = errors.New("advisory lock release failed") + var ErrUnset = errors.New("env var unset") + var ErrorNotFound = gorm.ErrRecordNotFound + func Batch(chunkSize uint, cb func(offset, limit uint) (uint, error)) error + func EnvVarName(field string) string + type Config struct + AdvisoryLockID int64 + Dialect dialects.DialectName + SecretGenerator SecretGenerator + func NewConfig() *Config + func (c *Config) SetRuntimeStore(orm *ORM) + func (c *Config) Validate() error + func (c Config) AllowOrigins() string + func (c Config) AuthenticatedRateLimit() int64 + func (c Config) AuthenticatedRateLimitPeriod() models.Duration + func (c Config) BalanceMonitorEnabled() bool + func (c Config) BlockBackfillDepth() uint64 + func (c Config) BridgeResponseURL() *url.URL + func (c Config) CertFile() string + func (c Config) ChainID() *big.Int + func (c Config) ClientNodeURL() string + func (c Config) CreateProductionLogger() *logger.Logger + func (c Config) DatabaseListenerMaxReconnectDuration() time.Duration + func (c Config) DatabaseListenerMinReconnectInterval() time.Duration + func (c Config) DatabaseMaximumTxDuration() time.Duration + func (c Config) DatabaseTimeout() models.Duration + func (c Config) DatabaseURL() string + func (c Config) DefaultHTTPAllowUnrestrictedNetworkAccess() bool + func (c Config) DefaultHTTPLimit() int64 + func (c Config) DefaultHTTPTimeout() models.Duration + func (c Config) DefaultMaxHTTPAttempts() uint + func (c Config) Dev() bool + func (c Config) EnableExperimentalAdapters() bool + func (c Config) EthBalanceMonitorBlockDelay() uint16 + func (c Config) EthFinalityDepth() uint + func (c Config) EthGasBumpPercent() uint16 + func (c Config) EthGasBumpThreshold() uint64 + func (c Config) EthGasBumpTxDepth() uint16 + func (c Config) EthGasBumpWei() *big.Int + func (c Config) EthGasLimitDefault() uint64 + func (c Config) EthGasPriceDefault() *big.Int + func (c Config) EthHeadTrackerHistoryDepth() uint + func (c Config) EthHeadTrackerMaxBufferSize() uint + func (c Config) EthMaxGasPriceWei() *big.Int + func (c Config) EthReceiptFetchBatchSize() uint32 + func (c Config) EthereumDisabled() bool + func (c Config) EthereumSecondaryURLs() []url.URL + func (c Config) EthereumURL() string + func (c Config) ExplorerAccessKey() string + func (c Config) ExplorerSecret() string + func (c Config) ExplorerURL() *url.URL + func (c Config) FeatureExternalInitiators() bool + func (c Config) FeatureFluxMonitor() bool + func (c Config) FeatureOffchainReporting() bool + func (c Config) FlagsContractAddress() string + func (c Config) GasUpdaterBlockDelay() uint16 + func (c Config) GasUpdaterBlockHistorySize() uint16 + func (c Config) GasUpdaterEnabled() bool + func (c Config) GasUpdaterTransactionPercentile() uint16 + func (c Config) GetAdvisoryLockIDConfiguredOrDefault() int64 + func (c Config) GetDatabaseDialectConfiguredOrDefault() dialects.DialectName + func (c Config) GlobalLockRetryInterval() models.Duration + func (c Config) HTTPServerWriteTimeout() time.Duration + func (c Config) InsecureFastScrypt() bool + func (c Config) JSONConsole() bool + func (c Config) JobPipelineMaxRunDuration() time.Duration + func (c Config) JobPipelineMaxTaskDuration() time.Duration + func (c Config) JobPipelineParallelism() uint8 + func (c Config) JobPipelineReaperInterval() time.Duration + func (c Config) JobPipelineReaperThreshold() time.Duration + func (c Config) KeyFile() string + func (c Config) KeysDir() string + func (c Config) LinkContractAddress() string + func (c Config) LogLevel() LogLevel + func (c Config) LogSQLMigrations() bool + func (c Config) LogSQLStatements() bool + func (c Config) LogToDisk() bool + func (c Config) MaximumServiceDuration() models.Duration + func (c Config) MigrateDatabase() bool + func (c Config) MinIncomingConfirmations() uint32 + func (c Config) MinRequiredOutgoingConfirmations() uint64 + func (c Config) MinimumContractPayment() *assets.Link + func (c Config) MinimumRequestExpiration() uint64 + func (c Config) MinimumServiceDuration() models.Duration + func (c Config) OCRBlockchainTimeout(override time.Duration) time.Duration + func (c Config) OCRBootstrapCheckInterval() time.Duration + func (c Config) OCRContractConfirmations(override uint16) uint16 + func (c Config) OCRContractPollInterval(override time.Duration) time.Duration + func (c Config) OCRContractSubscribeInterval(override time.Duration) time.Duration + func (c Config) OCRContractTransmitterTransmitTimeout() time.Duration + func (c Config) OCRDHTLookupInterval() int + func (c Config) OCRDatabaseTimeout() time.Duration + func (c Config) OCRIncomingMessageBufferSize() int + func (c Config) OCRKeyBundleID(override *models.Sha256Hash) (models.Sha256Hash, error) + func (c Config) OCRMonitoringEndpoint(override string) string + func (c Config) OCRNewStreamTimeout() time.Duration + func (c Config) OCRObservationTimeout(override time.Duration) time.Duration + func (c Config) OCROutgoingMessageBufferSize() int + func (c Config) OCRTraceLogging() bool + func (c Config) OCRTransmitterAddress(override *models.EIP55Address) (models.EIP55Address, error) + func (c Config) ORMMaxIdleConns() int + func (c Config) ORMMaxOpenConns() int + func (c Config) OperatorContractAddress() common.Address + func (c Config) P2PAnnounceIP() net.IP + func (c Config) P2PAnnouncePort() uint16 + func (c Config) P2PBootstrapPeers(override []string) ([]string, error) + func (c Config) P2PDHTAnnouncementCounterUserPrefix() uint32 + func (c Config) P2PListenIP() net.IP + func (c Config) P2PListenPort() uint16 + func (c Config) P2PPeerID(override *models.PeerID) (models.PeerID, error) + func (c Config) P2PPeerIDIsSet() bool + func (c Config) P2PPeerstoreWriteInterval() time.Duration + func (c Config) Port() uint16 + func (c Config) ReaperExpiration() models.Duration + func (c Config) ReplayFromBlock() int64 + func (c Config) RootDir() string + func (c Config) SecureCookies() bool + func (c Config) SessionOptions() sessions.Options + func (c Config) SessionSecret() ([]byte, error) + func (c Config) SessionTimeout() models.Duration + func (c Config) Set(name string, value interface{}) + func (c Config) SetEthGasPriceDefault(value *big.Int) error + func (c Config) TLSCertPath() string + func (c Config) TLSHost() string + func (c Config) TLSKeyPath() string + func (c Config) TLSPort() uint16 + func (c Config) TLSRedirect() bool + func (c Config) TriggerFallbackDBPollInterval() time.Duration + func (c Config) UnAuthenticatedRateLimit() int64 + func (c Config) UnAuthenticatedRateLimitPeriod() models.Duration + type ConfigReader interface + AllowOrigins func() string + BlockBackfillDepth func() uint64 + BridgeResponseURL func() *url.URL + CertFile func() string + ChainID func() *big.Int + ClientNodeURL func() string + CreateProductionLogger func() *logger.Logger + DatabaseMaximumTxDuration func() time.Duration + DatabaseTimeout func() models.Duration + DatabaseURL func() string + DefaultHTTPAllowUnrestrictedNetworkAccess func() bool + DefaultHTTPLimit func() int64 + DefaultHTTPTimeout func() models.Duration + DefaultMaxHTTPAttempts func() uint + Dev func() bool + EnableExperimentalAdapters func() bool + EthBalanceMonitorBlockDelay func() uint16 + EthFinalityDepth func() uint + EthGasBumpPercent func() uint16 + EthGasBumpThreshold func() uint64 + EthGasBumpTxDepth func() uint16 + EthGasBumpWei func() *big.Int + EthGasLimitDefault func() uint64 + EthGasPriceDefault func() *big.Int + EthHeadTrackerHistoryDepth func() uint + EthHeadTrackerMaxBufferSize func() uint + EthMaxGasPriceWei func() *big.Int + EthReceiptFetchBatchSize func() uint32 + EthereumSecondaryURLs func() []url.URL + EthereumURL func() string + ExplorerAccessKey func() string + ExplorerSecret func() string + ExplorerURL func() *url.URL + FeatureExternalInitiators func() bool + FeatureFluxMonitor func() bool + FeatureOffchainReporting func() bool + GasUpdaterBlockDelay func() uint16 + GasUpdaterBlockHistorySize func() uint16 + GasUpdaterTransactionPercentile func() uint16 + JSONConsole func() bool + KeyFile func() string + KeysDir func() string + LinkContractAddress func() string + LogLevel func() LogLevel + LogSQLStatements func() bool + LogToDisk func() bool + MaximumServiceDuration func() models.Duration + MigrateDatabase func() bool + MinIncomingConfirmations func() uint32 + MinRequiredOutgoingConfirmations func() uint64 + MinimumContractPayment func() *assets.Link + MinimumRequestExpiration func() uint64 + MinimumServiceDuration func() models.Duration + OCRTraceLogging func() bool + OperatorContractAddress func() common.Address + Port func() uint16 + ReaperExpiration func() models.Duration + RootDir func() string + SecureCookies func() bool + SessionOptions func() sessions.Options + SessionSecret func() ([]byte, error) + SessionTimeout func() models.Duration + SetEthGasPriceDefault func(value *big.Int) error + TLSCertPath func() string + TLSHost func() string + TLSKeyPath func() string + TLSPort func() uint16 + TLSRedirect func() bool + TriggerFallbackDBPollInterval func() time.Duration + type ConfigSchema struct + AllowOrigins string + AuthenticatedRateLimit int64 + AuthenticatedRateLimitPeriod time.Duration + BalanceMonitorEnabled bool + BlockBackfillDepth string + BridgeResponseURL url.URL + ChainID big.Int + ClientNodeURL string + DatabaseListenerMaxReconnectDuration time.Duration + DatabaseListenerMinReconnectInterval time.Duration + DatabaseMaximumTxDuration time.Duration + DatabaseTimeout models.Duration + DatabaseURL string + DefaultHTTPAllowUnrestrictedNetworkAccess bool + DefaultHTTPLimit int64 + DefaultHTTPTimeout models.Duration + DefaultMaxHTTPAttempts uint + Dev bool + EnableExperimentalAdapters bool + EthBalanceMonitorBlockDelay uint16 + EthFinalityDepth uint + EthGasBumpPercent uint16 + EthGasBumpThreshold uint64 + EthGasBumpTxDepth uint16 + EthGasBumpWei big.Int + EthGasLimitDefault uint64 + EthGasPriceDefault big.Int + EthHeadTrackerHistoryDepth uint + EthHeadTrackerMaxBufferSize uint + EthMaxGasPriceWei uint64 + EthReceiptFetchBatchSize uint32 + EthereumDisabled bool + EthereumSecondaryURL string + EthereumSecondaryURLs string + EthereumURL string + ExplorerAccessKey string + ExplorerSecret string + ExplorerURL *url.URL + FeatureExternalInitiators bool + FeatureFluxMonitor bool + FeatureOffchainReporting bool + FlagsContractAddress string + GasUpdaterBlockDelay uint16 + GasUpdaterBlockHistorySize uint16 + GasUpdaterEnabled bool + GasUpdaterTransactionPercentile uint16 + GlobalLockRetryInterval models.Duration + HTTPServerWriteTimeout time.Duration + InsecureFastScrypt bool + JSONConsole bool + JobPipelineMaxRunDuration time.Duration + JobPipelineMaxTaskDuration time.Duration + JobPipelineParallelism uint8 + JobPipelineReaperInterval time.Duration + JobPipelineReaperThreshold time.Duration + LinkContractAddress string + LogLevel LogLevel + LogSQLMigrations bool + LogSQLStatements bool + LogToDisk bool + MaximumServiceDuration models.Duration + MigrateDatabase bool + MinIncomingConfirmations uint32 + MinRequiredOutgoingConfirmations uint64 + MinimumContractPayment assets.Link + MinimumRequestExpiration uint64 + MinimumServiceDuration models.Duration + OCRBlockchainTimeout time.Duration + OCRBootstrapCheckInterval time.Duration + OCRContractConfirmations uint + OCRContractPollInterval time.Duration + OCRContractSubscribeInterval time.Duration + OCRContractTransmitterTransmitTimeout time.Duration + OCRDHTLookupInterval int + OCRDatabaseTimeout time.Duration + OCRIncomingMessageBufferSize int + OCRKeyBundleID string + OCRMonitoringEndpoint string + OCRNewStreamTimeout time.Duration + OCRObservationTimeout time.Duration + OCROutgoingMessageBufferSize int + OCRTraceLogging bool + OCRTransmitterAddress string + ORMMaxIdleConns int + ORMMaxOpenConns int + OperatorContractAddress common.Address + P2PAnnounceIP net.IP + P2PAnnouncePort uint16 + P2PBootstrapPeers []string + P2PDHTAnnouncementCounterUserPrefix uint32 + P2PListenIP net.IP + P2PListenPort uint16 + P2PPeerID models.PeerID + P2PPeerstoreWriteInterval time.Duration + Port uint16 + ReaperExpiration models.Duration + ReplayFromBlock int64 + RootDir string + SecureCookies bool + SessionTimeout models.Duration + TLSCertPath string + TLSHost string + TLSKeyPath string + TLSPort uint16 + TLSRedirect bool + TriggerFallbackDBPollInterval time.Duration + UnAuthenticatedRateLimit int64 + UnAuthenticatedRateLimitPeriod time.Duration + type Connection struct + func NewConnection(dialect dialects.DialectName, uri string, advisoryLockID int64, ...) (Connection, error) + type LockingStrategy interface + Lock func(timeout models.Duration) error + Unlock func(timeout models.Duration) error + func NewLockingStrategy(ct Connection) (LockingStrategy, error) + func NewPostgresLockingStrategy(ct Connection) (LockingStrategy, error) + type LogLevel struct + func (ll LogLevel) ForGin() string + type ORM struct + DB *gorm.DB + func NewORM(uri string, timeout models.Duration, shutdownSignal gracefulpanic.Signal, ...) (*ORM, error) + func (orm *ORM) AllKeys() ([]models.Key, error) + func (orm *ORM) AnyJobWithType(taskTypeName string) (bool, error) + func (orm *ORM) ArchiveEncryptedSecretVRFKey(k *vrfkey.EncryptedVRFKey) error + func (orm *ORM) ArchiveJob(ID models.JobID) error + func (orm *ORM) AuthorizedUserWithSession(sessionID string, sessionDuration time.Duration) (models.User, error) + func (orm *ORM) BridgeTypes(offset int, limit int) ([]models.BridgeType, int, error) + func (orm *ORM) BulkDeleteRuns(bulkQuery *models.BulkDeleteRunRequest) error + func (orm *ORM) Chain(hash common.Hash, lookback uint) (models.Head, error) + func (orm *ORM) ClearNonCurrentSessions(sessionID string) error + func (orm *ORM) ClearSessions() error + func (orm *ORM) ClobberDiskKeyStoreWithDBKeys(keysDir string) error + func (orm *ORM) Close() error + func (orm *ORM) CountOf(t interface{}) (int, error) + func (orm *ORM) CreateBridgeType(bt *models.BridgeType) error + func (orm *ORM) CreateExternalInitiator(externalInitiator *models.ExternalInitiator) error + func (orm *ORM) CreateInitiator(initr *models.Initiator) error + func (orm *ORM) CreateJob(job *models.JobSpec) error + func (orm *ORM) CreateJobRun(run *models.JobRun) error + func (orm *ORM) CreateKeyIfNotExists(k models.Key) error + func (orm *ORM) CreateServiceAgreement(sa *models.ServiceAgreement) error + func (orm *ORM) CreateSession(sr models.SessionRequest) (string, error) + func (orm *ORM) DeleteBridgeType(bt *models.BridgeType) error + func (orm *ORM) DeleteEncryptedSecretVRFKey(k *vrfkey.EncryptedVRFKey) error + func (orm *ORM) DeleteExternalInitiator(name string) error + func (orm *ORM) DeleteFluxMonitorRoundsBackThrough(aggregator common.Address, roundID uint32) error + func (orm *ORM) DeleteJobSpecError(ID int64) error + func (orm *ORM) DeleteKey(address common.Address) error + func (orm *ORM) DeleteStaleSessions(before time.Time) error + func (orm *ORM) DeleteUser() error + func (orm *ORM) DeleteUserSession(sessionID string) error + func (orm *ORM) EthTransactionsWithAttempts(offset, limit int) ([]models.EthTx, int, error) + func (orm *ORM) EthTxAttempts(offset, limit int) ([]models.EthTxAttempt, int, error) + func (orm *ORM) FindBridge(name models.TaskType) (bt models.BridgeType, err error) + func (orm *ORM) FindBridgesByNames(names []string) ([]models.BridgeType, error) + func (orm *ORM) FindEncryptedSecretVRFKeys(where ...vrfkey.EncryptedVRFKey) (retrieved []*vrfkey.EncryptedVRFKey, err error) + func (orm *ORM) FindEthTaskRunTxByTaskRunID(taskRunID uuid.UUID) (*models.EthTaskRunTx, error) + func (orm *ORM) FindEthTxAttempt(hash common.Hash) (*models.EthTxAttempt, error) + func (orm *ORM) FindEthTxWithAttempts(etxID int64) (models.EthTx, error) + func (orm *ORM) FindExternalInitiator(eia *auth.Token) (*models.ExternalInitiator, error) + func (orm *ORM) FindExternalInitiatorByName(iname string) (exi models.ExternalInitiator, err error) + func (orm *ORM) FindInitiator(ID int64) (initr models.Initiator, err error) + func (orm *ORM) FindJobRun(id uuid.UUID) (jr models.JobRun, err error) + func (orm *ORM) FindJobRunIncludingArchived(id uuid.UUID) (jr models.JobRun, err error) + func (orm *ORM) FindJobSpec(id models.JobID) (job models.JobSpec, err error) + func (orm *ORM) FindJobSpecError(jobID models.JobID, description string) (*models.JobSpecError, error) + func (orm *ORM) FindJobSpecUnscoped(id models.JobID) (job models.JobSpec, err error) + func (orm *ORM) FindJobWithErrors(id models.JobID) (models.JobSpec, error) + func (orm *ORM) FindOrCreateFluxMonitorRoundStats(aggregator common.Address, roundID uint32) (stats models.FluxMonitorRoundStats, err error) + func (orm *ORM) FindServiceAgreement(id string) (sa models.ServiceAgreement, err error) + func (orm *ORM) FindUser() (models.User, error) + func (orm *ORM) FirstOrCreateEncryptedSecretVRFKey(k *vrfkey.EncryptedVRFKey) error + func (orm *ORM) GetConfigValue(field string, value encoding.TextUnmarshaler) error + func (orm *ORM) GetRoundRobinAddress(addresses ...common.Address) (address common.Address, err error) + func (orm *ORM) HeadByHash(hash common.Hash) (*models.Head, error) + func (orm *ORM) IdempotentInsertEthTaskRunTx(taskRunID uuid.UUID, fromAddress common.Address, toAddress common.Address, ...) error + func (orm *ORM) IdempotentInsertHead(h models.Head) error + func (orm *ORM) JobRunsCountFor(jobSpecID models.JobID) (int, error) + func (orm *ORM) JobRunsFor(jobSpecID models.JobID, limit ...int) ([]models.JobRun, error) + func (orm *ORM) JobRunsSorted(sort SortType, offset int, limit int) ([]models.JobRun, int, error) + func (orm *ORM) JobRunsSortedFor(id models.JobID, order SortType, offset int, limit int) ([]models.JobRun, int, error) + func (orm *ORM) Jobs(cb func(*models.JobSpec) bool, initrTypes ...string) error + func (orm *ORM) JobsSorted(sort SortType, offset int, limit int) ([]models.JobSpec, int, error) + func (orm *ORM) KeyByAddress(address common.Address) (models.Key, error) + func (orm *ORM) KeyExists(address common.Address) (bool, error) + func (orm *ORM) LastHead() (*models.Head, error) + func (orm *ORM) LinkEarnedFor(spec *models.JobSpec) (*assets.Link, error) + func (orm *ORM) MarkRan(i models.Initiator, ran bool) error + func (orm *ORM) MostRecentFluxMonitorRoundID(aggregator common.Address) (uint32, error) + func (orm *ORM) MustEnsureAdvisoryLock() error + func (orm *ORM) MustSQLDB() *sql.DB + func (orm *ORM) PendingBridgeType(jr models.JobRun) (bt models.BridgeType, err error) + func (orm *ORM) RawDBWithAdvisoryLock(fn func(*gorm.DB) error) error + func (orm *ORM) RemoveUnstartedTransactions() error + func (orm *ORM) SaveJobRun(run *models.JobRun) error + func (orm *ORM) SaveSession(session *models.Session) error + func (orm *ORM) SaveUser(user *models.User) error + func (orm *ORM) SendKeys() ([]models.Key, error) + func (orm *ORM) Sessions(offset, limit int) ([]models.Session, error) + func (orm *ORM) SetConfigValue(field string, value encoding.TextMarshaler) error + func (orm *ORM) SetLogging(enabled bool) + func (orm *ORM) Transaction(fc func(tx *gorm.DB) error) (err error) + func (orm *ORM) TrimOldHeads(n uint) (err error) + func (orm *ORM) Unscoped() *ORM + func (orm *ORM) UnscopedJobRunsWithStatus(cb func(*models.JobRun), statuses ...models.RunStatus) error + func (orm *ORM) UpdateBridgeType(bt *models.BridgeType, btr *models.BridgeTypeRequest) error + func (orm *ORM) UpdateFluxMonitorRoundStats(aggregator common.Address, roundID uint32, jobRunID uuid.UUID) error + func (orm *ORM) UpsertErrorFor(jobID models.JobID, description string) + type PostgresLockingStrategy struct + func (s *PostgresLockingStrategy) Lock(timeout models.Duration) error + func (s *PostgresLockingStrategy) Unlock(timeout models.Duration) error + type SecretGenerator interface + Generate func(Config) ([]byte, error) + type SortType int + const Ascending + const Descending + func (s SortType) String() string