Documentation
¶
Index ¶
- Variables
- type ORM
- func (orm *ORM) AddAttempt(tx *models.Tx, etx *types.Transaction, blkNum uint64) (*models.TxAttempt, error)
- func (orm *ORM) AllInBatches(bucket interface{}, callback interface{}, optionalBatchSize ...int) error
- func (orm *ORM) AnyJobWithType(taskTypeName string) (bool, error)
- func (orm *ORM) AttemptsFor(id uint64) ([]models.TxAttempt, error)
- func (orm *ORM) AuthorizedUserWithSession(sessionID string, sessionDuration time.Duration) (models.User, error)
- func (orm *ORM) ConfirmTx(tx *models.Tx, txat *models.TxAttempt) error
- func (orm *ORM) CreateSession(sr models.SessionRequest) (string, error)
- func (orm *ORM) CreateTx(from common.Address, nonce uint64, to common.Address, data []byte, ...) (*models.Tx, error)
- func (orm *ORM) DeleteUser() (models.User, error)
- func (orm *ORM) DeleteUserSession(sessionID string) error
- func (orm *ORM) FindBridge(name string) (models.BridgeType, error)
- func (orm *ORM) FindJob(id string) (models.JobSpec, error)
- func (orm *ORM) FindJobRun(id string) (models.JobRun, error)
- func (orm *ORM) FindServiceAgreement(id string) (models.ServiceAgreement, error)
- func (orm *ORM) FindUser() (models.User, error)
- func (orm *ORM) GetBolt() *bolt.DB
- func (orm *ORM) GetLastNonce(address common.Address) (uint64, error)
- func (orm *ORM) InitBucket(model interface{}) error
- func (orm *ORM) InitializeModel(klass interface{}) error
- func (orm *ORM) JobRunsCountFor(jobID string) (int, error)
- func (orm *ORM) JobRunsFor(jobID string) ([]models.JobRun, error)
- func (orm *ORM) JobRunsWithStatus(statuses ...models.RunStatus) ([]models.JobRun, error)
- func (orm *ORM) Jobs(cb func(models.JobSpec) bool) error
- func (orm *ORM) MarkRan(i *models.Initiator) error
- func (orm *ORM) PendingBridgeType(jr models.JobRun) (models.BridgeType, error)
- func (orm *ORM) SaveJob(job *models.JobSpec) error
- func (orm *ORM) SaveJobRun(run *models.JobRun) error
- func (orm *ORM) SaveServiceAgreement(sa *models.ServiceAgreement) error
- func (orm *ORM) Where(field string, value interface{}, instance interface{}) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrorInvalidCallbackSignature is returned in AllInBatches if the incorrect function signature is passed. ErrorInvalidCallbackSignature = errors.New("AllInBatches callback has incorrect function signature, must return bool") // ErrorInvalidCallbackModel is returned in AllInBatches if the model and bucket do not match types. ErrorInvalidCallbackModel = errors.New("AllInBatches callback has incorrect model, must match bucket") )
Functions ¶
This section is empty.
Types ¶
type ORM ¶
ORM contains the database object used by Chainlink.
func (*ORM) AddAttempt ¶
func (orm *ORM) AddAttempt( tx *models.Tx, etx *types.Transaction, blkNum uint64, ) (*models.TxAttempt, error)
AddAttempt creates a new transaction attempt and stores it in the database.
func (*ORM) AllInBatches ¶
func (orm *ORM) AllInBatches(bucket interface{}, callback interface{}, optionalBatchSize ...int) error
AllInBatches iterates over every single entry in the passed bucket without holding the entire contents in memory, pulling down batches and streaming over each entry. Be sure not to use the passed bucket parameter as it is used as a buffer.
func (*ORM) AnyJobWithType ¶
AnyJobWithType returns true if there is at least one job associated with the type name specified and false otherwise
func (*ORM) AttemptsFor ¶
AttemptsFor returns the Transaction Attempts (TxAttempt) for a given Transaction ID (TxID).
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) ConfirmTx ¶
ConfirmTx updates the database for the given transaction to show that the transaction has been confirmed on the blockchain.
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( from common.Address, nonce uint64, to common.Address, data []byte, value *big.Int, gasLimit uint64, ) (*models.Tx, error)
CreateTx saves the properties of an Ethereum transaction to the database.
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) FindBridge ¶
func (orm *ORM) FindBridge(name string) (models.BridgeType, error)
FindBridge looks up a Bridge by its Name.
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) GetLastNonce ¶
GetLastNonce retrieves the last known nonce in the database for an account
func (*ORM) InitBucket ¶
InitBucket initializes buckets and indexes before saving an object.
func (*ORM) InitializeModel ¶
InitializeModel uses reflection on the passed klass to generate a bucket of the same type name.
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) JobRunsWithStatus ¶
JobRunsWithStatus returns the JobRuns which have the passed statuses.
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) SaveServiceAgreement ¶
func (orm *ORM) SaveServiceAgreement(sa *models.ServiceAgreement) error
SaveServiceAgreement saves a service agreement and it's associations to the database.