etcdcli

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SCMarshal

func SCMarshal(s interface{}) ([]byte, error)

SCMarshal Marshal SchedulerCfg

func SCUnmarshal

func SCUnmarshal(data []byte, out interface{}) error

SCUnmarshal Unmarshal SchedulerCfg

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client etcd client

func New

func New(addrs []string) (*Client, error)

New new a etcd client

func (*Client) AcquireMasterLock

func (c *Client) AcquireMasterLock(areaID, serverType string, lID int64) (int64, error)

AcquireMasterLock Request to become a master server

func (*Client) GetEdgeCounts added in v0.1.13

func (c *Client) GetEdgeCounts(selfServerID string) (int, error)

func (*Client) GetServers

func (c *Client) GetServers(nodeType string) (*clientv3.GetResponse, error)

GetServers get servers

func (*Client) PutEdgeCount added in v0.1.13

func (c *Client) PutEdgeCount(serverID string, count int) error

func (*Client) ReleaseMasterLock

func (c *Client) ReleaseMasterLock(leaseID int64, areaID, serverType string) error

ReleaseMasterLock release master lock

func (*Client) ServerRegister

func (c *Client) ServerRegister(t context.Context, serverID, nodeType, value string) error

ServerRegister register to etcd , If already register in, return an error

func (*Client) ServerUnRegister

func (c *Client) ServerUnRegister(t context.Context, serverID, nodeType string) error

ServerUnRegister UnRegister to etcd

func (*Client) WatchServers

func (c *Client) WatchServers(ctx context.Context, nodeType string) clientv3.WatchChan

WatchServers watch server login and logout

Jump to

Keyboard shortcuts

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