Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BroadcastMessage ¶
type BroadcastMessage struct {
NodeMeta
Action string `json:"Action"`
Content []byte `json:"Content"`
ContentHash [16]byte `json:"ContentHash"`
ConnId string `json:"ConnId"`
}
func (*BroadcastMessage) Finished ¶
func (broadcastMessage *BroadcastMessage) Finished()
Finished Implements Broadcast interface
func (*BroadcastMessage) Invalidates ¶
func (broadcastMessage *BroadcastMessage) Invalidates(other memberlist.Broadcast) bool
Invalidates Implements Broadcast interface
func (*BroadcastMessage) Message ¶
func (broadcastMessage *BroadcastMessage) Message() []byte
Message Implements Broadcast interface
type Delegate ¶
type Delegate struct {
// contains filtered or unexported fields
}
func NewDelegate ¶
func NewDelegate(opts DelegateOpts) *Delegate
func (*Delegate) GetBroadcasts ¶
GetBroadcasts implements Delegate interface
func (*Delegate) LocalState ¶
LocalState implements Delegate interface
func (*Delegate) MergeRemoteState ¶
MergeRemoteState implements Delegate interface
type DelegateOpts ¶
type DelegateOpts struct {
// contains filtered or unexported fields
}
type EventDelegate ¶
type EventDelegate struct {
// contains filtered or unexported fields
}
func NewEventDelegate ¶
func NewEventDelegate(opts EventDelegateOpts) *EventDelegate
func (*EventDelegate) NotifyJoin ¶
func (eventDelegate *EventDelegate) NotifyJoin(node *memberlist.Node)
NotifyJoin implements EventDelegate interface
func (*EventDelegate) NotifyLeave ¶
func (eventDelegate *EventDelegate) NotifyLeave(node *memberlist.Node)
NotifyLeave implements EventDelegate interface
func (*EventDelegate) NotifyUpdate ¶
func (eventDelegate *EventDelegate) NotifyUpdate(node *memberlist.Node)
NotifyUpdate implements EventDelegate interface
type EventDelegateOpts ¶
type EventDelegateOpts struct {
// contains filtered or unexported fields
}
type MemberList ¶
type MemberList struct {
// contains filtered or unexported fields
}
func NewMemberList ¶
func NewMemberList(opts Opts) *MemberList
func (*MemberList) ForwardDataMutation ¶
func (m *MemberList) ForwardDataMutation(ctx context.Context, cmd []byte)
The ForwardDataMutation function is only called by non-leaders. It uses the broadcast queue to forward a data mutation within the cluster.
func (*MemberList) ForwardDeleteKey ¶
func (m *MemberList) ForwardDeleteKey(ctx context.Context, key string)
The ForwardDeleteKey function is only called by non-leaders. It uses the broadcast queue to forward a key eviction command within the cluster.
func (*MemberList) MemberListInit ¶
func (m *MemberList) MemberListInit(ctx context.Context)
func (*MemberList) MemberListShutdown ¶
func (m *MemberList) MemberListShutdown()
type NodeMeta ¶
type NodeMeta struct {
ServerID raft.ServerID `json:"ServerID"`
MemberlistAddr string `json:"MemberlistAddr"`
RaftAddr raft.ServerAddress `json:"RaftAddr"`
}
type Opts ¶
type Opts struct {
Config config.Config
HasJoinedCluster func() bool
AddVoter func(id raft.ServerID, address raft.ServerAddress, prevIndex uint64, timeout time.Duration) error
RemoveRaftServer func(meta NodeMeta) error
IsRaftLeader func() bool
ApplyMutate func(ctx context.Context, cmd []string) ([]byte, error)
ApplyDeleteKey func(ctx context.Context, key string) error
}