mlst

package
v0.0.0-...-04a5bd4 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2019 License: MIT Imports: 7 Imported by: 0

README

Reserved Ranges (Message header)

Begin End Name
0x20000 ... xhashring¹
  • ¹: Preliminary

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RetainBinary

func RetainBinary(r *MessageReader)

Types

type Handler

type Handler func(w *WrapNode, d *MessageReader, msg bufferex.Binary) bool

Returns true, if further processing should be done.

If the implementor wants to retain the msg value it needs to call:

mlst.RetainBinary(d)

on the message-reader 'd'.

type InternalNode

type InternalNode struct {
	Metadata   []byte
	Tlq        memberlist.TransmitLimitedQueue
	Msg        chan bufferex.Binary
	Nodes      sortlist.Sortlist
	AsyncHooks []memberlist.EventDelegate
	SyncHooks  []memberlist.EventDelegate
}

func (*InternalNode) ConsumeB

func (i *InternalNode) ConsumeB(v bufferex.Binary)

func (*InternalNode) ConsumeNB

func (i *InternalNode) ConsumeNB(v bufferex.Binary)

func (*InternalNode) GetBroadcasts

func (i *InternalNode) GetBroadcasts(overhead, limit int) [][]byte

This impl. just opportunistically calls into Tlq

func (*InternalNode) Initialize

func (i *InternalNode) Initialize()

func (*InternalNode) LocalState

func (i *InternalNode) LocalState(join bool) []byte

func (*InternalNode) MergeRemoteState

func (i *InternalNode) MergeRemoteState(buf []byte, join bool)

func (*InternalNode) NodeMeta

func (i *InternalNode) NodeMeta(limit int) []byte

func (*InternalNode) NotifyJoin

func (i *InternalNode) NotifyJoin(node *memberlist.Node)

func (*InternalNode) NotifyLeave

func (i *InternalNode) NotifyLeave(node *memberlist.Node)

func (*InternalNode) NotifyMsg

func (i *InternalNode) NotifyMsg(b []byte)

func (*InternalNode) NotifyUpdate

func (i *InternalNode) NotifyUpdate(node *memberlist.Node)

type MessageBuffer

type MessageBuffer struct {
	*msgpack.Encoder
	bytes.Buffer
}

func (*MessageBuffer) Init

func (m *MessageBuffer) Init() *MessageBuffer

func (*MessageBuffer) Reset

func (m *MessageBuffer) Reset() *MessageBuffer

type MessageReader

type MessageReader struct {
	*msgpack.Decoder
	*bytes.Buffer
	// contains filtered or unexported fields
}

func ReadMessage

func ReadMessage(b []byte) *MessageReader

type NodeMeta

type NodeMeta map[uint32]uint32

func DecodeNodeMeta

func DecodeNodeMeta(m []byte) (n NodeMeta)

func (NodeMeta) Bytes

func (n NodeMeta) Bytes() []byte

func (NodeMeta) Has

func (n NodeMeta) Has(k uint32) (ok bool)

func (NodeMeta) HasFlags

func (n NodeMeta) HasFlags(k, f uint32) (ok bool)

type SendType

type SendType uint
const (
	ST_BestFit    SendType = iota // Use best method.
	ST_Datagram                   // Use Datagram. Suited for small messages that fit in one packet.
	ST_Reliable                   // Use Reliable tramsmission (TCP).
	ST_NoDatagram                 // Use best method, that is not Datagram

	// The folloring methods are kind of Meta-variants.
	ST_Fast   // Use the fastest method.
	ST_Stable // Use the most stable method
)

type WrapNode

type WrapNode struct {
	Name     string
	Meta     NodeMeta
	Deleg    InternalNode
	Membl    *memberlist.Memberlist
	Handlers map[uint64]Handler
}

Start Sequence:

wn := new(WrapNode)
wn.Initialize()
wn.SetCfg(cfg) // set memberlist config (sets cfg.Delegate, etc...)

// Add any Plugins

wn.PreStart()

// start/create memberlist

wn.PostStart()

func (*WrapNode) Initialize

func (w *WrapNode) Initialize()

func (*WrapNode) Lookup

func (w *WrapNode) Lookup(name string) *memberlist.Node

func (*WrapNode) PostStart

func (w *WrapNode) PostStart()

Called, after the memberlist has been created.

func (*WrapNode) PreStart

func (w *WrapNode) PreStart()

Called, before the memberlist has been created.

func (*WrapNode) SendSelf

func (w *WrapNode) SendSelf(msg []byte)

func (*WrapNode) SendTo

func (w *WrapNode) SendTo(st SendType, to *memberlist.Node, msg []byte) error

func (*WrapNode) SetCfg

func (w *WrapNode) SetCfg(cfg *memberlist.Config)

Jump to

Keyboard shortcuts

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