chord

package
v0.0.0-...-d687121 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChordStatsHandler

func ChordStatsHandler(rootNode *LocalNode, virtualNodes []*LocalNode) http.Handler

Types

type LocalNode

type LocalNode struct {
	NodeConfig
	// contains filtered or unexported fields
}

func NewLocalNode

func NewLocalNode(conf NodeConfig) *LocalNode

func (*LocalNode) Acquire

func (n *LocalNode) Acquire(ctx context.Context, lease []byte, ttl time.Duration) (uint64, error)

func (*LocalNode) AttachExternal

func (n *LocalNode) AttachExternal(ctx context.Context, listener net.Listener)

func (*LocalNode) AttachRoot

func (n *LocalNode) AttachRoot(ctx context.Context, router *transport.StreamRouter)

func (*LocalNode) AttachRouter

func (n *LocalNode) AttachRouter(ctx context.Context, router *transport.StreamRouter)

func (*LocalNode) Create

func (n *LocalNode) Create() error

func (*LocalNode) Delete

func (n *LocalNode) Delete(ctx context.Context, key []byte) error

func (*LocalNode) FindSuccessor

func (n *LocalNode) FindSuccessor(key uint64) (chord.VNode, error)

func (*LocalNode) FinishJoin

func (n *LocalNode) FinishJoin(stabilize bool, release bool) error

func (*LocalNode) FinishLeave

func (n *LocalNode) FinishLeave(stabilize bool, release bool) error

func (*LocalNode) Get

func (n *LocalNode) Get(ctx context.Context, key []byte) ([]byte, error)

func (*LocalNode) GetPredecessor

func (n *LocalNode) GetPredecessor() (chord.VNode, error)

func (*LocalNode) GetSuccessors

func (n *LocalNode) GetSuccessors() ([]chord.VNode, error)

func (*LocalNode) ID

func (n *LocalNode) ID() uint64

func (*LocalNode) Identity

func (n *LocalNode) Identity() *protocol.Node

func (*LocalNode) Import

func (n *LocalNode) Import(ctx context.Context, keys [][]byte, values []*protocol.KVTransfer) error

func (*LocalNode) Join

func (n *LocalNode) Join(peer chord.VNode) error

func (*LocalNode) Leave

func (n *LocalNode) Leave()

func (*LocalNode) ListKeys

func (n *LocalNode) ListKeys(ctx context.Context, prefix []byte) ([]*protocol.KeyComposite, error)

func (*LocalNode) Notify

func (n *LocalNode) Notify(predecessor chord.VNode) error

func (*LocalNode) Ping

func (n *LocalNode) Ping() error

func (*LocalNode) PrefixAppend

func (n *LocalNode) PrefixAppend(ctx context.Context, prefix []byte, child []byte) error

func (*LocalNode) PrefixContains

func (n *LocalNode) PrefixContains(ctx context.Context, prefix []byte, child []byte) (bool, error)

func (*LocalNode) PrefixList

func (n *LocalNode) PrefixList(ctx context.Context, prefix []byte) ([][]byte, error)

func (*LocalNode) PrefixRemove

func (n *LocalNode) PrefixRemove(ctx context.Context, prefix []byte, child []byte) error

func (*LocalNode) Put

func (n *LocalNode) Put(ctx context.Context, key, value []byte) error

func (*LocalNode) Release

func (n *LocalNode) Release(ctx context.Context, lease []byte, token uint64) error

func (*LocalNode) Renew

func (n *LocalNode) Renew(ctx context.Context, lease []byte, ttl time.Duration, prevToken uint64) (uint64, error)

func (*LocalNode) RequestToJoin

func (n *LocalNode) RequestToJoin(joiner chord.VNode) (chord.VNode, []chord.VNode, error)

func (*LocalNode) RequestToLeave

func (n *LocalNode) RequestToLeave(leaver chord.VNode) error

type NodeConfig

type NodeConfig struct {
	KVProvider               chord.KVProvider
	ChordClient              rpc.ChordClient
	BaseLogger               *zap.Logger
	Identity                 *protocol.Node
	NodesRTT                 rtt.Recorder
	StabilizeInterval        time.Duration
	FixFingerInterval        time.Duration
	PredecessorCheckInterval time.Duration
}

func (*NodeConfig) Validate

func (c *NodeConfig) Validate() error

type RemoteNode

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

func NewRemoteNode

func NewRemoteNode(ctx context.Context, baseLogger *zap.Logger, chordClient rpc.ChordClient, peer *protocol.Node) (*RemoteNode, error)

func (*RemoteNode) Acquire

func (n *RemoteNode) Acquire(ctx context.Context, lease []byte, ttl time.Duration) (uint64, error)

func (*RemoteNode) Delete

func (n *RemoteNode) Delete(ctx context.Context, key []byte) error

func (*RemoteNode) FindSuccessor

func (n *RemoteNode) FindSuccessor(key uint64) (chord.VNode, error)

func (*RemoteNode) FinishJoin

func (n *RemoteNode) FinishJoin(stabilize bool, release bool) error

func (*RemoteNode) FinishLeave

func (n *RemoteNode) FinishLeave(stabilize bool, release bool) error

func (*RemoteNode) Get

func (n *RemoteNode) Get(ctx context.Context, key []byte) ([]byte, error)

func (*RemoteNode) GetPredecessor

func (n *RemoteNode) GetPredecessor() (chord.VNode, error)

func (*RemoteNode) GetSuccessors

func (n *RemoteNode) GetSuccessors() ([]chord.VNode, error)

func (*RemoteNode) ID

func (n *RemoteNode) ID() uint64

func (*RemoteNode) Identity

func (n *RemoteNode) Identity() *protocol.Node

func (*RemoteNode) Import

func (n *RemoteNode) Import(ctx context.Context, keys [][]byte, values []*protocol.KVTransfer) error

func (*RemoteNode) ListKeys

func (n *RemoteNode) ListKeys(ctx context.Context, prefix []byte) ([]*protocol.KeyComposite, error)

func (*RemoteNode) Notify

func (n *RemoteNode) Notify(predecessor chord.VNode) error

func (*RemoteNode) Ping

func (n *RemoteNode) Ping() error

func (*RemoteNode) PrefixAppend

func (n *RemoteNode) PrefixAppend(ctx context.Context, prefix []byte, child []byte) error

func (*RemoteNode) PrefixContains

func (n *RemoteNode) PrefixContains(ctx context.Context, prefix []byte, child []byte) (bool, error)

func (*RemoteNode) PrefixList

func (n *RemoteNode) PrefixList(ctx context.Context, prefix []byte) ([][]byte, error)

func (*RemoteNode) PrefixRemove

func (n *RemoteNode) PrefixRemove(ctx context.Context, prefix []byte, child []byte) error

func (*RemoteNode) Put

func (n *RemoteNode) Put(ctx context.Context, key, value []byte) error

func (*RemoteNode) Release

func (n *RemoteNode) Release(ctx context.Context, lease []byte, token uint64) error

func (*RemoteNode) Renew

func (n *RemoteNode) Renew(ctx context.Context, lease []byte, ttl time.Duration, prevToken uint64) (newToken uint64, err error)

func (*RemoteNode) RequestToJoin

func (n *RemoteNode) RequestToJoin(joiner chord.VNode) (chord.VNode, []chord.VNode, error)

func (*RemoteNode) RequestToLeave

func (n *RemoteNode) RequestToLeave(leaver chord.VNode) error

type RemoteNodeFactory

type RemoteNodeFactory func(*protocol.Node) (chord.VNode, error)

type Server

type Server struct {
	LocalNode chord.VNode
	Factory   RemoteNodeFactory
}

func (*Server) Acquire

func (*Server) Append

func (*Server) Contains

func (*Server) Delete

func (*Server) Get

func (*Server) Identity

func (*Server) Import

func (*Server) List

func (*Server) ListKeys

func (*Server) Notify

func (*Server) Ping

func (*Server) Put

func (*Server) Release

func (*Server) Remove

func (*Server) Renew

Jump to

Keyboard shortcuts

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