chord

package
v0.0.0-...-f3f2e11 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package chord is the chord implementation in order to have a Distribted Hash Table

Index

Constants

View Source
const (
	// MaxFingerTableSize - the maximum number of entries in a finger table which
	// is the number of bits in the hash, 8 bits per byte, 20 bytes in hash
	MaxFingerTableSize int = models.M
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalNode

type LocalNode struct {
	*models.Node
	// contains filtered or unexported fields
}

LocalNode - Implementation of ChordNode which holds the datastructure representing a local chord node.

func NewLocalNode

func NewLocalNode(s *protocol.Server, addr string, peer models.Node) (*LocalNode, error)

NewLocalNode - Creation of the new local node

func (*LocalNode) ClosestPrecedingNode

func (ln *LocalNode) ClosestPrecedingNode(id models.Identifier) (models.Node, error)

ClosestPrecedingNode - Find the node that directly preceeds ID closest preceeding node

func (*LocalNode) FingerTableHandler

func (ln *LocalNode) FingerTableHandler(ctx context.Context, r *protocol.Request) protocol.Response

FingerTableHandler - the handler to handle all server calls to get the finger table for the local node

func (*LocalNode) GetPredecessor

func (ln *LocalNode) GetPredecessor() (models.Node, error)

GetPredecessor - Get the predecessor node for this local node

func (*LocalNode) GetPredecessorHandler

func (ln *LocalNode) GetPredecessorHandler(ctx context.Context, r *protocol.Request) protocol.Response

GetPredecessorHandler - the handler to handle all server calls to get predecessor for this local node

func (*LocalNode) Initialize

func (ln *LocalNode) Initialize(peer models.Node) error

Initialize - initialize the chord node

func (*LocalNode) SetPredecessor

func (ln *LocalNode) SetPredecessor(n models.Node) error

SetPredecessor - Set the predecessor node for this local node

func (*LocalNode) SetPredecessorHandler

func (ln *LocalNode) SetPredecessorHandler(ctx context.Context, r *protocol.Request) protocol.Response

SetPredecessorHandler - the handler to handle all server calls to get predecessor for this local node

func (*LocalNode) SetSuccessor

func (ln *LocalNode) SetSuccessor(node models.Node) error

SetSuccessor - Set the successor for this local node, which is the 1st ith entry in the finger table

func (*LocalNode) Stabilize

func (ln *LocalNode) Stabilize() error

Stabilize - stabilize the chord ring, makes sure we are actually predecessor

func (*LocalNode) Successor

func (ln *LocalNode) Successor(id models.Identifier) (models.Node, error)

Successor - This is what this is all about, given an Key we will return the node that is responsible for that Key

func (*LocalNode) SuccessorHandler

func (ln *LocalNode) SuccessorHandler(ctx context.Context, r *protocol.Request) protocol.Response

SuccessorHandler - the handler to handle all server calls to get successor for this local node

func (LocalNode) ToNode

func (ln LocalNode) ToNode() models.Node

ToNode - Convert LocalNode to just a plain Node

func (*LocalNode) UserRegistrationHandler

func (ln *LocalNode) UserRegistrationHandler(ctx context.Context, r *protocol.Request) protocol.Response

UserRegistrationHandler - this handler handles all user registrations. A user registration consists of the user giving the server it's public key, and the server signing that key and placing it within the DHT

type RemoteNode

type RemoteNode struct {
	*models.Node
	// contains filtered or unexported fields
}

RemoteNode - Implementation of ChordNode which holds the datastructure representing a remote chord node. remote nodes will be queried for finger table, predecessor and successsors via PS protocol

func NewRemoteNode

func NewRemoteNode(addr string, key *rsa.PublicKey) (*RemoteNode, error)

NewRemoteNode - create a new remote node, which implements ChordNode, wherein we are able to perform queries on this node

func (*RemoteNode) GetPredecessor

func (rn *RemoteNode) GetPredecessor(key *rsa.PrivateKey) (models.Node, error)

GetPredecessor - Get the predecessor of a remote node

func (*RemoteNode) SetPredecessor

func (rn *RemoteNode) SetPredecessor(node models.Node, key *rsa.PrivateKey) error

SetPredecessor - set the predecessor on a remote node to node

func (*RemoteNode) Successor

func (rn *RemoteNode) Successor(id models.Identifier, key *rsa.PrivateKey) (models.Node, error)

Successor - Call successor on

Jump to

Keyboard shortcuts

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