vnode

package
v0.0.0-...-6a9eff9 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeProtocol

type NodeProtocol interface {
	// FindSuccessors finds N successors of the VNode.
	FindSuccessors(int) ([]NodeProtocol, error)

	// FindSuccessor finds the successor for a Key.
	FindSuccessor(uint64) (NodeProtocol, error)

	// Notify notifies the VNode of its new predecessor.
	Notify(NodeProtocol) error

	// Ping sends a request to a VNode
	Ping() error

	// CheckPredecessor checks the aliveness of VNode's predecessor.
	CheckPredecessor() error

	// GetPredecessor returns the predecessor VNode.
	GetPredecessor() (NodeProtocol, error)

	// IsBetweenNodes check if node lies between
	IsBetweenNodes(NodeProtocol, NodeProtocol) bool

	// ID returns the ID of the VNode.
	ID() uint64

	// Hostname returns the hostname of the VNode.
	Hostname() string
}

NodeProtocol implements the Chord protocol on Vnodes. Local VNodes can implement it via method calls. Remote VNodes can use RPC to transparently work like Local VNodes.

type VNode

type VNode struct {
	// Hostname is the hostname of the VNode.
	Hostname string
}

VNode is a virtual node running the chord protocol.

func InitVNode

func InitVNode(workerHostname string) (*VNode, error)

InitVNode initializes the VNode by computing the hash of the supplied hostname and setting it as the id.

func (*VNode) CheckPredecessor

func (v *VNode) CheckPredecessor() error

func (*VNode) FindSuccessor

func (v *VNode) FindSuccessor(uint64) (*NodeProtocol, error)

func (*VNode) FindSuccessors

func (v *VNode) FindSuccessors(int) ([]*NodeProtocol, error)

Conform VNode to NodeProtocol.

func (*VNode) GetPredecessor

func (v *VNode) GetPredecessor() (*NodeProtocol, error)

func (*VNode) GetSuccessor

func (v *VNode) GetSuccessor() (*NodeProtocol, error)

func (*VNode) IsBetweenNodes

func (v *VNode) IsBetweenNodes(*NodeProtocol, *NodeProtocol) bool

func (*VNode) Notify

func (v *VNode) Notify(*NodeProtocol) error

func (*VNode) Ping

func (v *VNode) Ping() error

Jump to

Keyboard shortcuts

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