Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultGossipInterval is the default interval for gossip messages DefaultGossipInterval = 200 * time.Millisecond // DefaultGossipNodes is the default number of nodes to gossip to DefaultGossipNodes = 3 // DefaultPushPullInterval is the default interval for push/pull sync DefaultPushPullInterval = 30 * time.Second // DefaultLeaveTimeout is the default timeout for leave announcements DefaultLeaveTimeout = 5 * time.Second // DefaultPacketDialTimeout bounds the TCP connect for each gossip packet. // Zero (dskit's zero value) falls through to the kernel SYN timeout, which // is minutes against an address that black-holes (a pod IP that no longer // exists), and the probe loop is serialized behind it. DefaultPacketDialTimeout = 2 * time.Second // DefaultPacketWriteTimeout bounds the write of a gossip packet (dskit's // flag default); zero means no deadline. DefaultPacketWriteTimeout = 5 * time.Second // DefaultGossipToTheDeadTime is how long a dead node is still gossiped to so // it can refute its death (memberlist's LAN default). DefaultGossipToTheDeadTime = 30 * time.Second // DefaultDeadNodeReclaimTime is how soon a dead node's name may be reused by // an alive announcement from a different address. Node names are stable and // addresses change on restart, so a restarted node must not be refused with // "Conflicting address" until its old entry is reaped. DefaultDeadNodeReclaimTime = 5 * time.Second // DefaultRejoinInterval re-resolves the seeds and rejoins periodically so a // node that has lost every peer finds the cluster again. DefaultRejoinInterval = time.Minute )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Memberlist ¶
type Memberlist struct {
// contains filtered or unexported fields
}
Memberlist wraps dskit's memberlist gossip service with lifecycle management
func NewMemberlist ¶
func NewMemberlist(nodeID, clusterAddr string, seeds []string, logger log.Logger, reg prometheus.Registerer) (*Memberlist, error)
NewMemberlist creates a new memberlist gossip service.
func (*Memberlist) Client ¶
func (m *Memberlist) Client() kv.Client
Client returns the KV client interface for use with dskit ring
func (*Memberlist) GetKV ¶
func (m *Memberlist) GetKV() *memberlist.KV
GetKV returns the underlying memberlist KV for direct access
func (*Memberlist) Start ¶
func (m *Memberlist) Start(ctx context.Context) error
Start starts the memberlist KV service
func (*Memberlist) Stop ¶
func (m *Memberlist) Stop(ctx context.Context) error
Stop stops the memberlist KV service. Uses dskit's built-in service state to handle cleanup correctly: - New state: call Stop() - dskit handles never-started services correctly - Failed state: skip Stop() - dskit would try to create new transport for leave messages - Running state: call Stop() normally for graceful shutdown
Click to show internal directories.
Click to hide internal directories.