vtworkerclient

package
v2.0.0-alpha1+incompat... Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2015 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package vtworkerclient contains the generic client side of the remote vtworker protocol.

Index

Constants

This section is empty.

Variables

View Source
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

func CreateWorkerInstance(t *testing.T) *worker.Instance

CreateWorkerInstance returns a properly configured vtworker instance.

func RegisterFactory

func RegisterFactory(name string, factory Factory)

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.

func TestSuite

func TestSuite(t *testing.T, wi *worker.Instance, c VtworkerClient)

TestSuite runs the test suite on the given vtworker and vtworkerclient

Types

type ErrFunc

type ErrFunc func() error

ErrFunc is returned by streaming queries to get the error

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

func New

func New(addr string, connectTimeout time.Duration) (VtworkerClient, error)

New allows a user of the client library to get its implementation.

Jump to

Keyboard shortcuts

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