Naanou.LookupService
Class Node

Node. The big mother of a class.

Field Summary
Naanou.LookupService.NodeAddress address
Naanou.LookupService.RequestForwarder backForwarder
Naanou.LookupService.BackwardsFingerTable backwardsFingerTable
Naanou.LookupService.WorkDispatch.Dispatch dispatch
Naanou.LookupService.FingerTable fingerTable
Naanou.Common.Hash id
bool inNetwork
         Node is in a network
Naanou.LookupService.KeyStorage keyStorage
Naanou.Common.ILogger logger
Naanou.Common.Hash networkId
Naanou.LookupService.Cache nodeCache
bool onCycle
long partitionDetectionStart
Naanou.LookupService.PartitionDetect partitionDetector
bool performedNeighbourSync
Naanou.LookupService.NodeAddress predecessorAddress
System.Random random
Naanou.LookupService.RemoteNode rnode
bool seekingBetterPredecessor
bool seekingBetterSuccessor
bool shuttingDown
int stabiliseCount
System.Threading.Thread stabiliserThread
Naanou.LookupService.NodeState state
Naanou.LookupService.SuccessorList successorList
Naanou.LookupService.Network transport

Constructor Summary
Node(Naanou.Common.ILogger logger)
         Constructor

Property Summary
Naanou.LookupService.NodeAddress Address
         Gets an Address representation of this node
Naanou.LookupService.FingerTable BackwardsFingers
         Gets backwards finger table
Naanou.LookupService.RequestForwarder BackwardsForwarder
         Gets the backwards method forwarder
Naanou.LookupService.WorkDispatch.Dispatch Dispatch
         Gets work dispatcer
bool FingersReady
         Returns true if both finger tables are ready, and dont need filling
Naanou.LookupService.FingerTable ForwardFingers
         Gets forward finger table
Naanou.Common.Hash Id
         Gets the nodes id (derived from it's Name)
int KeyCount
         Gets the number of keys stored
Naanou.LookupService.KeyStorage Keys
         Gets key storage used by node
string LocalAddress
Naanou.Common.ILogger Logger
         Gets or sets the logging component
Naanou.LookupService.Network Network
         Gets network
Naanou.Common.Hash NetworkId
         Gets the id of the network node is on
Naanou.LookupService.Cache NodeCache
         Gets a reference to the Node Cache
bool OnCycle
         Is the node in a cycle?
Naanou.LookupService.NodeAddress PredecessorAddress
         Gets the immediate predecessor's address
Naanou.LookupService.RemoteNode RemoteNode
         Gets the remote node for this node
bool ShuttingDown
         Gets whether node is in the process of shutting down
Naanou.LookupService.NodeState State
         Gets the node's current state
Naanou.LookupService.NodeAddress SuccessorAddress
         Gets the immediate successor's address
Naanou.LookupService.SuccessorList SuccessorList
string Url
         Gets the remoting Url for this node

Method Summary
Naanou.LookupService.NodeAddress BackwardsProbe(Naanou.Common.BasicAddress address)
         Used by RemoteNode.BackwardsProbe for fast strong stabilisation (pg 24, Chord paper)
void ClearKeys()
         Clears the keys the node stores
Naanou.Common.BasicAddress ClosestPreceedingAddress(Naanou.Common.Hash id, bool quick)
         Gets the closest preceeding addres of a key.
Naanou.LookupService.NodeAddress ClosestPreceedingNode(Naanou.Common.Hash id, bool quick)
         Implementation of ClosestPreceedingNode. Attempts to find the closest node to id. Called by RemoteNode instance
void DiscoveryCompleted()
         Call back that discovery has been completed
string DumpFingerTable()
         Dumps the finger tables
string DumpKeys()
         Dumps all keys and values node has stored to a string
string DumpNodeCache()
         Dumps the node cache into a string
string DumpSuccessorList()
         Dumps the successor list into a string
void Finalize()
         Deconstructor
void FindSuccessorNode(Naanou.Common.Hash id, bool randomForward, Naanou.Common.FindSuccessorDelegate callback)
         Finds the successor node for a key
void FindSuccessorNode(Naanou.Common.Hash id, bool randomForward, Naanou.Common.FindSuccessorResult result, Naanou.Common.FindSuccessorDelegate callback, bool closeOffState)
         Finds the successor ndoe for a key
void FindSuccessorNodeAsync(Naanou.Common.Hash id, Naanou.Common.BasicAddress nodeToQuery, bool randomForward, Naanou.Common.FindSuccessorResult resultChain, Naanou.Common.FindSuccessorDelegate callback, string requestSerial)
         Finds the successor for a key (Async)
void FindSuccessorNodeAsync(Naanou.Common.Hash id, Naanou.LookupService.NodeAddress nodeToQuery, bool randomForward, Naanou.Common.FindSuccessorResult resultChain, Naanou.Common.FindSuccessorDelegate callback, string requestSerial)
         Finds the successor for a key (Async)
void FoundSuccessorNode(Naanou.Common.FindSuccessorResult result, Naanou.Common.BasicAddress nodeQueried)
         Gets called remotely via Naanou.LookupService.Node.FindSuccessorNodeAsync(Naanou.Common.Hash,Naanou.Common.BasicAddress,System.Boolean,Naanou.Common.FindSuccessorResult,Naanou.Common.FindSuccessorDelegate,System.String)
Naanou.LookupService.NodeAddress GetJoinSuccessor(Naanou.LookupService.NodeAddress bootNode, int hops)
         Gets a node suitable for being our successor. Returns proxied address
void GetKeyAsync(Naanou.Common.Hash id, Naanou.Common.GotKeyDelegate callback, string requestSerial)
         Gets a item from a key
Naanou.Common.KeyContainer[] GetKeyImpl(Naanou.Common.Hash id)
         Gets a data value. Does no range checking
Naanou.Common.BasicAddress[] GetSuccessorList()
void GotKey(Naanou.Common.GetKeyResult result)
         Gets called from RemoteNode else via GetKey
bool IdWithin(Naanou.LookupService.NodeAddress context, Naanou.LookupService.NodeAddress lower, Naanou.LookupService.NodeAddress upper)
         Checks whether id is above lower and under upper.
bool IdWithin(Naanou.Common.Hash id, Naanou.Common.Hash lower, Naanou.Common.Hash upper)
         Checks whether id is above lower and under upper.
void Join(Naanou.LookupService.NodeAddress addressToJoin)
         Join another node in a network
void JoinedNetwork()
         Does stuff that we need to do when we join a network, or when someone else joins us, forming a network
void Log(string message)
         Logs a status message
void Log(string message, Naanou.Common.LogLevel level)
         Logs a message with a log level
bool MightHaveKey(Naanou.Common.Hash id)
void NodeDied(Naanou.LookupService.NodeAddress address)
         General purpose notification point for when a node that we know about has died. Removes from cache, fingers and adjusts successor/predecessor if necessary
void OnBackFingerTableFillCompleted(object sender, System.EventArgs args)
void OnBackFingerTableFillFailed(object sender, System.EventArgs args)
void OnFingerTableFillCompleted(object sender, System.EventArgs args)
void OnFingerTableFillFailed(object sender, System.EventArgs args)
void OnKeyAdded(object sender, Naanou.LookupService.KeyAddedEventArgs args)
void OnKeyRemoved(object sender, Naanou.LookupService.KeyRemovedEventArgs args)
void OnKeysCleared(object sender)
void OnNodeCacheAdded(object sender, Naanou.LookupService.NodeEventArgs args)
         Node has been added to cache. All extra node discoveries after initial discovery will flow through this event
void OnPartitionDetectionComplete(object sender, System.EventArgs args)
void OnSuccessorChange(Naanou.LookupService.Node sender, Naanou.LookupService.AddressChangeArgs args)
         Triggered by the SuccessorList when the active successor has changed
void PartedNetwork()
         Called when we have left the network (forcibly or out of an error condition)
void PartitionDetect()
         Runs discovery again to detect partitions
void PutKey(Naanou.Common.KeyContainer key, int hops)
         Stores a key and associated data value in the distributed hashtable
void PutKey(Naanou.Common.KeyContainer key, int hops, bool onlyLocalPut)
void PutKeyImpl(Naanou.Common.KeyContainer key)
         Stores a key and associated data value. Does no range checking
int PutKeyRemote(Naanou.Common.KeyContainer key, Naanou.Common.FindSuccessorResult location)
void QueryAsync(Naanou.Common.Search.SearchQuery query, Naanou.Common.QueryProgressDelegate clientCallback, Naanou.Common.BasicAddress client, string requestSerial)
         Async querying
void QueryProgress(Naanou.Common.Search.SearchResultSet result, bool completed)
         Gets called from RemoteNode via QueryProgress
void QuerySync(Naanou.Common.Search.SearchPart part, Naanou.Common.QueryProgressDelegate callback, string clientIdSerial, string requestSerial)
         Query
void RefreshAddress()
         Refreshes the address's url and network settings to current instance variable values
void SeekBetterPredecessor()
         Attempts to seek a better predecessor than what we have now. Replaces current predecessor if it has died, or it is better
void SeekBetterPredecessorImpl()
void SeekBetterSuccessor()
         Attempts to seek a better successor than what we have now. Replaces current if it has died or we find a better one.
void SeekBetterSuccessorImpl()
void SetError(string message)
         Set error condition to be presented to user
void SetError(string message, System.Exception exception)
         Set node error condition, which is presented to user
void SetOnCycle(bool cycle)
void SetPredecessor(Naanou.LookupService.NodeAddress address)
         Sets the predecessor and fires Naanou.LookupService.Node.PredecessorChange event. Gets called from RemoteNode after a NotifyPredecessor call by a remote note too.
void SetState(Naanou.LookupService.NodeState state)
         Changes the node state and fires Naanou.LookupService.Node.StateChange event.
void SetSuccessor(Naanou.LookupService.NodeAddress address)
         Sets the successor, and fires the Naanou.LookupService.Node.SuccessorChange event Gets called from RemoteNode after a NotifySuccessor call by a remote node too.
void SetSuccessor(int rank, Naanou.LookupService.NodeAddress address)
         Sets the successor at a particular rank. Old element at its spot will be shuffled up
void StabiliseLoop()
         Runs in Stabilise thread. Runs Naanou.LookupService.Node.WeakStabilise according to Naanou.LookupService.Config.WeakStabiliseFrequency. Runs Naanou.LookupService.Node.StrongFastStabilise once for every Naanou.LookupService.Config.StrongStabiliseRatio weak stabilises. Also does a key storage GC for each strong stabilise
void StabiliseLoopImpl()
void Start()
         Starts communication services for node (transport, then discovery)
void StartStabiliser()
         Starts stabilisationg
void Stop()
         Shuts down a node. Stops stabiliser thread, notifies current pred and succ, transfers keys and stops transport
void StrongFastStabilise()
         Strong stabilise (pg 24, Chord paper)
void StrongSlowStabilise()
         Strong stabilise (Figure 9, pg 21 Chord paper)
void UpdateBackwardFingers()
         Updates backward fingers. CAlled from JoinedNetwork in a different thread
void UpdateForwardFingers()
         Updates forward fingers. Called from JoinedNetwork in a different thread
void UserWarningMessage(string message)
void WeakStabilise()
         Weak stabilise. Verifies successor, and ensures they know about us
void WeakStabiliseSuccessor()

Methods inherited from class System.Object
Equals, GetHashCode, GetType, MemberwiseClone, ToString

Event Summary
Naanou.LookupService.NodeErrorStateHandler ErrorState
         Error state
Naanou.LookupService.PredecessorChangeHandler PredecessorChange
         Predecessor has changed
System.EventHandler StateChange
         State has changed
Naanou.LookupService.SuccessorChangeHandler SuccessorChange
         Successor has changed
Naanou.LookupService.UserWarningHandler UserWarning


Field Detail

address

private Naanou.LookupService.NodeAddress address


backForwarder

private Naanou.LookupService.RequestForwarder backForwarder


backwardsFingerTable

private Naanou.LookupService.BackwardsFingerTable backwardsFingerTable


dispatch

private Naanou.LookupService.WorkDispatch.Dispatch dispatch


fingerTable

private Naanou.LookupService.FingerTable fingerTable


id

private Naanou.Common.Hash id


inNetwork

private bool inNetwork

Node is in a network


keyStorage

private Naanou.LookupService.KeyStorage keyStorage


logger

private Naanou.Common.ILogger logger


networkId

private Naanou.Common.Hash networkId


nodeCache

private Naanou.LookupService.Cache nodeCache


onCycle

private bool onCycle


partitionDetectionStart

private long partitionDetectionStart


partitionDetector

private Naanou.LookupService.PartitionDetect partitionDetector


performedNeighbourSync

private bool performedNeighbourSync


predecessorAddress

private Naanou.LookupService.NodeAddress predecessorAddress


random

private System.Random random


rnode

private Naanou.LookupService.RemoteNode rnode


seekingBetterPredecessor

private bool seekingBetterPredecessor


seekingBetterSuccessor

private bool seekingBetterSuccessor


shuttingDown

private bool shuttingDown


stabiliseCount

private int stabiliseCount


stabiliserThread

private System.Threading.Thread stabiliserThread


state

private Naanou.LookupService.NodeState state


successorList

private Naanou.LookupService.SuccessorList successorList


transport

private Naanou.LookupService.Network transport

Constructor Detail

Node

public Node(Naanou.Common.ILogger logger)

Constructor

Parameters:
name - Name for node
logger - Logger to use
Property Detail

Address

public Naanou.LookupService.NodeAddress Address

Gets an Address representation of this node


BackwardsFingers

public Naanou.LookupService.FingerTable BackwardsFingers

Gets backwards finger table


BackwardsForwarder

public Naanou.LookupService.RequestForwarder BackwardsForwarder

Gets the backwards method forwarder


Dispatch

public Naanou.LookupService.WorkDispatch.Dispatch Dispatch

Gets work dispatcer


FingersReady

public bool FingersReady

Returns true if both finger tables are ready, and dont need filling


ForwardFingers

public Naanou.LookupService.FingerTable ForwardFingers

Gets forward finger table


Id

public Naanou.Common.Hash Id

Gets the nodes id (derived from it's Name)


KeyCount

public int KeyCount

Gets the number of keys stored


Keys

public Naanou.LookupService.KeyStorage Keys

Gets key storage used by node


LocalAddress

public string LocalAddress


Logger

public Naanou.Common.ILogger Logger

Gets or sets the logging component


Network

public Naanou.LookupService.Network Network

Gets network


NetworkId

public Naanou.Common.Hash NetworkId

Gets the id of the network node is on


NodeCache

public Naanou.LookupService.Cache NodeCache

Gets a reference to the Node Cache


OnCycle

internal bool OnCycle

Is the node in a cycle?


PredecessorAddress

public Naanou.LookupService.NodeAddress PredecessorAddress

Gets the immediate predecessor's address


RemoteNode

internal Naanou.LookupService.RemoteNode RemoteNode

Gets the remote node for this node


ShuttingDown

public bool ShuttingDown

Gets whether node is in the process of shutting down


State

public Naanou.LookupService.NodeState State

Gets the node's current state


SuccessorAddress

public Naanou.LookupService.NodeAddress SuccessorAddress

Gets the immediate successor's address


SuccessorList

internal Naanou.LookupService.SuccessorList SuccessorList


Url

public string Url

Gets the remoting Url for this node

Method Detail

BackwardsProbe

public Naanou.LookupService.NodeAddress BackwardsProbe(Naanou.Common.BasicAddress address)

Used by RemoteNode.BackwardsProbe for fast strong stabilisation (pg 24, Chord paper)

Returns:

ClearKeys

public void ClearKeys()

Clears the keys the node stores


ClosestPreceedingAddress

private Naanou.Common.BasicAddress ClosestPreceedingAddress(Naanou.Common.Hash id,
                                                            bool quick)

Gets the closest preceeding addres of a key.

Parameters:
id - Key
quick - Quick search
Returns:
Closest address

ClosestPreceedingNode

internal Naanou.LookupService.NodeAddress ClosestPreceedingNode(Naanou.Common.Hash id,
                                                                bool quick)

Implementation of ClosestPreceedingNode. Attempts to find the closest node to id. Called by RemoteNode instance

Parameters:
id - Id to lookup
quick - Attempt to look up quickly, at the expense of accuracy
Returns:

DiscoveryCompleted

internal void DiscoveryCompleted()

Call back that discovery has been completed


DumpFingerTable

public string DumpFingerTable()

Dumps the finger tables

Returns:
String dump of forward and backward finger tables

DumpKeys

public string DumpKeys()

Dumps all keys and values node has stored to a string

Returns:
Keys and values node has stored

DumpNodeCache

public string DumpNodeCache()

Dumps the node cache into a string

Returns:
String dump of node cache

DumpSuccessorList

public string DumpSuccessorList()

Dumps the successor list into a string

Returns:
String dump of successor list

Finalize

protected void Finalize()

Deconstructor


FindSuccessorNode

internal void FindSuccessorNode(Naanou.Common.Hash id,
                                bool randomForward,
                                Naanou.Common.FindSuccessorDelegate callback)

Finds the successor node for a key

Parameters:
id - Big Integer serial for key
callback - Callback for result

FindSuccessorNode

internal void FindSuccessorNode(Naanou.Common.Hash id,
                                bool randomForward,
                                Naanou.Common.FindSuccessorResult result,
                                Naanou.Common.FindSuccessorDelegate callback,
                                bool closeOffState)

Finds the successor ndoe for a key

Parameters:
id - Key
result - Existing result chain
callback - Callback for result

FindSuccessorNodeAsync

public void FindSuccessorNodeAsync(Naanou.Common.Hash id,
                                   Naanou.Common.BasicAddress nodeToQuery,
                                   bool randomForward,
                                   Naanou.Common.FindSuccessorResult resultChain,
                                   Naanou.Common.FindSuccessorDelegate callback,
                                   string requestSerial)

Finds the successor for a key (Async)

Parameters:
id - Id
nodeToQuery - Node to query
resultChain - Result chain
callback - Callback for result

FindSuccessorNodeAsync

public void FindSuccessorNodeAsync(Naanou.Common.Hash id,
                                   Naanou.LookupService.NodeAddress nodeToQuery,
                                   bool randomForward,
                                   Naanou.Common.FindSuccessorResult resultChain,
                                   Naanou.Common.FindSuccessorDelegate callback,
                                   string requestSerial)

Finds the successor for a key (Async)

Parameters:
id - Id
nodeToQuery - Node to query
resultChain - Result chain
callback - Callback for result

FoundSuccessorNode

public void FoundSuccessorNode(Naanou.Common.FindSuccessorResult result,
                               Naanou.Common.BasicAddress nodeQueried)

Gets called remotely via Naanou.LookupService.Node.FindSuccessorNodeAsync(Naanou.Common.Hash,Naanou.Common.BasicAddress,System.Boolean,Naanou.Common.FindSuccessorResult,Naanou.Common.FindSuccessorDelegate,System.String)

Parameters:
result - Result
nodeQueried - Node queried for successor

GetJoinSuccessor

private Naanou.LookupService.NodeAddress GetJoinSuccessor(Naanou.LookupService.NodeAddress bootNode,
                                                          int hops)

Gets a node suitable for being our successor. Returns proxied address

Returns:

GetKeyAsync

public void GetKeyAsync(Naanou.Common.Hash id,
                        Naanou.Common.GotKeyDelegate callback,
                        string requestSerial)

Gets a item from a key

Parameters:
id - Key
callback - Callback when there is a result
Returns:
Item
Throws:
System.ArgumentException - Key cannot be retrieved
Naanou.LookupService.InvalidNodeState - Node is in an invalid state

GetKeyImpl

internal Naanou.Common.KeyContainer[] GetKeyImpl(Naanou.Common.Hash id)

Gets a data value. Does no range checking

Parameters:
id - Key
Returns:
Returns data value, or null if nothing is at that key
Throws:
Naanou.LookupService.InvalidNodeState - Node is in an invalid state

GetSuccessorList

internal Naanou.Common.BasicAddress[] GetSuccessorList()


GotKey

public void GotKey(Naanou.Common.GetKeyResult result)

Gets called from RemoteNode else via GetKey

Parameters:
result - Result

IdWithin

public bool IdWithin(Naanou.LookupService.NodeAddress context,
                     Naanou.LookupService.NodeAddress lower,
                     Naanou.LookupService.NodeAddress upper)

Checks whether id is above lower and under upper.

Parameters:
context - Context
lower - Lower bound
upper - Upper bound
Returns:
True if context is within bounds

IdWithin

public bool IdWithin(Naanou.Common.Hash id,
                     Naanou.Common.Hash lower,
                     Naanou.Common.Hash upper)

Checks whether id is above lower and under upper.

Parameters:
id - Id to check
lower - Lower bound
upper - Upper bound
Returns:
True if context is within bounds

Join

internal void Join(Naanou.LookupService.NodeAddress addressToJoin)

Join another node in a network

Parameters:
addressToJoin - Boot node
Throws:
Naanou.LookupService.NodeCommunicationException - Thrown when addressToJoin could not be contacted

JoinedNetwork

private void JoinedNetwork()

Does stuff that we need to do when we join a network, or when someone else joins us, forming a network


Log

public void Log(string message)

Logs a status message

Parameters:
message -

Log

public void Log(string message,
                Naanou.Common.LogLevel level)

Logs a message with a log level

Parameters:
message -
level -

MightHaveKey

internal bool MightHaveKey(Naanou.Common.Hash id)


NodeDied

internal void NodeDied(Naanou.LookupService.NodeAddress address)

General purpose notification point for when a node that we know about has died. Removes from cache, fingers and adjusts successor/predecessor if necessary

Parameters:
address -

OnBackFingerTableFillCompleted

private void OnBackFingerTableFillCompleted(object sender,
                                            System.EventArgs args)


OnBackFingerTableFillFailed

private void OnBackFingerTableFillFailed(object sender,
                                         System.EventArgs args)


OnFingerTableFillCompleted

private void OnFingerTableFillCompleted(object sender,
                                        System.EventArgs args)


OnFingerTableFillFailed

private void OnFingerTableFillFailed(object sender,
                                     System.EventArgs args)


OnKeyAdded

private void OnKeyAdded(object sender,
                        Naanou.LookupService.KeyAddedEventArgs args)


OnKeyRemoved

private void OnKeyRemoved(object sender,
                          Naanou.LookupService.KeyRemovedEventArgs args)


OnKeysCleared

private void OnKeysCleared(object sender)


OnNodeCacheAdded

private void OnNodeCacheAdded(object sender,
                              Naanou.LookupService.NodeEventArgs args)

Node has been added to cache. All extra node discoveries after initial discovery will flow through this event

Parameters:
sender -
args -

OnPartitionDetectionComplete

private void OnPartitionDetectionComplete(object sender,
                                          System.EventArgs args)


OnSuccessorChange

private void OnSuccessorChange(Naanou.LookupService.Node sender,
                               Naanou.LookupService.AddressChangeArgs args)

Triggered by the SuccessorList when the active successor has changed

Successor will changed when forced, or when our immediate successor dies

Parameters:
sender -
args -

PartedNetwork

private void PartedNetwork()

Called when we have left the network (forcibly or out of an error condition)


PartitionDetect

private void PartitionDetect()

Runs discovery again to detect partitions


PutKey

public void PutKey(Naanou.Common.KeyContainer key,
                   int hops)

Stores a key and associated data value in the distributed hashtable

Parameters:
key - Key to store
hops - Hop count
Throws:
System.ArgumentException - Key cannot be stored
Naanou.LookupService.InvalidNodeState - Node is in an invalid state

PutKey

public void PutKey(Naanou.Common.KeyContainer key,
                   int hops,
                   bool onlyLocalPut)


PutKeyImpl

internal void PutKeyImpl(Naanou.Common.KeyContainer key)

Stores a key and associated data value. Does no range checking

Parameters:
key - Key
Throws:
Naanou.LookupService.InvalidNodeState - Node is in an invalid state

PutKeyRemote

private int PutKeyRemote(Naanou.Common.KeyContainer key,
                         Naanou.Common.FindSuccessorResult location)


QueryAsync

public void QueryAsync(Naanou.Common.Search.SearchQuery query,
                       Naanou.Common.QueryProgressDelegate clientCallback,
                       Naanou.Common.BasicAddress client,
                       string requestSerial)

Async querying

Parameters:
query - Query to make
clientCallback - Callback to use for progress reportage
client - Client

QueryProgress

public void QueryProgress(Naanou.Common.Search.SearchResultSet result,
                          bool completed)

Gets called from RemoteNode via QueryProgress

Parameters:
result - Result
completed - Is this the last result from this source

QuerySync

internal void QuerySync(Naanou.Common.Search.SearchPart part,
                        Naanou.Common.QueryProgressDelegate callback,
                        string clientIdSerial,
                        string requestSerial)

Query

Parameters:
part - Query part
clientIdSerial - Client
callback - Callback for result reportage

RefreshAddress

public void RefreshAddress()

Refreshes the address's url and network settings to current instance variable values


SeekBetterPredecessor

private void SeekBetterPredecessor()

Attempts to seek a better predecessor than what we have now. Replaces current predecessor if it has died, or it is better


SeekBetterPredecessorImpl

private void SeekBetterPredecessorImpl()


SeekBetterSuccessor

private void SeekBetterSuccessor()

Attempts to seek a better successor than what we have now. Replaces current if it has died or we find a better one.


SeekBetterSuccessorImpl

private void SeekBetterSuccessorImpl()


SetError

public void SetError(string message)

Set error condition to be presented to user

Parameters:
message -

SetError

public void SetError(string message,
                     System.Exception exception)

Set node error condition, which is presented to user

Parameters:
message - Error
exception - Exception to wrap

SetOnCycle

private void SetOnCycle(bool cycle)


SetPredecessor

internal void SetPredecessor(Naanou.LookupService.NodeAddress address)

Sets the predecessor and fires Naanou.LookupService.Node.PredecessorChange event. Gets called from RemoteNode after a NotifyPredecessor call by a remote note too.

Parameters:
address - New predecessor
Throws:
System.ArgumentException - Thrown if predecessor is higher than node's id

SetState

internal void SetState(Naanou.LookupService.NodeState state)

Changes the node state and fires Naanou.LookupService.Node.StateChange event.

Parameters:
state -

SetSuccessor

internal void SetSuccessor(Naanou.LookupService.NodeAddress address)

Sets the successor, and fires the Naanou.LookupService.Node.SuccessorChange event Gets called from RemoteNode after a NotifySuccessor call by a remote node too.

Parameters:
address - New successor
Throws:
System.ArgumentException - Thrown if successor is not higher than node's id

SetSuccessor

internal void SetSuccessor(int rank,
                           Naanou.LookupService.NodeAddress address)

Sets the successor at a particular rank. Old element at its spot will be shuffled up

Parameters:
rank -
address -

StabiliseLoop

private void StabiliseLoop()

Runs in Stabilise thread. Runs Naanou.LookupService.Node.WeakStabilise according to Naanou.LookupService.Config.WeakStabiliseFrequency. Runs Naanou.LookupService.Node.StrongFastStabilise once for every Naanou.LookupService.Config.StrongStabiliseRatio weak stabilises. Also does a key storage GC for each strong stabilise


StabiliseLoopImpl

private void StabiliseLoopImpl()


Start

public void Start()

Starts communication services for node (transport, then discovery)

Returns:
Value indicating if start succeeded

StartStabiliser

private void StartStabiliser()

Starts stabilisationg


Stop

public void Stop()

Shuts down a node. Stops stabiliser thread, notifies current pred and succ, transfers keys and stops transport


StrongFastStabilise

private void StrongFastStabilise()

Strong stabilise (pg 24, Chord paper)


StrongSlowStabilise

private void StrongSlowStabilise()

Strong stabilise (Figure 9, pg 21 Chord paper)


UpdateBackwardFingers

private void UpdateBackwardFingers()

Updates backward fingers. CAlled from JoinedNetwork in a different thread


UpdateForwardFingers

private void UpdateForwardFingers()

Updates forward fingers. Called from JoinedNetwork in a different thread


UserWarningMessage

internal void UserWarningMessage(string message)


WeakStabilise

internal void WeakStabilise()

Weak stabilise. Verifies successor, and ensures they know about us


WeakStabiliseSuccessor

private void WeakStabiliseSuccessor()

Event Detail

ErrorState

public Naanou.LookupService.NodeErrorStateHandler ErrorState

Error state


PredecessorChange

public Naanou.LookupService.PredecessorChangeHandler PredecessorChange

Predecessor has changed


StateChange

public System.EventHandler StateChange

State has changed


SuccessorChange

public Naanou.LookupService.SuccessorChangeHandler SuccessorChange

Successor has changed


UserWarning

public Naanou.LookupService.UserWarningHandler UserWarning