Naanou.LookupService
Class FingerTable

Finger table

Field Summary
double d
         Finger distance. As per pg42 of Chord docs
Naanou.Common.Hash[] entries
         Entries on finger table - i.e. finger locations. These remain static throughout entire instance of application
int entriesSize
         How many entries (fingers)
int FINGER_FILL_TIMEOUT
         Number of seconds to wait for a finger filler before giving up
double fingerPowers
         Computed finger distance. As per pg42 of Chord docs.
long fingerRequestStart
         Time (ticks) finger update was requested, or less than or equal to 0 if there are no outstanding requests
bool forward
         Is the finger table forward looking?
string logName
         Name to use for class in logging
Naanou.LookupService.Node node
         Local node
Naanou.Common.Hash nodeId
         Local node id
System.Collections.Hashtable nodes
         Nodes. Nodes are stored in hashtable by ids that match ones found in Naanou.LookupService.FingerTable.entries.
Naanou.Common.BasicAddress requestedFingersFrom
         Where fingers were requested from
int TABLE_SIZE

Constructor Summary
FingerTable(Naanou.LookupService.Node node)
         Constructor

Property Summary
Naanou.LookupService.NodeAddress[] Addresses
         Gets all addresses contained by table
int Count
         Gets the number of nodes fingered
bool FingerRequestExpired
bool IsForward
         Is the table forward looking?
Naanou.LookupService.Node Node
         Gets the node associated with this table
string Stats
         Gets short stats about table (util, count, entries size)
double Util
         Gets utilisation of finger table

Method Summary
void AddressNotify(Naanou.LookupService.NodeAddress address)
         Called when Node knows about a new address. Try to put it into finger table somewhere
void BuildTable()
         Builds the finger table
void ChangeKey(Naanou.Common.Hash fingerLocation, Naanou.LookupService.NodeAddress newAddress, Naanou.LookupService.NodeAddress oldAddress)
         Changes a hash key
void Clear()
         Clear finger entries, but maintains finger locations
string Dump()
         Dumps out the fingers and their values
Naanou.LookupService.NodeAddress FindClosest(Naanou.Common.Hash id)
         Finds the closest node to id (Above internal node's id and below id). Only returns alive addresses.
int GetClosestEntriesIndex(Naanou.Common.Hash id)
         Gets the closest index on the entries array to id=. Will fuzzy match the closest LOWER index if no exact can be found
Naanou.LookupService.NodeAddress GetKey(Naanou.Common.Hash key)
         Gets a node at a particular key
Naanou.LookupService.NodeAddress GetReplacement(Naanou.Common.Hash id)
         Gets the node nearest to id, but not the node with that id
bool NeedsFilling()
         Gets whether table needs filling
void NotifyFingers(Naanou.Common.BasicAddress[] addresses, Naanou.Common.BasicAddress source)
         Notification passed in via Naanou.LookupService.FingerTable.Node from a remote object setting finger values
void OnNodeAddedToCache(object sender, Naanou.LookupService.NodeEventArgs e)
         Triggered when the cache knows about a new node
void OnNodeRemovedFromCache(object sender, Naanou.LookupService.NodeEventArgs e)
         Called when a node has been forcibly removed from cache - ie: died/shutdown. Need to update fingers
void RemoveNode(Naanou.LookupService.NodeAddress address)
         Remove an address from finger table, and rearrange existing
void Reset(Naanou.LookupService.Node node)
         Resets finger table, triggering a rebuild of fingers
string ToString()
         Returns a string representation of the object
void UpdateFingers(Naanou.LookupService.NodeAddress existingNode)
         Updates fingers by interrogating an existing node

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

Event Summary
System.EventHandler FingerFillFailed
         Finger fill has failed
Naanou.LookupService.FingerKeyChangeHandler FingerKeyChange
         Triggered when a finger has changed


Field Detail

d

protected double d

Finger distance. As per pg42 of Chord docs


entries

protected Naanou.Common.Hash[] entries

Entries on finger table - i.e. finger locations. These remain static throughout entire instance of application


entriesSize

protected int entriesSize

How many entries (fingers)


FINGER_FILL_TIMEOUT

private int FINGER_FILL_TIMEOUT

Number of seconds to wait for a finger filler before giving up


fingerPowers

protected double fingerPowers

Computed finger distance. As per pg42 of Chord docs.


fingerRequestStart

protected long fingerRequestStart

Time (ticks) finger update was requested, or less than or equal to 0 if there are no outstanding requests


forward

protected bool forward

Is the finger table forward looking?


logName

protected string logName

Name to use for class in logging


node

protected Naanou.LookupService.Node node

Local node


nodeId

protected Naanou.Common.Hash nodeId

Local node id


nodes

protected System.Collections.Hashtable nodes

Nodes. Nodes are stored in hashtable by ids that match ones found in Naanou.LookupService.FingerTable.entries.


requestedFingersFrom

protected Naanou.Common.BasicAddress requestedFingersFrom

Where fingers were requested from


TABLE_SIZE

public int TABLE_SIZE

Constructor Detail

FingerTable

internal FingerTable(Naanou.LookupService.Node node)

Constructor

Parameters:
node - Node
Property Detail

Addresses

public Naanou.LookupService.NodeAddress[] Addresses

Gets all addresses contained by table


Count

public int Count

Gets the number of nodes fingered


FingerRequestExpired

private bool FingerRequestExpired


IsForward

public bool IsForward

Is the table forward looking?


Node

public Naanou.LookupService.Node Node

Gets the node associated with this table


Stats

public string Stats

Gets short stats about table (util, count, entries size)


Util

public double Util

Gets utilisation of finger table

Method Detail

AddressNotify

public void AddressNotify(Naanou.LookupService.NodeAddress address)

Called when Node knows about a new address. Try to put it into finger table somewhere

Parameters:
address - New node

BuildTable

protected void BuildTable()

Builds the finger table


ChangeKey

protected void ChangeKey(Naanou.Common.Hash fingerLocation,
                         Naanou.LookupService.NodeAddress newAddress,
                         Naanou.LookupService.NodeAddress oldAddress)

Changes a hash key

Parameters:
fingerLocation - Key
newAddress - New address
oldAddress - Old address (optional)

Clear

public void Clear()

Clear finger entries, but maintains finger locations


Dump

public string Dump()

Dumps out the fingers and their values

Returns:
String dump of finger

FindClosest

public Naanou.LookupService.NodeAddress FindClosest(Naanou.Common.Hash id)

Finds the closest node to id (Above internal node's id and below id). Only returns alive addresses.

Parameters:
id - Id
Returns:
Closest node or null if there is none

GetClosestEntriesIndex

protected int GetClosestEntriesIndex(Naanou.Common.Hash id)

Gets the closest index on the entries array to id=. Will fuzzy match the closest LOWER index if no exact can be found

Parameters:
id - Id
Returns:
Closest index or -1

GetKey

private Naanou.LookupService.NodeAddress GetKey(Naanou.Common.Hash key)

Gets a node at a particular key

Parameters:
key - Key
Returns:
Node at that key

GetReplacement

public Naanou.LookupService.NodeAddress GetReplacement(Naanou.Common.Hash id)

Gets the node nearest to id, but not the node with that id

Parameters:
id - Id
Returns:
Closest node, or null

NeedsFilling

internal bool NeedsFilling()

Gets whether table needs filling

Returns:

NotifyFingers

public void NotifyFingers(Naanou.Common.BasicAddress[] addresses,
                          Naanou.Common.BasicAddress source)

Notification passed in via Naanou.LookupService.FingerTable.Node from a remote object setting finger values

Parameters:
addresses - Values
source - Source of request

OnNodeAddedToCache

private void OnNodeAddedToCache(object sender,
                                Naanou.LookupService.NodeEventArgs e)

Triggered when the cache knows about a new node

Parameters:
sender -
e -

OnNodeRemovedFromCache

private void OnNodeRemovedFromCache(object sender,
                                    Naanou.LookupService.NodeEventArgs e)

Called when a node has been forcibly removed from cache - ie: died/shutdown. Need to update fingers

Parameters:
sender -
e -

RemoveNode

protected void RemoveNode(Naanou.LookupService.NodeAddress address)

Remove an address from finger table, and rearrange existing

Parameters:
address - Remotes a node

Reset

public void Reset(Naanou.LookupService.Node node)

Resets finger table, triggering a rebuild of fingers

Parameters:
node - Node

ToString

public string ToString()

Returns a string representation of the object

Returns:

UpdateFingers

internal void UpdateFingers(Naanou.LookupService.NodeAddress existingNode)

Updates fingers by interrogating an existing node

Parameters:
existingNode -
Event Detail

FingerFillFailed

public System.EventHandler FingerFillFailed

Finger fill has failed


FingerKeyChange

public Naanou.LookupService.FingerKeyChangeHandler FingerKeyChange

Triggered when a finger has changed