chainlink

package
v1.13.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 80 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application interface {
	Start(ctx context.Context) error
	Stop() error
	GetLogger() logger.SugaredLogger
	GetAuditLogger() audit.AuditLogger
	GetHealthChecker() services.Checker
	GetSqlxDB() *sqlx.DB
	GetConfig() config.GeneralConfig
	// ConfigDump returns a TOML configuration from the current environment and database configuration.
	ConfigDump(context.Context) (string, error)
	SetLogLevel(lvl zapcore.Level) error
	GetKeyStore() keystore.Master
	GetEventBroadcaster() pg.EventBroadcaster
	WakeSessionReaper()
	GetWebAuthnConfiguration() sessions.WebAuthnConfiguration

	GetExternalInitiatorManager() webhook.ExternalInitiatorManager
	GetChains() Chains

	// V2 Jobs (TOML specified)
	JobSpawner() job.Spawner
	JobORM() job.ORM
	EVMORM() evmtypes.ORM
	PipelineORM() pipeline.ORM
	BridgeORM() bridges.ORM
	SessionORM() sessions.ORM
	TxmORM() txmgr.ORM
	AddJobV2(ctx context.Context, job *job.Job) error
	DeleteJob(ctx context.Context, jobID int32) error
	RunWebhookJobV2(ctx context.Context, jobUUID uuid.UUID, requestBody string, meta pipeline.JSONSerializable) (int64, error)
	ResumeJobV2(ctx context.Context, taskID uuid.UUID, result pipeline.Result) error
	// Testing only
	RunJobV2(ctx context.Context, jobID int32, meta map[string]interface{}) (int64, error)

	// Feeds
	GetFeedsService() feeds.Service

	// ReplayFromBlock replays logs from on or after the given block number. If forceBroadcast is
	// set to true, consumers will reprocess data even if it has already been processed.
	ReplayFromBlock(chainID *big.Int, number uint64, forceBroadcast bool) error

	// ID is unique to this particular application instance
	ID() uuid.UUID

	SecretGenerator() SecretGenerator
}

Application implements the common functions used in the core node.

func NewApplication

func NewApplication(opts ApplicationOpts) (Application, error)

NewApplication initializes a new store if one is not already present at the configured root directory (default: ~/.chainlink), the logger at the same directory and returns the Application to be used by the node. TODO: Inject more dependencies here to save booting up useless stuff in tests

type ApplicationOpts added in v1.1.0

type ApplicationOpts struct {
	Config                   config.GeneralConfig
	Logger                   logger.Logger
	EventBroadcaster         pg.EventBroadcaster
	MailMon                  *utils.MailboxMonitor
	SqlxDB                   *sqlx.DB
	KeyStore                 keystore.Master
	Chains                   Chains
	AuditLogger              audit.AuditLogger
	CloseLogger              func() error
	ExternalInitiatorManager webhook.ExternalInitiatorManager
	Version                  string
	RestrictedHTTPClient     *http.Client
	UnrestrictedHTTPClient   *http.Client
	SecretGenerator          SecretGenerator
}

type ChainlinkApplication

type ChainlinkApplication struct {
	Chains           Chains
	EventBroadcaster pg.EventBroadcaster

	FeedsService feeds.Service

	Config                   config.GeneralConfig
	KeyStore                 keystore.Master
	ExternalInitiatorManager webhook.ExternalInitiatorManager
	SessionReaper            utils.SleeperTask

	HealthChecker services.Checker
	Nurse         *services.Nurse

	AuditLogger audit.AuditLogger
	// contains filtered or unexported fields
}

ChainlinkApplication contains fields for the JobSubscriber, Scheduler, and Store. The JobSubscriber and Scheduler are also available in the services package, but the Store has its own package.

func (*ChainlinkApplication) AddJobV2 added in v0.9.3

func (app *ChainlinkApplication) AddJobV2(ctx context.Context, j *job.Job) error

func (*ChainlinkApplication) BridgeORM added in v1.1.0

func (app *ChainlinkApplication) BridgeORM() bridges.ORM

func (*ChainlinkApplication) ConfigDump added in v1.6.0

func (app *ChainlinkApplication) ConfigDump(ctx context.Context) (string, error)

func (*ChainlinkApplication) DeleteJob added in v1.0.0

func (app *ChainlinkApplication) DeleteJob(ctx context.Context, jobID int32) error

func (*ChainlinkApplication) EVMORM added in v1.0.0

func (app *ChainlinkApplication) EVMORM() evmtypes.ORM

func (*ChainlinkApplication) GetAuditLogger added in v1.10.0

func (app *ChainlinkApplication) GetAuditLogger() audit.AuditLogger

func (*ChainlinkApplication) GetChains added in v1.2.0

func (app *ChainlinkApplication) GetChains() Chains

GetChains returns Chains.

func (*ChainlinkApplication) GetConfig added in v0.10.11

func (app *ChainlinkApplication) GetConfig() config.GeneralConfig

func (*ChainlinkApplication) GetEventBroadcaster added in v1.1.0

func (app *ChainlinkApplication) GetEventBroadcaster() pg.EventBroadcaster

func (*ChainlinkApplication) GetExternalInitiatorManager added in v0.9.10

func (app *ChainlinkApplication) GetExternalInitiatorManager() webhook.ExternalInitiatorManager

func (*ChainlinkApplication) GetFeedsService added in v0.10.8

func (app *ChainlinkApplication) GetFeedsService() feeds.Service

func (*ChainlinkApplication) GetHealthChecker added in v0.10.8

func (app *ChainlinkApplication) GetHealthChecker() services.Checker

func (*ChainlinkApplication) GetKeyStore added in v0.10.8

func (app *ChainlinkApplication) GetKeyStore() keystore.Master

func (*ChainlinkApplication) GetLogger added in v0.10.6

func (app *ChainlinkApplication) GetLogger() logger.SugaredLogger

func (*ChainlinkApplication) GetSqlxDB added in v1.1.0

func (app *ChainlinkApplication) GetSqlxDB() *sqlx.DB

func (*ChainlinkApplication) GetWebAuthnConfiguration added in v1.1.0

func (app *ChainlinkApplication) GetWebAuthnConfiguration() sessions.WebAuthnConfiguration

Returns the configuration to use for creating and authenticating new WebAuthn credentials

func (*ChainlinkApplication) ID added in v1.1.0

func (app *ChainlinkApplication) ID() uuid.UUID

func (*ChainlinkApplication) JobORM added in v0.9.9

func (app *ChainlinkApplication) JobORM() job.ORM

func (*ChainlinkApplication) JobSpawner added in v0.10.8

func (app *ChainlinkApplication) JobSpawner() job.Spawner

func (*ChainlinkApplication) PipelineORM added in v0.10.8

func (app *ChainlinkApplication) PipelineORM() pipeline.ORM

func (*ChainlinkApplication) ReplayFromBlock added in v0.10.11

func (app *ChainlinkApplication) ReplayFromBlock(chainID *big.Int, number uint64, forceBroadcast bool) error

ReplayFromBlock implements the Application interface.

func (*ChainlinkApplication) ResumeJobV2 added in v0.10.10

func (app *ChainlinkApplication) ResumeJobV2(
	ctx context.Context,
	taskID uuid.UUID,
	result pipeline.Result,
) error

func (*ChainlinkApplication) RunJobV2 added in v0.9.6

func (app *ChainlinkApplication) RunJobV2(
	ctx context.Context,
	jobID int32,
	meta map[string]interface{},
) (int64, error)

Only used for local testing, not supported by the UI.

func (*ChainlinkApplication) RunWebhookJobV2 added in v0.10.8

func (app *ChainlinkApplication) RunWebhookJobV2(ctx context.Context, jobUUID uuid.UUID, requestBody string, meta pipeline.JSONSerializable) (int64, error)

func (*ChainlinkApplication) SecretGenerator added in v1.7.0

func (app *ChainlinkApplication) SecretGenerator() SecretGenerator

func (*ChainlinkApplication) SessionORM added in v1.1.0

func (app *ChainlinkApplication) SessionORM() sessions.ORM

func (*ChainlinkApplication) SetLogLevel added in v1.1.0

func (app *ChainlinkApplication) SetLogLevel(lvl zapcore.Level) error

func (*ChainlinkApplication) Start

func (app *ChainlinkApplication) Start(ctx context.Context) error

Start all necessary services. If successful, nil will be returned. Start sequence is aborted if the context gets cancelled.

func (*ChainlinkApplication) Stop

func (app *ChainlinkApplication) Stop() error

Stop allows the application to exit by halting schedules, closing logs, and closing the DB connection.

func (*ChainlinkApplication) StopIfStarted added in v0.9.9

func (app *ChainlinkApplication) StopIfStarted() error

func (*ChainlinkApplication) TxmORM added in v1.3.0

func (app *ChainlinkApplication) TxmORM() txmgr.ORM

func (*ChainlinkApplication) WakeSessionReaper

func (app *ChainlinkApplication) WakeSessionReaper()

WakeSessionReaper wakes up the reaper to do its reaping.

type Chains added in v1.2.0

type Chains struct {
	EVM      evm.ChainSet
	Solana   solana.ChainSet   // nil if disabled
	StarkNet starknet.ChainSet // nil if disabled
}

Chains holds a ChainSet for each type of chain.

type Config added in v1.6.0

type Config struct {
	config.Core

	EVM evmcfg.EVMConfigs `toml:",omitempty"`

	Solana solana.SolanaConfigs `toml:",omitempty"`

	Starknet starknet.StarknetConfigs `toml:",omitempty"`
}

Config is the root type used for TOML configuration.

See docs at /docs/CONFIG.md generated via config.GenerateDocs from /internal/config/docs.toml

When adding a new field:

  • consider including a unit suffix with the field name
  • TOML is limited to int64/float64, so fields requiring greater range/precision must use non-standard types implementing encoding.TextMarshaler/TextUnmarshaler, like utils.Big and decimal.Decimal
  • std lib types that don't implement encoding.TextMarshaler/TextUnmarshaler (time.Duration, url.URL, big.Int) won't work as expected, and require wrapper types. See models.Duration, models.URL, utils.Big.

func (*Config) SetFrom added in v1.11.0

func (c *Config) SetFrom(f *Config)

func (*Config) TOMLString added in v1.6.0

func (c *Config) TOMLString() (string, error)

TOMLString returns a TOML encoded string.

func (*Config) Validate added in v1.8.0

func (c *Config) Validate() error

type ConfigV2 added in v1.10.0

type ConfigV2 interface {
	// ConfigTOML returns both the user provided and effective configuration as TOML.
	ConfigTOML() (user, effective string)
}

type FilePersistedSecretGenerator added in v1.7.0

type FilePersistedSecretGenerator struct{}

func (FilePersistedSecretGenerator) Generate added in v1.7.0

func (f FilePersistedSecretGenerator) Generate(rootDir string) ([]byte, error)

type GeneralConfigOpts added in v1.10.0

type GeneralConfigOpts struct {
	Config
	Secrets

	// OverrideFn is a *test-only* hook to override effective values.
	OverrideFn func(*Config, *Secrets)

	SkipEnv bool
}

GeneralConfigOpts holds configuration options for creating a coreconfig.GeneralConfig via New().

See ParseTOML to initilialize Config and Secrets from TOML.

func (GeneralConfigOpts) New added in v1.10.0

New returns a coreconfig.GeneralConfig for the given options.

func (GeneralConfigOpts) NewAndLogger added in v1.10.0

func (o GeneralConfigOpts) NewAndLogger() (coreconfig.GeneralConfig, logger.Logger, func() error, error)

NewAndLogger returns a coreconfig.GeneralConfig for the given options, and a logger.Logger (with close func).

func (*GeneralConfigOpts) ParseConfig added in v1.11.0

func (o *GeneralConfigOpts) ParseConfig(config string) error

ParseConfig sets Config from the given TOML string, overriding any existing duplicate Config fields.

func (*GeneralConfigOpts) ParseSecrets added in v1.11.0

func (o *GeneralConfigOpts) ParseSecrets(secrets string) (err error)

ParseSecrets sets Secrets from the given TOML string.

func (*GeneralConfigOpts) ParseTOML added in v1.10.0

func (o *GeneralConfigOpts) ParseTOML(config, secrets string) (err error)

ParseTOML sets Config and Secrets from the given TOML strings.

type SecretGenerator added in v1.7.0

type SecretGenerator interface {
	Generate(string) ([]byte, error)
}

SecretGenerator is the interface for objects that generate a secret used to sign or encrypt.

type Secrets added in v1.8.0

type Secrets struct {
	config.Secrets
}

func (*Secrets) TOMLString added in v1.10.0

func (s *Secrets) TOMLString() (string, error)

TOMLString returns a TOML encoded string with secret values redacted.

func (*Secrets) Validate added in v1.8.0

func (s *Secrets) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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