Documentation
¶
Index ¶
- Variables
- func LoadOffchainClient(ctx context.Context, dom domain.Domain, cfg cfgenv.JobDistributorConfig, ...) (foffchain.Client, error)
- func ProposeJob(ctx context.Context, req ProposeJobRequest) error
- func ProposeJobs(ctx context.Context, lggr logger.Logger, oc foffchain.Client, ...) error
- func ProposeWithJobDetails(ctx context.Context, lggr logger.Logger, oc foffchain.Client, jobsPath string) error
- func RegisterNode(ctx context.Context, jd foffchain.Client, name string, csaKey string, ...) (string, error)
- func UpdateNodes(ctx context.Context, client foffchain.Client, req UpdateNodesRequest) error
- type LoadOffchainClientOpt
- type NodeFinderCfg
- type NodeKey
- type ProposeJobRequest
- type UpdateNodeRequest
- type UpdateNodesRequest
Constants ¶
This section is empty.
Variables ¶
var ErrEndpointsRequired = errors.New("both gRPC and wsRPC endpoints are required")
ErrEndpointsRequired is returned during loading of the offchain client when both gRPC and wsRPC endpoints are required.
Functions ¶
func LoadOffchainClient ¶ added in v0.39.0
func LoadOffchainClient( ctx context.Context, dom domain.Domain, cfg cfgenv.JobDistributorConfig, opts ...LoadOffchainClientOpt, ) (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
UpdateNodes updates the nodes with the given configurations.
Types ¶
type LoadOffchainClientOpt ¶ added in v0.49.0
type LoadOffchainClientOpt func(*loadConfig)
LoadOffchainClientOpt defines an option for configuring how the offchain client is loaded.
func WithCredentials ¶ added in v0.49.0
func WithCredentials(creds credentials.TransportCredentials) LoadOffchainClientOpt
WithCredentials sets the gRPC transport credentials for the offchain client.
func WithDryRun ¶ added in v0.49.0
func WithDryRun(dryRun bool) LoadOffchainClientOpt
WithDryRun sets the dry run mode for the offchain client.
When true, the offchain client will perform read operations but no write operations.
func WithLogger ¶ added in v0.49.0
func WithLogger(lggr logger.Logger) LoadOffchainClientOpt
WithLogger sets the logger for the offchain client.
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 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