memberlist

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeStats
)

Variables

View Source
var ErrNotFound = errors.New("not found")
View Source
var ErrTimeout = errors.New("timeout")

Functions

This section is empty.

Types

type Meta

type Meta struct {
	NumCPU   byte
	Replicas byte
	Zone     byte
	Salt     string
	Hostname string
}

func (Meta) Bytes

func (m Meta) Bytes() (bytes []byte)

type Network

type Network struct {
	// contains filtered or unexported fields
}

func New

func New(log logrus.FieldLogger, opts ...Option) (swarm *Network)

func (*Network) Del

func (swarm *Network) Del(_ context.Context, key string) (err error)

func (*Network) GetBroadcasts

func (swarm *Network) GetBroadcasts(overhead, limit int) (broadcasts [][]byte)

func (*Network) Join

func (swarm *Network) Join(addresses []string) (success int, err error)

func (*Network) KeyOwners

func (swarm *Network) KeyOwners(key string) (nodes []clash.Node)

func (*Network) LocalState

func (swarm *Network) LocalState(join bool) (bytes []byte)

func (*Network) MergeRemoteState

func (swarm *Network) MergeRemoteState(_ []byte, _ bool)

func (*Network) Name

func (swarm *Network) Name() string

func (*Network) NodeMeta

func (swarm *Network) NodeMeta(limit int) (bytes []byte)

func (*Network) NotifyJoin

func (swarm *Network) NotifyJoin(node *memberlist.Node)

func (*Network) NotifyLeave

func (swarm *Network) NotifyLeave(node *memberlist.Node)

func (*Network) NotifyMsg

func (swarm *Network) NotifyMsg(bytes []byte)

func (*Network) NotifyUpdate

func (swarm *Network) NotifyUpdate(node *memberlist.Node)

func (*Network) OnDel

func (swarm *Network) OnDel(handler func(ctx context.Context, key string))

func (*Network) OnGet

func (swarm *Network) OnGet(handler func(ctx context.Context, key string) (value []byte, expiredAt time.Time, found bool))

func (*Network) OnRebase

func (swarm *Network) OnRebase(handler func(ctx context.Context))

func (*Network) OnSet

func (swarm *Network) OnSet(handler func(ctx context.Context, key string, value []byte, expiredAt time.Time))

func (*Network) OnStats

func (swarm *Network) OnStats(handler func(ctx context.Context) clash.Stats)

func (*Network) Set

func (swarm *Network) Set(_ context.Context, key string, value []byte, expiredAt time.Time) (err error)

func (*Network) Start

func (swarm *Network) Start() (err error)

func (*Network) Stats

func (swarm *Network) Stats(ctx context.Context) (stats map[string]clash.Stats)

type Node

type Node struct {
	// contains filtered or unexported fields
}

func (*Node) Get

func (node *Node) Get(ctx context.Context, key string) (value []byte, expiredAt time.Time, err error)

func (*Node) GetTransport

func (node *Node) GetTransport() clash.Transport

func (*Node) ID

func (node *Node) ID() string

type Option

type Option func(swarm *Network)

func SetBufferSize

func SetBufferSize(bufferSize int) Option

func SetReplicaFactor

func SetReplicaFactor(factor int) Option

func WithCompression

func WithCompression(enable bool) Option

func WithName

func WithName(name string) Option

func WithPort

func WithPort(port int) Option

func WithZone

func WithZone(zone byte) Option

Jump to

Keyboard shortcuts

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