Documentation ¶
Index ¶
- type Empty
- type EtcdMaster
- func (e *EtcdMaster) CheckSelfNode() (bool, error)
- func (e *EtcdMaster) Clean() error
- func (e *EtcdMaster) Finit()
- func (e *EtcdMaster) GetAllNodes() ([]*bcstypes.ServerInfo, error)
- func (e *EtcdMaster) GetPath() string
- func (e *EtcdMaster) Init() error
- func (e *EtcdMaster) IsMaster() bool
- func (e *EtcdMaster) Register() error
- type Master
- type ZookeeperMaster
- func (zk *ZookeeperMaster) CheckSelfNode() (bool, error)
- func (zk *ZookeeperMaster) Clean() error
- func (zk *ZookeeperMaster) Finit()
- func (zk *ZookeeperMaster) GetAllNodes() ([]*bcstypes.ServerInfo, error)
- func (zk *ZookeeperMaster) GetPath() string
- func (zk *ZookeeperMaster) Init() error
- func (zk *ZookeeperMaster) IsMaster() bool
- func (zk *ZookeeperMaster) Register() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Empty ¶
type Empty struct{}
Empty for test
func (*Empty) CheckSelfNode ¶
CheckSelfNode check self node exist, and data correct
func (*Empty) GetAllNodes ¶
func (e *Empty) GetAllNodes() ([]*bcstypes.ServerInfo, error)
GetAllNodes get all server nodes
type EtcdMaster ¶
type EtcdMaster struct{}
Empty for test
func (*EtcdMaster) CheckSelfNode ¶
func (e *EtcdMaster) CheckSelfNode() (bool, error)
CheckSelfNode check self node exist, and data correct
func (*EtcdMaster) GetAllNodes ¶
func (e *EtcdMaster) GetAllNodes() ([]*bcstypes.ServerInfo, error)
GetAllNodes get all server nodes
func (*EtcdMaster) GetPath ¶
func (e *EtcdMaster) GetPath() string
GetPath setting self info, now is ip address & port
func (*EtcdMaster) IsMaster ¶
func (e *EtcdMaster) IsMaster() bool
IsMaster check if self is master or not
func (*EtcdMaster) Register ¶
func (e *EtcdMaster) Register() error
Register registery infomation to storage
type Master ¶
type Master interface { Init() error //init stage, like create connection Finit() //finit, release resource Register() error //registery infomation to storage Clean() error //clean self node IsMaster() bool //check if self is master or not CheckSelfNode() (bool, error) //check self node exist, and data correct GetAllNodes() ([]*bcstypes.ServerInfo, error) //get all server nodes GetPath() string //get parent path }
Master register server node in event storage, like zookeeper, etcd, check if local node is master
func NewZookeeperMaster ¶
NewZookeeperMaster create zk master
type ZookeeperMaster ¶
type ZookeeperMaster struct {
// contains filtered or unexported fields
}
ZookeeperMaster implementation for master in zookeeper
func (*ZookeeperMaster) CheckSelfNode ¶
func (zk *ZookeeperMaster) CheckSelfNode() (bool, error)
CheckSelfNode check self node exist, and data correct
func (*ZookeeperMaster) Finit ¶
func (zk *ZookeeperMaster) Finit()
Finit init stage, like create connection
func (*ZookeeperMaster) GetAllNodes ¶
func (zk *ZookeeperMaster) GetAllNodes() ([]*bcstypes.ServerInfo, error)
GetAllNodes get all server nodes
func (*ZookeeperMaster) GetPath ¶
func (zk *ZookeeperMaster) GetPath() string
GetPath setting self info, now is ip address & port
func (*ZookeeperMaster) Init ¶
func (zk *ZookeeperMaster) Init() error
Init init stage, like create connection
func (*ZookeeperMaster) IsMaster ¶
func (zk *ZookeeperMaster) IsMaster() bool
IsMaster check if self is master or not
func (*ZookeeperMaster) Register ¶
func (zk *ZookeeperMaster) Register() error
Register registery infomation to storage