Documentation ¶
Index ¶
- Constants
- Variables
- type Cluster
- func (cluster *Cluster) GetAliveMemberIDs() []string
- func (cluster *Cluster) GetAliveMembers() []*Member
- func (cluster *Cluster) GetMember(id string) *Member
- func (cluster *Cluster) GetSortedMembers() []string
- func (cluster *Cluster) IsLeader() bool
- func (cluster *Cluster) Leader() *Member
- func (cluster *Cluster) Local() *Member
- func (cluster *Cluster) Name() string
- type LeaderChangedEvent
- type Manager
- type Member
- func (m *Member) Heartbeat() time.Time
- func (m *Member) IsAlive() bool
- func (m *Member) IsLeader() bool
- func (m *Member) IsLocal() bool
- func (m *Member) SetAlive(alive bool)
- func (m *Member) SetHeartbeat(time time.Time)
- func (m *Member) SetLeader(leader bool)
- func (m *Member) SetLocal(local bool)
- func (m *Member) String() string
- type MemberChangedEvent
- type Repository
Constants ¶
View Source
const ( PathMember = "member" PathHeartbeat = "heartbeat" PathLeader = "leader" )
View Source
const ( MemberChangedEventPath = types.EventPath("member-changed") LeaderChangedEventPath = types.EventPath("leader-changed") )
Variables ¶
View Source
var (
NilMember = Member{}
)
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster ..
func (*Cluster) GetAliveMemberIDs ¶
GetAliveMemberIDs get active member IDs
func (*Cluster) GetAliveMembers ¶
GetAliveMembers get active members
func (*Cluster) GetSortedMembers ¶
GetSortedMembers get all member ids
type LeaderChangedEvent ¶
type LeaderChangedEvent struct { common.DaemonEvent IsLeader bool Leader *Member }
func (LeaderChangedEvent) Path ¶
func (event LeaderChangedEvent) Path() types.EventPath
type Manager ¶
func NewManager ¶
func (*Manager) IsLeaderNode ¶
IsLeaderNode : returns whether this kernel is leader.
type Member ¶
type Member struct { NodeID string `json:"nodeid"` Name string `json:"name"` // contains filtered or unexported fields }
Member member info
func (*Member) SetHeartbeat ¶
SetLocal Set member alive
type MemberChangedEvent ¶
type MemberChangedEvent struct { common.DaemonEvent IsLeader bool AliveMemberIDs []string AliveMembers []*Member }
func (MemberChangedEvent) Path ¶
func (event MemberChangedEvent) Path() types.EventPath
type Repository ¶
type Repository interface { PutMember(member *Member) (err error) GetMember(nodeID string) (member Member, err error) HasMember(nodeID string) (ok bool) PutLeader(leader string) (err error) GetLeader() (leader string, err error) GetAllMembers() (members []*Member, err error) PutHeartbeat(nodeID string) (err error) GetHeartbeats(handler func(nodeid string, time time.Time)) (err error) }
func NewRepository ¶
func NewRepository(config common.DaemonConfig, logger log.Logger, client types.Client) Repository
Click to show internal directories.
Click to hide internal directories.