mesh

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: 15 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 Channel

type Channel struct {
	gossip.Gossip
	// contains filtered or unexported fields
}

func (*Channel) Del

func (ch *Channel) Del(_ context.Context, key string) (err error)

func (*Channel) KeyOwners

func (ch *Channel) KeyOwners(key string) (nodes []clash.Node)

func (*Channel) Name

func (ch *Channel) Name() string

func (*Channel) OnDel

func (ch *Channel) OnDel(handler func(ctx context.Context, key string))

func (*Channel) OnGet

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

func (*Channel) OnRebase

func (ch *Channel) OnRebase(handler func(ctx context.Context))

func (*Channel) OnSet

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

func (*Channel) OnStats

func (ch *Channel) OnStats(handler func(ctx context.Context) clash.Stats)

func (*Channel) Set

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

func (*Channel) Stats

func (ch *Channel) Stats(ctx context.Context) (stats map[string]Stats)

type Meta

type Meta struct {
	NumCPU   byte   `json:"cpu"`
	Replicas byte   `json:"replicas"`
	Zone     byte   `json:"zone"`
	Hostname string `json:"hostname"`
}

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, err error)

func (*Network) Join

func (swarm *Network) Join(addresses []string)

func (*Network) MakeChannel

func (swarm *Network) MakeChannel(name string) (channel *Channel, err error)

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 SetReplicaFactor

func SetReplicaFactor(factor int) Option

func WithName

func WithName(name string) Option

func WithPort

func WithPort(port int) Option

func WithZone

func WithZone(zone byte) Option

type Stats

type Stats struct {
	Node  Meta        `json:"node"`
	Cache clash.Stats `json:"cache"`
}

Jump to

Keyboard shortcuts

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