instance

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SysProcAttr = &syscall.SysProcAttr{
	Pdeathsig: syscall.SIGKILL,
}

SysProcAttr to be use for every Process we start.

Functions

func CompVersion added in v1.0.5

func CompVersion(comp string, version v0manifest.Version) string

CompVersion return the format to run specified version of a component.

Types

type Config

type Config struct {
	ConfigPath string
	BinPath    string
	Num        int
	Host       string
}

Config of the instance.

type Drainer added in v1.0.5

type Drainer struct {
	Process
	// contains filtered or unexported fields
}

Drainer represent a drainer instance.

func NewDrainer added in v1.0.5

func NewDrainer(binPath string, dir, host, configPath string, id int, pds []*PDInstance) *Drainer

NewDrainer create a Drainer instance.

func (*Drainer) Addr added in v1.0.5

func (d *Drainer) Addr() string

Addr return the address of Drainer.

func (*Drainer) Component added in v1.0.7

func (d *Drainer) Component() string

Component return component name.

func (*Drainer) LogFile added in v1.0.7

func (d *Drainer) LogFile() string

LogFile return the log file name.

func (*Drainer) NodeID added in v1.0.5

func (d *Drainer) NodeID() string

NodeID return the node id of drainer.

func (*Drainer) Start added in v1.0.5

func (d *Drainer) Start(ctx context.Context, version v0manifest.Version) error

Start implements Instance interface.

func (*Drainer) StatusAddrs added in v1.0.5

func (inst *Drainer) StatusAddrs() (addrs []string)

type Instance

type Instance interface {
	Pid() int
	// Start the instance process.
	// Will kill the process once the context is done.
	Start(ctx context.Context, version v0manifest.Version) error
	// Component Return the component name.
	Component() string
	// LogFile return the log file name
	LogFile() string
	// Uptime show uptime.
	Uptime() string
	// StatusAddrs return the address to pull metrics.
	StatusAddrs() []string
	// Wait Should only call this if the instance is started successfully.
	// The implementation should be safe to call Wait multi times.
	Wait() error
}

Instance represent running component

type PDInstance

type PDInstance struct {
	Process
	// contains filtered or unexported fields
}

PDInstance represent a running pd-server

func NewPDInstance

func NewPDInstance(binPath, dir, host, configPath string, id int) *PDInstance

NewPDInstance return a PDInstance

func (*PDInstance) Addr

func (inst *PDInstance) Addr() string

Addr return the listen address of PD

func (*PDInstance) Component added in v1.0.7

func (inst *PDInstance) Component() string

Component return the component name.

func (*PDInstance) InitCluster added in v1.0.3

func (inst *PDInstance) InitCluster(pds []*PDInstance) *PDInstance

InitCluster set the init cluster instance.

func (*PDInstance) Join

func (inst *PDInstance) Join(pds []*PDInstance) *PDInstance

Join set endpoints field of PDInstance

func (*PDInstance) LogFile added in v1.0.7

func (inst *PDInstance) LogFile() string

LogFile return the log file.

func (*PDInstance) Name added in v1.0.5

func (inst *PDInstance) Name() string

Name return the name of pd.

func (*PDInstance) Start

func (inst *PDInstance) Start(ctx context.Context, version v0manifest.Version) error

Start calls set inst.cmd and Start

func (*PDInstance) StatusAddrs added in v1.0.4

func (inst *PDInstance) StatusAddrs() (addrs []string)

type Process added in v1.0.7

type Process interface {
	Start() error
	Wait() error
	Pid() int
	Uptime() string
	SetOutputFile(fname string) error
	Cmd() *exec.Cmd
}

Process represent process to be run by playground

func NewComponentProcess added in v1.0.8

func NewComponentProcess(ctx context.Context, dir, binPath, component string, version v0manifest.Version, arg ...string) (Process, error)

NewComponentProcess create a Process instance.

type Pump added in v1.0.5

type Pump struct {
	Process
	// contains filtered or unexported fields
}

Pump represent a pump instance.

func NewPump added in v1.0.5

func NewPump(binPath string, dir, host, configPath string, id int, pds []*PDInstance) *Pump

NewPump create a Pump instance.

func (*Pump) Addr added in v1.0.5

func (p *Pump) Addr() string

Addr return the address of Pump.

func (*Pump) Component added in v1.0.7

func (p *Pump) Component() string

Component return component name.

func (*Pump) LogFile added in v1.0.7

func (p *Pump) LogFile() string

LogFile return the log file.

func (*Pump) NodeID added in v1.0.5

func (p *Pump) NodeID() string

NodeID return the node id of pump.

func (*Pump) Ready added in v1.0.5

func (p *Pump) Ready(ctx context.Context) error

Ready return nil when pump is ready to serve.

func (*Pump) Start added in v1.0.5

func (p *Pump) Start(ctx context.Context, version v0manifest.Version) error

Start implements Instance interface.

func (*Pump) StatusAddrs added in v1.0.5

func (inst *Pump) StatusAddrs() (addrs []string)

type TiCDC added in v1.2.0

type TiCDC struct {
	Process
	// contains filtered or unexported fields
}

TiCDC represent a ticdc instance.

func NewTiCDC added in v1.2.0

func NewTiCDC(binPath string, dir, host, configPath string, id int, pds []*PDInstance) *TiCDC

NewTiCDC create a TiCDC instance.

func (*TiCDC) Component added in v1.2.0

func (c *TiCDC) Component() string

Component return component name.

func (*TiCDC) LogFile added in v1.2.0

func (c *TiCDC) LogFile() string

LogFile return the log file.

func (*TiCDC) Start added in v1.2.0

func (c *TiCDC) Start(ctx context.Context, version v0manifest.Version) error

Start implements Instance interface.

func (*TiCDC) StatusAddrs added in v1.2.0

func (inst *TiCDC) StatusAddrs() (addrs []string)

type TiDBInstance

type TiDBInstance struct {
	Process
	// contains filtered or unexported fields
}

TiDBInstance represent a running tidb-server

func NewTiDBInstance

func NewTiDBInstance(binPath string, dir, host, configPath string, id int, pds []*PDInstance, enableBinlog bool) *TiDBInstance

NewTiDBInstance return a TiDBInstance

func (*TiDBInstance) Addr

func (inst *TiDBInstance) Addr() string

Addr return the listen address of TiDB

func (*TiDBInstance) Component added in v1.0.7

func (inst *TiDBInstance) Component() string

Component return the component name.

func (*TiDBInstance) LogFile added in v1.0.7

func (inst *TiDBInstance) LogFile() string

LogFile return the log file name.

func (*TiDBInstance) Start

func (inst *TiDBInstance) Start(ctx context.Context, version v0manifest.Version) error

Start calls set inst.cmd and Start

func (*TiDBInstance) StatusAddrs added in v1.0.4

func (inst *TiDBInstance) StatusAddrs() (addrs []string)

type TiFlashInstance

type TiFlashInstance struct {
	TCPPort         int
	ServicePort     int
	ProxyPort       int
	ProxyStatusPort int
	ProxyConfigPath string

	Process
	// contains filtered or unexported fields
}

TiFlashInstance represent a running TiFlash

func NewTiFlashInstance

func NewTiFlashInstance(binPath, dir, host, configPath string, id int, pds []*PDInstance, dbs []*TiDBInstance) *TiFlashInstance

NewTiFlashInstance return a TiFlashInstance

func (*TiFlashInstance) Addr added in v1.0.5

func (inst *TiFlashInstance) Addr() string

Addr return the address of tiflash

func (*TiFlashInstance) Cmd added in v1.0.4

func (inst *TiFlashInstance) Cmd() *exec.Cmd

Cmd returns the internal Cmd instance

func (*TiFlashInstance) Component added in v1.0.7

func (inst *TiFlashInstance) Component() string

Component return the component name.

func (*TiFlashInstance) LogFile added in v1.0.7

func (inst *TiFlashInstance) LogFile() string

LogFile return the log file name.

func (*TiFlashInstance) Start

func (inst *TiFlashInstance) Start(ctx context.Context, version v0manifest.Version) error

Start calls set inst.cmd and Start

func (*TiFlashInstance) StatusAddrs added in v1.0.4

func (inst *TiFlashInstance) StatusAddrs() (addrs []string)

StatusAddrs implements Instance interface.

func (*TiFlashInstance) StoreAddr

func (inst *TiFlashInstance) StoreAddr() string

StoreAddr return the store address of TiFlash

type TiKVInstance

type TiKVInstance struct {
	Process
	// contains filtered or unexported fields
}

TiKVInstance represent a running tikv-server

func NewTiKVInstance

func NewTiKVInstance(binPath string, dir, host, configPath string, id int, pds []*PDInstance) *TiKVInstance

NewTiKVInstance return a TiKVInstance

func (*TiKVInstance) Addr added in v1.0.5

func (inst *TiKVInstance) Addr() string

Addr return the address of tikv.

func (*TiKVInstance) Component added in v1.0.7

func (inst *TiKVInstance) Component() string

Component return the component name.

func (*TiKVInstance) LogFile added in v1.0.7

func (inst *TiKVInstance) LogFile() string

LogFile return the log file name.

func (*TiKVInstance) Start

func (inst *TiKVInstance) Start(ctx context.Context, version v0manifest.Version) error

Start calls set inst.cmd and Start

func (*TiKVInstance) StatusAddrs added in v1.0.4

func (inst *TiKVInstance) StatusAddrs() (addrs []string)

func (*TiKVInstance) StoreAddr

func (inst *TiKVInstance) StoreAddr() string

StoreAddr return the store address of TiKV

Jump to

Keyboard shortcuts

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