provider

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultCSAEncryptionKey is the default CSA encryption key used when none is provided
	DefaultCSAEncryptionKey = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CTFOffchainProvider added in v0.21.0

type CTFOffchainProvider struct {
	// contains filtered or unexported fields
}

CTFOffchainProvider manages a Job Distributor (JD) instance running inside a Chainlink Testing Framework (CTF) Docker container.

This provider requires Docker to be installed and operational. Spinning up a new container can be slow, so it is recommended to initialize the provider only once per test suite or parent test to optimize performance.

func NewCTFOffchainProvider added in v0.21.0

func NewCTFOffchainProvider(
	t *testing.T, config CTFOffchainProviderConfig,
) *CTFOffchainProvider

NewCTFOffchainProvider creates a new CTFOffchainProvider with the given configuration.

func (*CTFOffchainProvider) Initialize added in v0.21.0

func (p *CTFOffchainProvider) Initialize(ctx context.Context) (offchain.Client, error)

Initialize sets up the Job Distributor by validating the configuration, starting a CTF container, and constructing the JD client instance.

func (*CTFOffchainProvider) Name added in v0.21.0

func (*CTFOffchainProvider) Name() string

Name returns the name of the CTFOffchainProvider.

func (*CTFOffchainProvider) OffchainClient added in v0.21.0

func (p *CTFOffchainProvider) OffchainClient() offchain.Client

OffchainClient returns the JD client instance managed by this provider. You must call Initialize before using this method to ensure the client is properly set up.

type CTFOffchainProviderConfig added in v0.21.0

type CTFOffchainProviderConfig struct {
	// Optional: Docker image for the JD service. If not provided, will use environment variable CTF_JD_IMAGE.
	Image string
	// Optional: GRPC port for the JD service. Defaults to 14231.
	GRPCPort string
	// Optional: WebSocket RPC port for the JD service. Defaults to 8080.
	WSRPCPort string
	// Optional: CSA encryption key. Defaults to a 64-character hex string.
	CSAEncryptionKey string
	// Optional: Docker file path for building JD image locally.
	DockerFilePath string
	// Optional: Docker context for building JD image locally.
	DockerContext string
	// Optional: SQL dump path for JD database initialization.
	JDSQLDumpPath string
	// Optional: PostgreSQL database configuration. If not provided, will use default.
	DBInput *postgres.Input
}

CTFOffchainProviderConfig holds the configuration to initialize the CTFOffchainProvider.

type ClientOffchainProvider

type ClientOffchainProvider struct {
	// contains filtered or unexported fields
}

ClientOffchainProvider is a JD provider that connects to a Job Distributor service via gRPC.

func NewClientOffchainProvider

func NewClientOffchainProvider(config ClientOffchainProviderConfig, opts ...ClientProviderOption) *ClientOffchainProvider

NewClientOffchainProvider creates a new ClientOffchainProvider with the given configuration and options. Available options: - WithDryRun(lggr logger.Logger) ClientProviderOption

func (*ClientOffchainProvider) Initialize

Initialize initializes the ClientOffchainProvider, setting up the JD client with the provided configuration. It returns the initialized offchain.Client or an error if initialization fails.

func (*ClientOffchainProvider) Name

Name returns the name of the ClientOffchainProvider.

func (*ClientOffchainProvider) OffchainClient

func (p *ClientOffchainProvider) OffchainClient() offchain.Client

OffchainClient returns the JD client instance managed by this provider. You must call Initialize before using this method to ensure the client is properly set up.

type ClientOffchainProviderConfig

type ClientOffchainProviderConfig struct {
	// Required: The gRPC URL to connect to the Job Distributor service.
	GRPC string
	// Optional: The WebSocket RPC URL for the Job Distributor service.
	WSRPC string
	// Optional: Transport credentials for secure gRPC connections. Defaults to insecure.NewCredentials()
	Creds credentials.TransportCredentials
	// Optional: OAuth2 token source for authentication.
	Auth oauth2.TokenSource
	// contains filtered or unexported fields
}

ClientOffchainProviderConfig holds the configuration to initialize the ClientOffchainProvider.

type ClientProviderOption added in v0.37.1

type ClientProviderOption func(*ClientOffchainProviderConfig)

ClientProviderOption is a functional option for configuring ClientOffchainProvider.

func WithDryRun added in v0.37.1

func WithDryRun(lggr logger.Logger) ClientProviderOption

WithDryRun enables dry run mode, which simulates write operations without executing them. Read operations are still forwarded to the real backend.

Jump to

Keyboard shortcuts

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