config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyAddress is a config name for an address.
	KeyAddress = "address"
	// KeyTable is a config name for an table.
	KeyTable = "table"
	// KeyUsername is a config name for an username.
	KeyUsername = "username"
	// KeyPassword is a config name for an password.
	KeyPassword = "password"
	// KeyKeyspace is a config name for a keyspace.
	KeyKeyspace = "keyspace"
	// KeyTabletType is a config name for a tabletType.
	KeyTabletType = "tabletType"
	// KeyMaxRetries is a config name for a grpc max retries.
	KeyMaxRetries = "maxRetries"
	// KeyRetryTimeout is a config name for grpc retry timeout.
	KeyRetryTimeout = "retryTimeout"
)
View Source
const (
	// DefaultRetryTimeout is a default timeout that is used
	// when a timeout provided to the DialWithRetries function is less or equal to zero.
	DefaultRetryTimeout = time.Second

	// DefaultMaxRetries is a default retries, that given to dial to vitess grpc server.
	DefaultMaxRetries = 3
)

Variables

View Source
var ErrUnknownTabletType = errors.New("unknown tablet type")

ErrUnknownTabletType occurs when a provided tablet type is not valid.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Address is an address pointed to a VTGate instance.
	Address string `key:"address" validate:"required,hostname_port"`
	// Table is a name of the table that the connector should write to or read from.
	// Max length is 64, see Identifier Length Limits
	// https://dev.mysql.com/doc/refman/8.0/en/identifier-length.html
	Table string `key:"table" validate:"required,max=64"`
	// Keyspace specifies a VTGate keyspace.
	Keyspace string `key:"keyspace" validate:"required"`
	// Username is a username of a VTGate user.
	Username string `key:"username" validate:"required_with=Password"`
	// Password is a password of a VTGate user.
	Password string `key:"password" validate:"required_with=Username"`
	// TabletType is a tabletType.
	TabletType string `key:"tabletType"`
	// MaxRetries is the number of reconnect retries the connector will make before giving up if a connection goes down.
	MaxRetries int `key:"maxRetries"`
	// RetryTimeout is the time period that will be waited between retries.
	RetryTimeout time.Duration `key:"retryTimeout" validate:"gte=0"`
}

Config contains configurable values shared between source and destination Vitess connector.

func Parse

func Parse(cfg map[string]string) (Config, error)

Parse attempts to parse a provided map[string]string into a Config struct.

Jump to

Keyboard shortcuts

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