Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegAndWatchs ¶
Types ¶
type EtcdClient ¶
type EtcdClient struct { // config EtcdAddrs []string // etcd server address ServerPath string // like "/game" Watch chan bool // attr KeysAPI client.KeysAPI ServerInfos []*ServerInfo // server infos LastIndex uint64 // last modify index sync.Mutex // mutex for this.ServerAddrs op }
func NewEtcdClient ¶
func NewEtcdClient(etcdAddrs []string, serverPath string) *EtcdClient
func (*EtcdClient) GetServerInfos ¶
func (this *EtcdClient) GetServerInfos() []*ServerInfo
type EtcdRegister ¶
type EtcdRegister struct { EtcdAddrs []string // etcd server address ServerPath string // like "/game" ServerAddr string // like "xx.xx.xxx.x:1234" UpdateInterval time.Duration // update register interval ServerNodeTTL time.Duration // server node ttl ServerValue string KeysAPI client.KeysAPI // contains filtered or unexported fields }
func NewEtcdRegister ¶
func NewEtcdRegister(etcdAddrs []string, updateInterval, serverNodeTTL time.Duration) *EtcdRegister
func (*EtcdRegister) Register ¶
func (this *EtcdRegister) Register(serverPath, serverAddr, value string)
func (*EtcdRegister) Unregister ¶
func (this *EtcdRegister) Unregister()
type ServerInfo ¶
Click to show internal directories.
Click to hide internal directories.