Documentation
¶
Overview ¶
Package etcd provides an etcd-backed coordination.Coordinator (Patroni-style leader lease).
Index ¶
- type Coordinator
- func (c *Coordinator) AddMember(ctx context.Context, id string) error
- func (c *Coordinator) ClusterView(ctx context.Context) (coordination.ClusterView, error)
- func (c *Coordinator) GetClusterConfig(ctx context.Context) ([]byte, error)
- func (c *Coordinator) IsLeader() bool
- func (c *Coordinator) LocalID() string
- func (c *Coordinator) RemoveMember(ctx context.Context, id string) error
- func (c *Coordinator) SetClusterConfig(ctx context.Context, cfg []byte) error
- func (c *Coordinator) Start(ctx context.Context) error
- func (c *Coordinator) Stop() error
- func (c *Coordinator) Watch(ctx context.Context) (<-chan coordination.ClusterView, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
Coordinator implements coordination.Coordinator using an etcd leader key + lease.
func New ¶
func New(conf *config.Config) *Coordinator
New builds an etcd coordinator from runtime config.
func (*Coordinator) AddMember ¶
func (c *Coordinator) AddMember(ctx context.Context, id string) error
func (*Coordinator) ClusterView ¶
func (c *Coordinator) ClusterView(ctx context.Context) (coordination.ClusterView, error)
func (*Coordinator) GetClusterConfig ¶
func (c *Coordinator) GetClusterConfig(ctx context.Context) ([]byte, error)
func (*Coordinator) IsLeader ¶
func (c *Coordinator) IsLeader() bool
func (*Coordinator) LocalID ¶
func (c *Coordinator) LocalID() string
func (*Coordinator) RemoveMember ¶
func (c *Coordinator) RemoveMember(ctx context.Context, id string) error
func (*Coordinator) SetClusterConfig ¶
func (c *Coordinator) SetClusterConfig(ctx context.Context, cfg []byte) error
func (*Coordinator) Stop ¶
func (c *Coordinator) Stop() error
func (*Coordinator) Watch ¶
func (c *Coordinator) Watch(ctx context.Context) (<-chan coordination.ClusterView, error)
Click to show internal directories.
Click to hide internal directories.