Documentation ¶
Index ¶
- Variables
- func Batch(chunkSize uint, cb func(offset, limit uint) (uint, error)) error
- func EnvVarName(field string) string
- func NormalizedDatabaseURL(c ConfigReader) string
- type Config
- func (c Config) AllowOrigins() string
- 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() *zap.Logger
- func (c Config) DatabaseTimeout() time.Duration
- func (c Config) DatabaseURL() string
- func (c Config) DefaultHTTPLimit() int64
- func (c Config) Dev() bool
- func (c Config) EthGasBumpThreshold() uint64
- func (c Config) EthGasBumpWei() *big.Int
- func (c Config) EthGasPriceDefault() *big.Int
- func (c Config) EthereumURL() string
- func (c Config) ExplorerAccessKey() string
- func (c Config) ExplorerSecret() string
- func (c Config) ExplorerURL() *url.URL
- func (c Config) JSONConsole() bool
- 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) MaxRPCCallsPerSecond() uint64
- func (c Config) MaximumServiceDuration() time.Duration
- func (c Config) MinIncomingConfirmations() uint32
- func (c Config) MinOutgoingConfirmations() uint64
- func (c Config) MinimumContractPayment() *assets.Link
- func (c Config) MinimumRequestExpiration() uint64
- func (c Config) MinimumServiceDuration() time.Duration
- func (c Config) OracleContractAddress() *common.Address
- func (c Config) Port() uint16
- func (c Config) ReaperExpiration() time.Duration
- 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() time.Duration
- func (c Config) Set(name string, value interface{})
- func (c Config) SetEthGasPriceDefault(value *big.Int) error
- func (c *Config) SetRuntimeStore(orm *ORM)
- 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) TxAttemptLimit() uint16
- type ConfigReader
- type ConfigSchema
- type DialectName
- type FileLockingStrategy
- type LockingStrategy
- type LogLevel
- type ORM
- func (orm *ORM) AddTxAttempt(tx *models.Tx, etx *types.Transaction, blkNum uint64) (*models.TxAttempt, error)
- func (orm *ORM) AllSyncEvents(cb func(*models.SyncEvent) error) error
- func (orm *ORM) AnyJobWithType(taskTypeName string) (bool, error)
- func (orm *ORM) ArchiveJob(ID *models.ID) error
- func (orm *ORM) Archived(id *models.ID) bool
- 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) ClearNonCurrentSessions(sessionID string) error
- func (orm *ORM) ClearSessions() error
- func (orm *ORM) ClobberDiskKeyStoreWithDBKeys(keysDir string) error
- func (orm *ORM) Close() error
- func (orm *ORM) CreateBridgeType(bt *models.BridgeType) error
- func (orm *ORM) CreateExternalInitiator(externalInitiator *models.ExternalInitiator) error
- func (orm *ORM) CreateHead(n *models.Head) 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) CreateServiceAgreement(sa *models.ServiceAgreement) error
- func (orm *ORM) CreateSession(sr models.SessionRequest) (string, error)
- func (orm *ORM) CreateTx(surrogateID null.String, ethTx *types.Transaction, from *common.Address, ...) (*models.Tx, error)
- func (orm *ORM) DeleteBridgeType(bt *models.BridgeType) error
- func (orm *ORM) DeleteExternalInitiator(accessKey string) error
- func (orm *ORM) DeleteJobRun(ID string) error
- func (orm *ORM) DeleteStaleSessions(before time.Time) error
- func (orm *ORM) DeleteTransaction(ethtx *models.Tx) error
- func (orm *ORM) DeleteUser() (models.User, error)
- func (orm *ORM) DeleteUserSession(sessionID string) error
- func (orm *ORM) DialectName() DialectName
- func (orm *ORM) FindBridge(name models.TaskType) (models.BridgeType, error)
- func (orm *ORM) FindExternalInitiator(eia *models.ExternalInitiatorAuthentication) (*models.ExternalInitiator, error)
- func (orm *ORM) FindExternalInitiatorByName(name string) (models.ExternalInitiator, error)
- func (orm *ORM) FindInitiator(ID uint) (models.Initiator, error)
- func (orm *ORM) FindJob(id *models.ID) (models.JobSpec, error)
- func (orm *ORM) FindJobRun(id *models.ID) (models.JobRun, error)
- func (orm *ORM) FindServiceAgreement(id string) (models.ServiceAgreement, error)
- func (orm *ORM) FindTx(ID uint64) (*models.Tx, error)
- func (orm *ORM) FindTxAttempt(hash common.Hash) (*models.TxAttempt, error)
- func (orm *ORM) FindTxByAttempt(hash common.Hash) (*models.Tx, *models.TxAttempt, error)
- func (orm *ORM) FindUser() (models.User, error)
- func (orm *ORM) FirstHead() (*models.Head, error)
- func (orm *ORM) FirstOrCreateKey(k *models.Key) error
- func (orm *ORM) GetConfigValue(field string, value encoding.TextUnmarshaler) error
- func (orm *ORM) GetLastNonce(address common.Address) (uint64, error)
- func (orm *ORM) JobRunsCountFor(jobSpecID *models.ID) (int, error)
- func (orm *ORM) JobRunsFor(jobSpecID *models.ID, 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.ID, order SortType, offset int, limit int) ([]models.JobRun, int, error)
- func (orm *ORM) Jobs(cb func(models.JobSpec) bool) error
- func (orm *ORM) JobsSorted(sort SortType, offset int, limit int) ([]models.JobSpec, int, error)
- func (orm *ORM) Keys() ([]*models.Key, 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) MarkTxSafe(tx *models.Tx, txAttempt *models.TxAttempt) error
- func (orm *ORM) PendingBridgeType(jr models.JobRun) (models.BridgeType, error)
- func (orm *ORM) SaveJobRun(run *models.JobRun) error
- func (orm *ORM) SaveSession(session *models.Session) error
- func (orm *ORM) SaveTx(tx *models.Tx) error
- func (orm *ORM) SaveUser(user *models.User) 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) Transactions(offset, limit int) ([]models.Tx, int, error)
- func (orm *ORM) TxAttempts(offset, limit int) ([]models.TxAttempt, int, error)
- func (orm *ORM) TxFrom(from common.Address) ([]models.Tx, 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) UpdateTx(tx *models.Tx, ethTx *types.Transaction, from *common.Address, sentAt uint64) error
- func (orm *ORM) Where(field string, value interface{}, instance interface{}) error
- type PostgresLockingStrategy
- type SecretGenerator
- type SortType
Constants ¶
This section is empty.
Variables ¶
var ( // ErrorNotFound is returned when finding a single value fails. ErrorNotFound = gorm.ErrRecordNotFound )
Functions ¶
func EnvVarName ¶ added in v0.6.6
EnvVarName gets the environment variable name for a config schema field
func NormalizedDatabaseURL ¶ added in v0.6.6
func NormalizedDatabaseURL(c ConfigReader) string
NormalizedDatabaseURL returns the DatabaseURL with the empty default coerced to a sqlite3 URL.
Types ¶
type Config ¶ added in v0.6.6
type Config struct { SecretGenerator SecretGenerator // contains filtered or unexported fields }
Config holds parameters used by the application which can be overridden by setting environment variables.
If you add an entry here which does not contain sensitive information, you should also update presenters.ConfigWhitelist and cmd_test.TestClient_RunNodeShowsEnv.
func NewConfig ¶ added in v0.6.6
func NewConfig() *Config
NewConfig returns the config with the environment variables set to their respective fields, or their defaults if environment variables are not set.
func (Config) AllowOrigins ¶ added in v0.6.6
AllowOrigins returns the CORS hosts used by the frontend.
func (Config) BridgeResponseURL ¶ added in v0.6.6
BridgeResponseURL represents the URL for bridges to send a response to.
func (Config) CertFile ¶ added in v0.6.6
CertFile returns the path where the server certificate is kept
func (Config) ClientNodeURL ¶ added in v0.6.6
ClientNodeURL is the URL of the Ethereum node this Chainlink node should connect to.
func (Config) CreateProductionLogger ¶ added in v0.6.6
CreateProductionLogger returns a custom logger for the config's root directory and LogLevel, with pretty printing for stdout. If LOG_TO_DISK is false, the logger will only log to stdout.
func (Config) DatabaseTimeout ¶ added in v0.6.6
DatabaseTimeout represents how long to tolerate non response from the DB.
func (Config) DatabaseURL ¶ added in v0.6.6
DatabaseURL configures the URL for chainlink to connect to. This must be a properly formatted URL, with a valid scheme (postgres://, file://), or an empty string, so the application defaults to .chainlink/db.sqlite.
func (Config) DefaultHTTPLimit ¶ added in v0.6.6
DefaultHTTPLimit defines the limit for HTTP requests.
func (Config) EthGasBumpThreshold ¶ added in v0.6.6
EthGasBumpThreshold represents the maximum amount a transaction's ETH amount should be increased in order to facilitate a transaction.
func (Config) EthGasBumpWei ¶ added in v0.6.6
EthGasBumpWei represents the intervals in which ETH should be increased when doing gas bumping.
func (Config) EthGasPriceDefault ¶ added in v0.6.6
EthGasPriceDefault represents the default gas price for transactions.
func (Config) EthereumURL ¶ added in v0.6.6
EthereumURL represents the URL of the Ethereum node to connect Chainlink to.
func (Config) ExplorerAccessKey ¶ added in v0.6.6
ExplorerAccessKey returns the access key for authenticating with explorer
func (Config) ExplorerSecret ¶ added in v0.6.6
ExplorerSecret returns the secret for authenticating with explorer
func (Config) ExplorerURL ¶ added in v0.6.6
ExplorerURL returns the websocket URL for this node to push stats to, or nil.
func (Config) JSONConsole ¶ added in v0.6.6
JSONConsole enables the JSON console.
func (Config) KeysDir ¶ added in v0.6.6
KeysDir returns the path of the keys directory (used for keystore files).
func (Config) LinkContractAddress ¶ added in v0.6.6
LinkContractAddress represents the address
func (Config) LogLevel ¶ added in v0.6.6
LogLevel represents the maximum level of log messages to output.
func (Config) LogSQLMigrations ¶ added in v0.6.6
LogSQLMigrations tells chainlink to log all SQL migrations made using the default logger
func (Config) LogSQLStatements ¶ added in v0.6.6
LogSQLStatements tells chainlink to log all SQL statements made using the default logger
func (Config) MaxRPCCallsPerSecond ¶ added in v0.6.6
MaxRPCCallsPerSecond returns the rate at which RPC calls can be fired
func (Config) MaximumServiceDuration ¶ added in v0.6.6
MaximumServiceDuration is the maximum time that a service agreement can run from after the time it is created. Default 1 year = 365 * 24h = 8760h
func (Config) MinIncomingConfirmations ¶ added in v0.6.6
MinIncomingConfirmations represents the minimum number of block confirmations that need to be recorded since a job run started before a task can proceed.
func (Config) MinOutgoingConfirmations ¶ added in v0.6.6
MinOutgoingConfirmations represents the minimum number of block confirmations that need to be recorded on an outgoing transaction before a task is completed.
func (Config) MinimumContractPayment ¶ added in v0.6.6
MinimumContractPayment represents the minimum amount of ETH that must be supplied for a contract to be considered.
func (Config) MinimumRequestExpiration ¶ added in v0.6.6
MinimumRequestExpiration is the minimum allowed request expiration for a Service Agreement.
func (Config) MinimumServiceDuration ¶ added in v0.6.6
MinimumServiceDuration is the shortest duration from now that a service is allowed to run.
func (Config) OracleContractAddress ¶ added in v0.6.6
OracleContractAddress represents the deployed Oracle contract's address.
func (Config) Port ¶ added in v0.6.6
Port represents the port Chainlink should listen on for client requests.
func (Config) ReaperExpiration ¶ added in v0.6.6
ReaperExpiration represents
func (Config) RootDir ¶ added in v0.6.6
RootDir represents the location on the file system where Chainlink should keep its files.
func (Config) SecureCookies ¶ added in v0.6.6
SecureCookies allows toggling of the secure cookies HTTP flag
func (Config) SessionOptions ¶ added in v0.6.6
SessionOptions returns the sesssions.Options struct used to configure the session store.
func (Config) SessionSecret ¶ added in v0.6.6
SessionSecret returns a sequence of bytes to be used as a private key for session signing or encryption.
func (Config) SessionTimeout ¶ added in v0.6.6
SessionTimeout is the maximum duration that a user session can persist without any activity.
func (Config) SetEthGasPriceDefault ¶ added in v0.6.6
SetEthGasPriceDefault saves a runtime value for the default gas price for transactions
func (*Config) SetRuntimeStore ¶ added in v0.6.6
SetRuntimeStore tells the configuration system to use a store for retrieving configuration variables that can be configured at runtime.
func (Config) TLSCertPath ¶ added in v0.6.6
TLSCertPath represents the file system location of the TLS certificate Chainlink should use for HTTPS.
func (Config) TLSHost ¶ added in v0.6.6
TLSHost represents the hostname to use for TLS clients. This should match the TLS certificate.
func (Config) TLSKeyPath ¶ added in v0.6.6
TLSKeyPath represents the file system location of the TLS key Chainlink should use for HTTPS.
func (Config) TLSPort ¶ added in v0.6.6
TLSPort represents the port Chainlink should listen on for encrypted client requests.
func (Config) TLSRedirect ¶ added in v0.6.6
TLSRedirect forces TLS redirect for unencrypted connections
func (Config) TxAttemptLimit ¶ added in v0.6.6
TxAttemptLimit represents the maximum number of transaction attempts that the TxManager should allow to for a transaction
type ConfigReader ¶ added in v0.6.6
type ConfigReader interface { AllowOrigins() string BridgeResponseURL() *url.URL ChainID() *big.Int ClientNodeURL() string DatabaseTimeout() time.Duration DatabaseURL() string DefaultHTTPLimit() int64 Dev() bool MaximumServiceDuration() time.Duration MinimumServiceDuration() time.Duration EthGasBumpThreshold() uint64 EthGasBumpWei() *big.Int EthGasPriceDefault() *big.Int SetEthGasPriceDefault(value *big.Int) error EthereumURL() string JSONConsole() bool LinkContractAddress() string ExplorerURL() *url.URL ExplorerAccessKey() string ExplorerSecret() string OracleContractAddress() *common.Address LogLevel() LogLevel LogToDisk() bool LogSQLStatements() bool MinIncomingConfirmations() uint32 MinOutgoingConfirmations() uint64 MinimumContractPayment() *assets.Link MinimumRequestExpiration() uint64 Port() uint16 ReaperExpiration() time.Duration RootDir() string SecureCookies() bool SessionTimeout() time.Duration TLSCertPath() string TLSHost() string TLSKeyPath() string TLSPort() uint16 TLSRedirect() bool TxAttemptLimit() uint16 KeysDir() string KeyFile() string CertFile() string CreateProductionLogger() *zap.Logger SessionSecret() ([]byte, error) SessionOptions() sessions.Options // contains filtered or unexported methods }
ConfigReader represents just the read side of the config
type ConfigSchema ¶ added in v0.6.6
type ConfigSchema struct { AllowOrigins string `env:"ALLOW_ORIGINS" default:"http://localhost:3000,http://localhost:6688"` BridgeResponseURL url.URL `env:"BRIDGE_RESPONSE_URL"` ChainID big.Int `env:"ETH_CHAIN_ID" default:"0"` ClientNodeURL string `env:"CLIENT_NODE_URL" default:"http://localhost:6688"` DatabaseTimeout time.Duration `env:"DATABASE_TIMEOUT" default:"500ms"` DatabaseURL string `env:"DATABASE_URL"` DefaultHTTPLimit int64 `env:"DEFAULT_HTTP_LIMIT" default:"32768"` Dev bool `env:"CHAINLINK_DEV" default:"false"` MaximumServiceDuration time.Duration `env:"MAXIMUM_SERVICE_DURATION" default:"8760h" ` MinimumServiceDuration time.Duration `env:"MINIMUM_SERVICE_DURATION" default:"0s" ` EthGasBumpThreshold uint64 `env:"ETH_GAS_BUMP_THRESHOLD" default:"12" ` EthGasBumpWei big.Int `env:"ETH_GAS_BUMP_WEI" default:"5000000000"` EthGasPriceDefault big.Int `env:"ETH_GAS_PRICE_DEFAULT" default:"20000000000"` EthereumURL string `env:"ETH_URL" default:"ws://localhost:8546"` JSONConsole bool `env:"JSON_CONSOLE" default:"false"` LinkContractAddress string `env:"LINK_CONTRACT_ADDRESS" default:"0x514910771AF9Ca656af840dff83E8264EcF986CA"` ExplorerURL *url.URL `env:"EXPLORER_URL"` ExplorerAccessKey string `env:"EXPLORER_ACCESS_KEY"` ExplorerSecret string `env:"EXPLORER_SECRET"` LogLevel LogLevel `env:"LOG_LEVEL" default:"info"` LogToDisk bool `env:"LOG_TO_DISK" default:"true"` LogSQLStatements bool `env:"LOG_SQL" default:"false"` LogSQLMigrations bool `env:"LOG_SQL_MIGRATIONS" default:"true"` MinIncomingConfirmations uint32 `env:"MIN_INCOMING_CONFIRMATIONS" default:"3"` MinOutgoingConfirmations uint64 `env:"MIN_OUTGOING_CONFIRMATIONS" default:"12"` MinimumContractPayment assets.Link `env:"MINIMUM_CONTRACT_PAYMENT" default:"1000000000000000000"` MinimumRequestExpiration uint64 `env:"MINIMUM_REQUEST_EXPIRATION" default:"300"` MaxRPCCallsPerSecond uint64 `env:"MAX_RPC_CALLS_PER_SECOND" default:"500"` OracleContractAddress common.Address `env:"ORACLE_CONTRACT_ADDRESS"` Port uint16 `env:"CHAINLINK_PORT" default:"6688"` ReaperExpiration time.Duration `env:"REAPER_EXPIRATION" default:"240h"` RootDir string `env:"ROOT" default:"~/.chainlink"` SecureCookies bool `env:"SECURE_COOKIES" default:"true"` SessionTimeout time.Duration `env:"SESSION_TIMEOUT" default:"15m"` TLSCertPath string `env:"TLS_CERT_PATH" ` TLSHost string `env:"CHAINLINK_TLS_HOST" ` TLSKeyPath string `env:"TLS_KEY_PATH" ` TLSPort uint16 `env:"CHAINLINK_TLS_PORT" default:"6689"` TLSRedirect bool `env:"CHAINLINK_TLS_REDIRECT" default:"false"` TxAttemptLimit uint16 `env:"CHAINLINK_TX_ATTEMPT_LIMIT" default:"10"` }
ConfigSchema records the schema of configuration at the type level
type DialectName ¶
type DialectName string
DialectName is a compiler enforced type used that maps to gorm's dialect names.
const ( // DialectPostgres represents the postgres dialect. DialectPostgres DialectName = "postgres" // DialectSqlite represents the sqlite dialect. DialectSqlite = "sqlite3" )
func DeduceDialect ¶
func DeduceDialect(path string) (DialectName, error)
DeduceDialect returns the appropriate dialect for the passed connection string.
type FileLockingStrategy ¶
type FileLockingStrategy struct {
// contains filtered or unexported fields
}
FileLockingStrategy uses a file lock on disk to ensure exclusive access.
type LockingStrategy ¶
LockingStrategy employs the locking and unlocking of an underlying resource for exclusive access, usually a file or database.
func NewFileLockingStrategy ¶
func NewFileLockingStrategy(dbpath string) (LockingStrategy, error)
NewFileLockingStrategy creates a new instance of FileLockingStrategy at the passed path.
func NewLockingStrategy ¶
func NewLockingStrategy(dialect DialectName, dbpath string) (LockingStrategy, error)
NewLockingStrategy returns the locking strategy for a particular dialect to ensure exlusive access to the orm.
func NewPostgresLockingStrategy ¶
func NewPostgresLockingStrategy(path string) (LockingStrategy, error)
NewPostgresLockingStrategy returns a new instance of the PostgresLockingStrategy.
type ORM ¶
ORM contains the database object used by Chainlink.
func (*ORM) AddTxAttempt ¶
func (orm *ORM) AddTxAttempt( tx *models.Tx, etx *types.Transaction, blkNum uint64, ) (*models.TxAttempt, error)
AddTxAttempt creates a new transaction attempt and stores it in the database.
func (*ORM) AllSyncEvents ¶
AllSyncEvents returns all sync events
func (*ORM) AnyJobWithType ¶
AnyJobWithType returns true if there is at least one job associated with the type name specified and false otherwise
func (*ORM) ArchiveJob ¶
ArchiveJob soft deletes the job and its associated job runs.
func (*ORM) AuthorizedUserWithSession ¶
func (orm *ORM) AuthorizedUserWithSession(sessionID string, sessionDuration time.Duration) (models.User, error)
AuthorizedUserWithSession will return the one API user if the Session ID exists and hasn't expired, and update session's LastUsed field.
func (*ORM) BridgeTypes ¶
BridgeTypes returns bridge types ordered by name filtered limited by the passed params.
func (*ORM) BulkDeleteRuns ¶
func (orm *ORM) BulkDeleteRuns(bulkQuery *models.BulkDeleteRunRequest) error
BulkDeleteRuns removes JobRuns and their related records: TaskRuns and RunResults.
TaskRuns are removed by ON DELETE CASCADE when the JobRuns are deleted, but RunResults are not using foreign keys because multiple foreign keys on a record creates an ambiguity with gorm.
func (*ORM) ClearNonCurrentSessions ¶
ClearNonCurrentSessions removes all sessions but the id passed in.
func (*ORM) ClearSessions ¶
ClearSessions removes all sessions.
func (*ORM) ClobberDiskKeyStoreWithDBKeys ¶
ClobberDiskKeyStoreWithDBKeys writes all keys stored in the orm to the keys folder on disk, deleting anything there prior.
func (*ORM) CreateBridgeType ¶
func (orm *ORM) CreateBridgeType(bt *models.BridgeType) error
CreateBridgeType saves the bridge type.
func (*ORM) CreateExternalInitiator ¶
func (orm *ORM) CreateExternalInitiator(externalInitiator *models.ExternalInitiator) error
CreateExternalInitiator inserts a new external initiator
func (*ORM) CreateHead ¶ added in v0.6.1
CreateHead creates a head record that tracks which block heads we've observed in the HeadTracker
func (*ORM) CreateInitiator ¶
CreateInitiator saves the initiator.
func (*ORM) CreateJobRun ¶
CreateJobRun inserts a new JobRun
func (*ORM) CreateServiceAgreement ¶
func (orm *ORM) CreateServiceAgreement(sa *models.ServiceAgreement) error
CreateServiceAgreement saves a Service Agreement, its JobSpec and its associations to the database.
func (*ORM) CreateSession ¶
func (orm *ORM) CreateSession(sr models.SessionRequest) (string, error)
CreateSession will check the password in the SessionRequest against the hashed API User password in the db.
func (*ORM) CreateTx ¶
func (orm *ORM) CreateTx( surrogateID null.String, ethTx *types.Transaction, from *common.Address, sentAt uint64, ) (*models.Tx, error)
CreateTx returns a transaction by its surrogate key, if it exists, or creates it and its attempts
func (*ORM) DeleteBridgeType ¶
func (orm *ORM) DeleteBridgeType(bt *models.BridgeType) error
DeleteBridgeType removes the bridge type
func (*ORM) DeleteExternalInitiator ¶
DeleteExternalInitiator removes an external initiator
func (*ORM) DeleteJobRun ¶
DeleteJobRun deletes the job run and corresponding task runs.
func (*ORM) DeleteStaleSessions ¶
DeleteStaleSessions deletes all sessions before the passed time.
func (*ORM) DeleteTransaction ¶
DeleteTransaction deletes a transaction an all of its attempts.
func (*ORM) DeleteUser ¶
DeleteUser will delete the API User in the db.
func (*ORM) DeleteUserSession ¶
DeleteUserSession will erase the session ID for the sole API User.
func (*ORM) DialectName ¶
func (orm *ORM) DialectName() DialectName
func (*ORM) FindBridge ¶
FindBridge looks up a Bridge by its Name.
func (*ORM) FindExternalInitiator ¶
func (orm *ORM) FindExternalInitiator(eia *models.ExternalInitiatorAuthentication) (*models.ExternalInitiator, error)
FindExternalInitiator finds an external initiator given an authentication request
func (*ORM) FindExternalInitiatorByName ¶ added in v0.6.6
func (orm *ORM) FindExternalInitiatorByName(name string) (models.ExternalInitiator, error)
FindExternalInitiatorByName finds an external initiator given an authentication request
func (*ORM) FindInitiator ¶
FindInitiator returns the single initiator defined by the passed ID.
func (*ORM) FindJobRun ¶
FindJobRun looks up a JobRun by its ID.
func (*ORM) FindServiceAgreement ¶
func (orm *ORM) FindServiceAgreement(id string) (models.ServiceAgreement, error)
FindServiceAgreement looks up a ServiceAgreement by its ID.
func (*ORM) FindTxAttempt ¶
FindTxAttempt returns an individual TxAttempt
func (*ORM) FindTxByAttempt ¶
FindTxByAttempt returns the specific transaction attempt with the hash.
func (*ORM) FirstOrCreateKey ¶
FirstOrCreateKey returns the first key found or creates a new one in the orm.
func (*ORM) GetConfigValue ¶ added in v0.6.6
func (orm *ORM) GetConfigValue(field string, value encoding.TextUnmarshaler) error
GetConfigValue returns the value for a named configuration entry
func (*ORM) GetLastNonce ¶
GetLastNonce retrieves the last known nonce in the database for an account
func (*ORM) JobRunsCountFor ¶
JobRunsCountFor returns the current number of runs for the job
func (*ORM) JobRunsFor ¶
JobRunsFor fetches all JobRuns with a given Job ID, sorted by their created at time.
func (*ORM) JobRunsSorted ¶
JobRunsSorted returns job runs ordered and filtered by the passed params.
func (*ORM) JobRunsSortedFor ¶
func (orm *ORM) JobRunsSortedFor(id *models.ID, order SortType, offset int, limit int) ([]models.JobRun, int, error)
JobRunsSortedFor returns job runs for a specific job spec ordered and filtered by the passed params.
func (*ORM) JobsSorted ¶
JobsSorted returns many JobSpecs sorted by CreatedAt from the store adhering to the passed parameters.
func (*ORM) LinkEarnedFor ¶ added in v0.6.6
LinkEarnedFor shows the total link earnings for a job
func (*ORM) MarkTxSafe ¶
MarkTxSafe updates the database for the given transaction and attempt to show that the transaction has not just been confirmed, but has met the minimum number of outgoing confirmations to be deemed safely written on the blockchain.
func (*ORM) PendingBridgeType ¶
PendingBridgeType returns the bridge type of the current pending task, or error if not pending bridge.
func (*ORM) SaveJobRun ¶
SaveJobRun updates UpdatedAt for a JobRun and saves it
func (*ORM) SaveSession ¶
SaveSession saves the session.
func (*ORM) SetConfigValue ¶ added in v0.6.6
func (orm *ORM) SetConfigValue(field string, value encoding.TextMarshaler) error
SetConfigValue returns the value for a named configuration entry
func (*ORM) SetLogging ¶ added in v0.6.1
SetLogging turns on SQL statement logging
func (*ORM) Transactions ¶
Transactions returns all transactions limited by passed parameters.
func (*ORM) TxAttempts ¶
TxAttempts returns the last tx attempts sorted by sent at descending.
func (*ORM) Unscoped ¶
Unscoped returns a new instance of this ORM that includes soft deleted items.
func (*ORM) UnscopedJobRunsWithStatus ¶
func (orm *ORM) UnscopedJobRunsWithStatus(cb func(*models.JobRun), statuses ...models.RunStatus) error
UnscopedJobRunsWithStatus passes all JobRuns to a callback, one by one, including those that were soft deleted.
func (*ORM) UpdateBridgeType ¶
func (orm *ORM) UpdateBridgeType(bt *models.BridgeType, btr *models.BridgeTypeRequest) error
UpdateBridgeType updates the bridge type.
type PostgresLockingStrategy ¶
type PostgresLockingStrategy struct {
// contains filtered or unexported fields
}
PostgresLockingStrategy uses a postgres advisory lock to ensure exclusive access.
func (*PostgresLockingStrategy) Lock ¶
func (s *PostgresLockingStrategy) Lock(timeout time.Duration) error
Lock uses a blocking postgres advisory lock that times out at the passed timeout.
func (*PostgresLockingStrategy) Unlock ¶
func (s *PostgresLockingStrategy) Unlock() error
Unlock unlocks the locked postgres advisory lock.
type SecretGenerator ¶ added in v0.6.6
SecretGenerator is the interface for objects that generate a secret used to sign or encrypt.