vtctl

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeVtctlV6 - vtctl v6
	TypeVtctlV6 = "vtctl_v6"
)

Variables

This section is empty.

Functions

func Register

func Register(name string, adapter Instance)

Register makes a Client adapter available by the adapter name. If Register is called twice with the same name or if driver is nil, it panics.

Types

type Client

type Client interface {
	// run vtctl command
	RunCommand(ctx context.Context, args []string, timeout time.Duration) ([]string, error)

	// close connection
	Close() error

	// start gc routine based on config string settings.
	StartAndGC(config Config) error
}

Client interface contains all behaviors for vtctl client.

func NewClient

func NewClient(adapterName string, config Config) (adapter Client, err error)

NewClient Create a new Client driver by adapter name and config string. it will start gc automatically.

type Config

type Config struct {
	RetryOption *retry.Options        `json:"option"`
	Servers     map[string]ServerInfo `json:"servers"`
	HealthCheck time.Duration         `json:"health_check"`
}

Config - client config

type Instance

type Instance func() Client

Instance is a function create a new Client Instance

type ServerInfo

type ServerInfo struct {
	IP     string `json:"name"`
	Port   int    `json:"port"`
	Weight int    `json:"weight"`
}

ServerInfo - vtctld server info

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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