Documentation ¶
Index ¶
- type NodeProtocol
- type VNode
- func (v *VNode) CheckPredecessor() error
- func (v *VNode) FindSuccessor(uint64) (*NodeProtocol, error)
- func (v *VNode) FindSuccessors(int) ([]*NodeProtocol, error)
- func (v *VNode) GetPredecessor() (*NodeProtocol, error)
- func (v *VNode) GetSuccessor() (*NodeProtocol, error)
- func (v *VNode) IsBetweenNodes(*NodeProtocol, *NodeProtocol) bool
- func (v *VNode) Notify(*NodeProtocol) error
- func (v *VNode) Ping() error
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 ¶
InitVNode initializes the VNode by computing the hash of the supplied hostname and setting it as the id.
func (*VNode) CheckPredecessor ¶
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
Click to show internal directories.
Click to hide internal directories.