Documentation ¶
Overview ¶
Package vtworkerclient contains the generic client side of the remote vtworker protocol.
Index ¶
- Variables
- func CreateWorkerInstance(t *testing.T) *worker.Instance
- func RegisterFactory(name string, factory Factory)
- func RunCommandAndWait(ctx context.Context, server string, args []string, ...) error
- func TestSuite(t *testing.T, wi *worker.Instance, c VtworkerClient)
- type ErrFunc
- type Factory
- type VtworkerClient
Constants ¶
This section is empty.
Variables ¶
var VtworkerClientProtocol = flag.String("vtworker_client_protocol", "grpc", "the protocol to use to talk to the vtworker server")
VtworkerClientProtocol specifices which RPC client implementation should be used.
Functions ¶
func CreateWorkerInstance ¶
CreateWorkerInstance returns a properly configured vtworker instance.
func RegisterFactory ¶
RegisterFactory allows a client implementation to register itself.
func RunCommandAndWait ¶
func RunCommandAndWait(ctx context.Context, server string, args []string, recv func(*logutil.LoggerEvent)) error
RunCommandAndWait executes a single command on a given vtworker and blocks until the command did return or timed out. Output from vtworker is streamed as logutil.LoggerEvent messages which have to be consumed by the caller who has to specify a "recv" function.
Types ¶
type Factory ¶
type Factory func(addr string, connectTimeout time.Duration) (VtworkerClient, error)
Factory functions are registered by client implementations.
type VtworkerClient ¶
type VtworkerClient interface { // ExecuteVtworkerCommand will execute the command remotely. // NOTE: ErrFunc should only be checked after the returned channel was closed to avoid races. ExecuteVtworkerCommand(ctx context.Context, args []string) (<-chan *logutil.LoggerEvent, ErrFunc, error) // Close will terminate the connection. This object won't be // used after this. Close() }
VtworkerClient defines the interface used to send remote vtworker commands