mariadb

package
v0.0.0-...-1d4c075 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2016 License: BSD-3-Clause Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPort        = "3306"
	DefaultBinDir      = "/usr/bin"
	DefaultSbinDir     = "/usr/sbin"
	DefaultDataDir     = "/data"
	DefaultPassword    = ""
	DefaultOpTimeout   = 5 * time.Minute
	DefaultReplTimeout = 1 * time.Minute

	BinName    = "mysqld"
	ConfigName = "my.cnf"
)

Variables

View Source
var (
	// ErrRunning is returned when starting an already running process.
	ErrRunning = errors.New("process already running")

	// ErrStopped is returned when stopping an already stopped process.
	ErrStopped = errors.New("process already stopped")

	ErrNoReplicationStatus = errors.New("no replication status")
)

Functions

func MySQLErrorNumber

func MySQLErrorNumber(err error) uint16

MySQLErrorNumber returns the Number field from err if it is a *mysql.Error. Returns 0 for non-mysql error types.

Types

type BackupInfo

type BackupInfo struct {
	LogFile string
	LogPos  string
	GTID    string
}

type Cmd

type Cmd struct {
	*exec.Cmd
	// contains filtered or unexported fields
}

Cmd wraps exec.Cmd and provides helpers for checking for expected exits.

func NewCmd

func NewCmd(cmd *exec.Cmd) *Cmd

NewCmd returns a new instance of Cmd that wraps cmd.

func (*Cmd) Err

func (cmd *Cmd) Err() error

Err returns an error if cmd stopped unexpectedly. Must wait for the Stopped channel to return first.

func (*Cmd) Start

func (cmd *Cmd) Start() error

Start executes the command.

func (*Cmd) Stop

func (cmd *Cmd) Stop() error

Stop marks the command as expecting an exit and stops the underlying command.

func (*Cmd) Stopped

func (cmd *Cmd) Stopped() <-chan struct{}

Stopped returns a channel that returns an error if stopped unsuccessfully.

type DSN

type DSN struct {
	Host     string
	User     string
	Password string
	Database string
	Timeout  time.Duration
}

DSN returns a URL-formatted data source name.

func (*DSN) String

func (dsn *DSN) String() string

String encodes dsn to a URL string format.

type Handler

type Handler struct {
	Process     *Process
	Peer        *state.Peer
	Heartbeater discoverd.Heartbeater
	Logger      log15.Logger
	// contains filtered or unexported fields
}

Handler represents an HTTP API handler for the process.

func NewHandler

func NewHandler() *Handler

NewHandler returns a new instance of Handler.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP serves an HTTP request.

type Process

type Process struct {
	ID           string
	Singleton    bool
	Port         string
	BinDir       string
	SbinDir      string
	DataDir      string
	Password     string
	ServerID     uint32
	OpTimeout    time.Duration
	ReplTimeout  time.Duration
	WaitUpstream bool

	Logger log15.Logger
	// contains filtered or unexported fields
}

Process represents a MariaDB process.

func NewProcess

func NewProcess() *Process

NewProcess returns a new instance of Process.

func (*Process) Backup

func (p *Process) Backup() (io.ReadCloser, error)

Backup returns a reader for streaming a backup in xbstream format.

func (*Process) ConfigPath

func (p *Process) ConfigPath() string

func (*Process) DSN

func (p *Process) DSN() *DSN

DSN returns the data source name for connecting to the local process as the "flynn" user.

func (*Process) Info

func (p *Process) Info() (*client.DatabaseInfo, error)

func (*Process) Ready

func (p *Process) Ready() <-chan state.DatabaseEvent

func (*Process) Reconfigure

func (p *Process) Reconfigure(config *state.Config) error

func (*Process) Restore

func (p *Process) Restore(r io.Reader) (*BackupInfo, error)

Restore restores the database from an xbstream backup.

func (*Process) Start

func (p *Process) Start() error

func (*Process) Stop

func (p *Process) Stop() error

func (*Process) XLog

func (p *Process) XLog() xlog.XLog

func (*Process) XLogPosition

func (p *Process) XLogPosition() (xlog.Position, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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