Documentation ¶
Overview ¶
Package chord is the chord implementation in order to have a Distribted Hash Table
Index ¶
- Constants
- type LocalNode
- func (ln *LocalNode) ClosestPrecedingNode(id models.Identifier) (models.Node, error)
- func (ln *LocalNode) FingerTableHandler(ctx context.Context, r *protocol.Request) protocol.Response
- func (ln *LocalNode) GetPredecessor() (models.Node, error)
- func (ln *LocalNode) GetPredecessorHandler(ctx context.Context, r *protocol.Request) protocol.Response
- func (ln *LocalNode) Initialize(peer models.Node) error
- func (ln *LocalNode) SetPredecessor(n models.Node) error
- func (ln *LocalNode) SetPredecessorHandler(ctx context.Context, r *protocol.Request) protocol.Response
- func (ln *LocalNode) SetSuccessor(node models.Node) error
- func (ln *LocalNode) Stabilize() error
- func (ln *LocalNode) Successor(id models.Identifier) (models.Node, error)
- func (ln *LocalNode) SuccessorHandler(ctx context.Context, r *protocol.Request) protocol.Response
- func (ln LocalNode) ToNode() models.Node
- func (ln *LocalNode) UserRegistrationHandler(ctx context.Context, r *protocol.Request) protocol.Response
- type RemoteNode
Constants ¶
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 ¶
LocalNode - Implementation of ChordNode which holds the datastructure representing a local chord node.
func NewLocalNode ¶
NewLocalNode - Creation of the new local node
func (*LocalNode) ClosestPrecedingNode ¶
ClosestPrecedingNode - Find the node that directly preceeds ID closest preceeding node
func (*LocalNode) FingerTableHandler ¶
FingerTableHandler - the handler to handle all server calls to get the finger table for the local node
func (*LocalNode) GetPredecessor ¶
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 ¶
Initialize - initialize the chord node
func (*LocalNode) SetPredecessor ¶
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 ¶
SetSuccessor - Set the successor for this local node, which is the 1st ith entry in the finger table
func (*LocalNode) Stabilize ¶
Stabilize - stabilize the chord ring, makes sure we are actually predecessor
func (*LocalNode) Successor ¶
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 ¶
SuccessorHandler - the handler to handle all server calls to get successor for this local 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 ¶
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