node

package
v0.0.0-...-3b800f5 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNodeAndPDNotMatch error for node and pd server are not match
	ErrNodeAndPDNotMatch = errors.New("Node and pd server are not match")
)

Functions

This section is empty.

Types

type Cfg

type Cfg struct {
	ClusterID   uint64
	StoreLables []metapb.Label
	PDEndpoints []string

	RaftStore *raftstore.Cfg
}

Cfg node cfg

func NewCfg

func NewCfg() *Cfg

NewCfg returns default cfg

type Node

type Node struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Node node

func NewNode

func NewNode(clientAddr string, cfg *Cfg, driver storage.Driver) (*Node, error)

NewNode create a node instance, then init store, pd connection and init the cluster ID

func (*Node) Start

func (n *Node) Start() *raftstore.Store

Start start the node. if cluster is not bootstrapped, bootstrap cluster and create the first cell.

func (*Node) Stop

func (n *Node) Stop() error

Stop the node

Jump to

Keyboard shortcuts

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