Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LaunchWorkerThread ¶
func LaunchWorkerThread(group program.Group, run func(ctx context.Context) (bool, error), workerName string)
LaunchWorkerThread launches a single routine that uses a build client to repeatedly synchronizes against the scheduler, requesting a task to execute.
func ParsePlatformPrivateKeys ¶
func ParsePlatformPrivateKeys(privateKeys []string) ([]*ecdh.PrivateKey, error)
ParsePlatformPrivateKeys parses a set of ECDH private keys specified in a worker's configuration file, so that they can be provided to NewClient().
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for the Remote Worker protocol. It can send synchronization requests to a scheduler, informing it of the current state of the worker, while also obtaining requests for executing actions.
func NewClient ¶
func NewClient( scheduler remoteworker_pb.OperationQueueClient, executor Executor[[]byte, []byte, []byte], clock clock.Clock, randomNumberGenerator random.ThreadSafeGenerator, unsortedPrivateKeys []*ecdh.PrivateKey, clientCertificateVerifier *bb_x509.ClientCertificateVerifier, workerID map[string]string, sizeClass uint32, isLargestSizeClass bool, ) (*Client, error)
NewClient creates a new Client instance that is set to the initial state (i.e., being idle).
type Executor ¶
type Executor[TAction, TEvent, TResult any] interface { CheckReadiness(ctx context.Context) error Execute(ctx context.Context, action TAction, executionTimeout time.Duration, executionEvents chan<- TEvent) (TResult, time.Duration, remoteworker_pb.CurrentState_Completed_Result, error) }
Executor is responsible for processing an incoming action, executing it, and returning its results. The remote worker client will assume that all payloads are byte slices, but decorators can be written to transmit things like Protobuf messages.
Implementations of Executor.Execute() should only return an error if there are no other mechanisms available to propagate errors to the the caller. The reason being that any error returned directly is sent back to the client in plain text, as opposed to getting encrypted.
func NewProtoExecutor ¶
func NewProtoExecutor[ TAction any, TEvent proto.Message, TResult proto.Message, TActionPtr interface { *TAction proto.Message }, ]( base Executor[TActionPtr, TEvent, TResult], ) Executor[[]byte, []byte, []byte]
NewProtoExecutor creates a decorator for Executor that assumes that all payloads of an action (i.e., its action, execution event and completion event message) are Protobuf messages. It marshals and unmarshals all these messages, so that they can be sent and transmitted in binary form.