offchain

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadOffchainClient added in v0.39.0

func LoadOffchainClient(
	ctx context.Context,
	domain enginedomain.Domain,
	env string,
	config *cfgenv.Config,
	lggr logger.Logger,
	useRealBackends bool,
) (foffchain.Client, error)

LoadOffchainClient loads an offchain client for the specified domain and environment.

func ProposeJob

func ProposeJob(ctx context.Context, req ProposeJobRequest) error

ProposeJob proposes a job to a node using JD

func ProposeJobs

func ProposeJobs(ctx context.Context, lggr logger.Logger, oc foffchain.Client, jobSpecFilePath string) error

ProposeJobs proposes job specs to nodes using jobspecs file TODO remove when all migrations use Jobs instead of JobSpecs

func ProposeWithJobDetails

func ProposeWithJobDetails(ctx context.Context, lggr logger.Logger, oc foffchain.Client, jobsPath string) error

ProposeWithJobDetails proposes job specs to nodes using jobspecs file

func RegisterNode

func RegisterNode(
	ctx context.Context,
	jd foffchain.Client,
	name string,
	csaKey string,
	isBootstrap bool,
	domain fdomain.Domain,
	environment string,
	extraLabels map[string]string,
) (string, error)

RegisterNode registers a single node with the job distributor. It errors if the node is already registered.

func UpdateNodes added in v0.39.0

func UpdateNodes(ctx context.Context, client foffchain.Client, req UpdateNodesRequest) error

UpdateNodes updates the nodes with the given configurations.

Types

type NodeFinderCfg added in v0.39.0

type NodeFinderCfg struct {
	KeyType   NodeKey // type of key to search for
	LabelName *string // name of label to search for when using NodeKey_Label
}

NodeFinderCfg is the configuration for how to find the node to update

func (NodeFinderCfg) Validate added in v0.39.0

func (c NodeFinderCfg) Validate() error

type NodeKey added in v0.39.0

type NodeKey string

NodeKey is the key type to use to find a node

const (
	NodeKey_ID     NodeKey = "id"
	NodeKey_CSAKey NodeKey = "csa_key"
	NodeKey_Name   NodeKey = "name"
	NodeKey_Label  NodeKey = "label"
)

type ProposeJobRequest

type ProposeJobRequest struct {
	Job         string // toml
	Domain      fdomain.Domain
	Environment string
	// labels to filter nodes by
	NodeLabels map[string]string
	// labels to set on the new/updated job object
	JobLabels      map[string]string
	OffchainClient foffchain.Client
	Lggr           logger.Logger
}

ProposeJobRequest is the request to propose a job to a node using JD

func (ProposeJobRequest) Validate

func (r ProposeJobRequest) Validate() error

Validate validates the request

type UpdateNodeRequest added in v0.39.0

type UpdateNodeRequest struct {
	// Cfg is the configuration for the used to update node
	Cfg fnode.NodeCfg
	// contains filtered or unexported fields
}

UpdateNodeRequest is the request to update a node using JD

func NewUpdateNodeRequest added in v0.39.0

func NewUpdateNodeRequest(cfg fnode.NodeCfg, f NodeFinderCfg) (*UpdateNodeRequest, error)

NewUpdateNodeRequest creates a new UpdateNodeRequest

func (*UpdateNodeRequest) Labels added in v0.39.0

func (r *UpdateNodeRequest) Labels() []*ptypes.Label

Labels returns the labels for the node, containing the p2p_id, nop, admin_addr and all tags.

func (*UpdateNodeRequest) NodeKeyCriteria added in v0.39.0

func (r *UpdateNodeRequest) NodeKeyCriteria() string

NodeKeyCriteria returns the node key criteria

type UpdateNodesRequest added in v0.39.0

type UpdateNodesRequest struct {
	Requests []*UpdateNodeRequest
}

UpdateNodesRequest is the request to update multiple nodes using JD

Jump to

Keyboard shortcuts

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