Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) Close() error
- func (c *Client) Dial() error
- func (c *Client) Initialize() error
- func (c *Client) Members() map[string]*sync.AgentInfo
- 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, topics []*key.Key) (*sync.Subscription, map[string][]types.Client, error)
- func (c *Client) Unsubscribe(ctx context.Context, topics []*key.Key, sub *sync.Subscription)
- type Config
Constants ¶
View Source
const ( // DefaultDialTimeoutSec is the default dial timeout of etcd connection. DefaultDialTimeoutSec = 5 // DefaultLockLeaseTimeSec is the default lease time of lock. DefaultLockLeaseTimeSec = 30 )
Variables ¶
This section is empty.
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 (*Client) Initialize ¶ added in v0.1.5
Initialize put this agent to etcd with TTL periodically.
func (*Client) PublishToLocal ¶ added in v0.1.6
func (c *Client) PublishToLocal( ctx context.Context, publisherID *time.ActorID, event sync.DocEvent, )
PublishToLocal publishes the given event to the given Topic.
func (*Client) Subscribe ¶ added in v0.1.5
func (c *Client) Subscribe( ctx context.Context, subscriber types.Client, topics []*key.Key, ) (*sync.Subscription, map[string][]types.Client, error)
Subscribe subscribes to the given topics.
func (*Client) Unsubscribe ¶ added in v0.1.5
Unsubscribe unsubscribes the given topics.
type Config ¶
type Config struct { Endpoints []string `json:"Endpoints"` DialTimeoutSec time.Duration `json:"DialTimeoutSec"` Username string `json:"Username"` Password string `json:"Password"` LockLeaseTimeSec int `json:"LockLeaseTimeSec"` }
Config is the configuration for creating a Client instance.
Click to show internal directories.
Click to hide internal directories.