memberlist

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

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

func (delegate *Delegate) GetBroadcasts(overhead, limit int) [][]byte

GetBroadcasts implements Delegate interface

func (*Delegate) LocalState

func (delegate *Delegate) LocalState(join bool) []byte

LocalState implements Delegate interface

func (*Delegate) MergeRemoteState

func (delegate *Delegate) MergeRemoteState(buf []byte, join bool)

MergeRemoteState implements Delegate interface

func (*Delegate) NodeMeta

func (delegate *Delegate) NodeMeta(limit int) []byte

NodeMeta implements Delegate interface

func (*Delegate) NotifyMsg

func (delegate *Delegate) NotifyMsg(msgBytes []byte)

NotifyMsg 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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL