Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Close() error
- func (c *Client) Dial() error
- func (c *Client) Initialize() error
- func (c *Client) Members() map[string]*sync.ServerInfo
- func (c *Client) NewLocker(ctx context.Context, key sync.Key) (sync.Locker, error)
- func (c *Client) Publish(ctx context.Context, publisherID *time.ActorID, event sync.DocEvent)
- func (c *Client) PublishToLocal(ctx context.Context, publisherID *time.ActorID, event sync.DocEvent)
- func (c *Client) Subscribe(ctx context.Context, subscriber types.Client, keys []key.Key) (*sync.Subscription, map[string][]types.Client, error)
- func (c *Client) Unsubscribe(ctx context.Context, keys []key.Key, sub *sync.Subscription) error
- func (c *Client) UpdatePresence(ctx context.Context, publisher *types.Client, keys []key.Key) (*sync.DocEvent, error)
- type Config
Constants ¶
View Source
const ( // DefaultDialTimeout is the default dial timeout of etcd connection. DefaultDialTimeout = 5 * time.Second // DefaultLockLeaseTime is the default lease time of lock. DefaultLockLeaseTime = 30 * time.Second )
Variables ¶
View Source
var ( //ErrEmptyEndpoints occurs when the endpoints in the config is empty. ErrEmptyEndpoints = errors.New("length of etcd endpoints must be greater than 0") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client that connects to ETCD.
func Dial ¶
func Dial( conf *Config, serverInfo *sync.ServerInfo, ) ( *Client, error)
Dial creates a new instance of Client and dials the given ETCD.
func (*Client) Initialize ¶
Initialize put this server to etcd with TTL periodically.
func (*Client) Members ¶
func (c *Client) Members() map[string]*sync.ServerInfo
Members returns the members of this cluster.
func (*Client) PublishToLocal ¶
func (c *Client) PublishToLocal( ctx context.Context, publisherID *time.ActorID, event sync.DocEvent, )
PublishToLocal publishes the given event.
func (*Client) Subscribe ¶
func (c *Client) Subscribe( ctx context.Context, subscriber types.Client, keys []key.Key, ) (*sync.Subscription, map[string][]types.Client, error)
Subscribe subscribes to the given keys.
func (*Client) Unsubscribe ¶
Unsubscribe unsubscribes the given keys.
type Config ¶
type Config struct { Endpoints []string `yaml:"Endpoints"` DialTimeout string `yaml:"DialTimeout"` Username string `yaml:"Username"` Password string `yaml:"Password"` LockLeaseTime string `yaml:"LockLeaseTime"` }
Config is the configuration for creating a Client instance.
func (*Config) ParseDialTimeout ¶
ParseDialTimeout returns timeout for lock.
func (*Config) ParseLockLeaseTime ¶
ParseLockLeaseTime returns lease time for lock.
Click to show internal directories.
Click to hide internal directories.