go-vitess.v1: gopkg.in/src-d/go-vitess.v1/vt/worker/vtworkerclient Index | Files

package vtworkerclient

import "gopkg.in/src-d/go-vitess.v1/vt/worker/vtworkerclient"

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


Package Files

interface.go wrapper.go

func RegisterFactory Uses

func RegisterFactory(name string, factory Factory)

RegisterFactory allows a client implementation to register itself.

func RunCommandAndWait Uses

func RunCommandAndWait(ctx context.Context, server string, args []string, recv func(*logutilpb.Event)) 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.Event messages which have to be consumed by the caller who has to specify a "recv" function.

func UnregisterFactoryForTest Uses

func UnregisterFactoryForTest(name string)

UnregisterFactoryForTest allows to unregister a client implementation from the static map. This function is used by unit tests to cleanly unregister any fake implementations. This way, a test package can use the same name for different fakes and no dangling fakes are left behind in the static factories map after the test.

type Client Uses

type Client interface {
    // ExecuteVtworkerCommand will execute the command remotely.
    ExecuteVtworkerCommand(ctx context.Context, args []string) (logutil.EventStream, error)

    // Close will terminate the connection. This object won't be
    // used after this.

Client defines the interface used to send remote vtworker commands

func New Uses

func New(addr string) (Client, error)

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

type Factory Uses

type Factory func(addr string) (Client, error)

Factory functions are registered by client implementations.

Package vtworkerclient imports 8 packages (graph) and is imported by 8 packages. Updated 2019-06-13. Refresh now. Tools for package owners.