|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |
Manages a Naanou.LookupService.Nodes successor list. Duplicate addresses can be in list
Field Summary | |
---|---|
Naanou.LookupService.RequestForwarder | forwarder |
long |
MAX_SIZE
Size of list (2log2N of Config.MaximumNetworkSize) |
Naanou.LookupService.Node | node |
System.Threading.ReaderWriterLock | rwl |
System.Collections.ArrayList | s |
Naanou.LookupService.NodeAddress | successorListFrom |
Constructor Summary | |
---|---|
SuccessorList(Naanou.LookupService.Node node, Naanou.LookupService.FingerTable table) Constructor |
Property Summary | |
---|---|
int | Count |
bool |
HasSuccessor
Gets whether there is a successor (does not check if address is alive) |
Naanou.LookupService.NodeAddress |
Item[int index] Gets or sets the at a certain index. Index 0 is the first successor. Does not do Reconcile! |
Naanou.LookupService.NodeAddress |
Successor
Gets the current, 'in-use' successor (which may or may not be alive) or null |
Naanou.LookupService.RemoteNode |
SuccessorNode
Gets the successor's RemoteNode form |
Method Summary | |
---|---|
void |
Clear(Naanou.LookupService.FingerTable table) Clears list |
string |
Dump() Dumps the contents of the list to a string |
Naanou.LookupService.NodeAddress[] |
GetAddresses() Gets in array form all the addresses |
Naanou.LookupService.NodeAddress |
GetAt(int index) Gets an address at a specified index, or an Empty address if not found |
Naanou.Common.BasicAddress[] |
GetBasicAddresses() Get addresses in Naanou.Common.BasicAddress form |
Naanou.LookupService.NodeAddress |
GetImmediatePredecessor(Naanou.Common.Hash id) Attempts to find the closest successor to id. Guaranteed alive |
object |
GetProperty(System.Reflection.PropertyInfo pi, object[] index) Gets the given property on the current successor. |
object |
GetProperty(string property, object[] index) Gets the given property on the current successor. |
object |
Invoke(System.Reflection.MethodInfo mi, object[] parameters) Invokes the given method on the current successor. A safe way of calling the successor |
object |
Invoke(string method, object[] parameters) Invokes a method and returns the result. |
void |
Reconcile() Reconciles list with our successor s by copying it's successor list, adding s to the front, and deleting the last element. When our successor has failed, we use the next alive entry in our list and do a reconcile. |
void |
Reconcile(bool forceRefresh) Reconciles list with our successor s by copying it's successor list, adding s to the front, and deleting the last element. |
void |
RemoveAddress(Naanou.LookupService.NodeAddress address) Removes an address from the list |
void |
RemoveCurrentSuccessor() Removes the current successor and reconciles list. Guarantees new successor is alive |
void |
SuccessorChanged(Naanou.LookupService.NodeAddress old) Notification the successor has changed |
string |
ToString() Returns a basic string representation of the instance |
void |
UpdateAndNotify(int index) Called as part of the stabilisation process |
int |
VerifyList() Check each successor and ensure liveness, culling dead addresses |
Methods inherited from class System.Object |
---|
Equals, Finalize, GetHashCode, GetType, MemberwiseClone |
Event Summary | |
---|---|
Naanou.LookupService.SuccessorChangeHandler |
SuccessorChange
Active successor has changed |
Field Detail |
---|
private Naanou.LookupService.RequestForwarder forwarder
public long MAX_SIZE
Size of list (2log2N of Config.MaximumNetworkSize)
private Naanou.LookupService.Node node
private System.Threading.ReaderWriterLock rwl
private System.Collections.ArrayList s
private Naanou.LookupService.NodeAddress successorListFrom
Constructor Detail |
---|
public SuccessorList(Naanou.LookupService.Node node, Naanou.LookupService.FingerTable table)
Constructor
Parameters:
node
- Node to link totable
- Table of alternativesProperty Detail |
---|
public int Count
public bool HasSuccessor
Gets whether there is a successor (does not check if address is alive)
public Naanou.LookupService.NodeAddress this[int index]
Gets or sets the at a certain index. Index 0 is the first successor. Does not do Reconcile!
Throws:
System.ArgumentOutOfRangeException
- When setting a successor that is not greater than nodepublic Naanou.LookupService.NodeAddress Successor
Gets the current, 'in-use' successor (which may or may not be alive) or null
public Naanou.LookupService.RemoteNode SuccessorNode
Gets the successor's RemoteNode form
Method Detail |
---|
public void Clear(Naanou.LookupService.FingerTable table)
Clears list
Parameters:
table
- Tablepublic string Dump()
Dumps the contents of the list to a string
Returns:
public Naanou.LookupService.NodeAddress[] GetAddresses()
Gets in array form all the addresses
Returns:
public Naanou.LookupService.NodeAddress GetAt(int index)
Gets an address at a specified index, or an Empty address if not found
Parameters:
index
- public Naanou.Common.BasicAddress[] GetBasicAddresses()
Get addresses in Naanou.Common.BasicAddress form
Returns:
public Naanou.LookupService.NodeAddress GetImmediatePredecessor(Naanou.Common.Hash id)
Attempts to find the closest successor to id. Guaranteed alive
Parameters:
id
- Idpublic object GetProperty(System.Reflection.PropertyInfo pi, object[] index)
Gets the given property on the current successor.
This method correctly handles remote exceptions, as well as dead successors.
Parameters:pi
- Propertyindex
- Parameters for property, or null for noneNaanou.LookupService.NoMoreSuccessorsException
- Thrown when the invoke fails as we have no successorspublic object GetProperty(string property, object[] index)
Gets the given property on the current successor.
This method correctly handles remote exceptions, as well as dead successors.
Parameters:property
- Property nameindex
- IndexNaanou.LookupService.NoMoreSuccessorsException
- Thrown when the invoke fails as we have no successorspublic object Invoke(System.Reflection.MethodInfo mi, object[] parameters)
Invokes the given method on the current successor. A safe way of calling the successor
This method correctly handles remote exceptions, as well as dead successors.
Parameters:mi
- MethodInfoparameters
- Parameters to pass, or null for noneNaanou.LookupService.NoMoreSuccessorsException
- Thrown when the invoke fails as we have no successorspublic object Invoke(string method, object[] parameters)
Invokes a method and returns the result.
Parameters:
method
- Method nameparameters
- Parameters to pass, or null for noneNaanou.LookupService.NoMoreSuccessorsException
- Thrown when the invoke fails as we have no successorspublic void Reconcile()
Reconciles list with our successor s by copying it's successor list, adding s to the front, and deleting the last element. When our successor has failed, we use the next alive entry in our list and do a reconcile.
public void Reconcile(bool forceRefresh)
Reconciles list with our successor s by copying it's successor list, adding s to the front, and deleting the last element.
Parameters:
forceRefresh
- Force a reconcile, even if we last reconciled from same sourceprivate void RemoveAddress(Naanou.LookupService.NodeAddress address)
Removes an address from the list
Parameters:
address
- Address to removeprivate void RemoveCurrentSuccessor()
Removes the current successor and reconciles list. Guarantees new successor is alive
Throws:
System.NullReferenceException
- Thrown when there are no more successorsprivate void SuccessorChanged(Naanou.LookupService.NodeAddress old)
Notification the successor has changed
Parameters:
old
- Previous successorpublic string ToString()
Returns a basic string representation of the instance
Returns:
public void UpdateAndNotify(int index)
Called as part of the stabilisation process
Parameters:
index
- Indexprivate int VerifyList()
Check each successor and ensure liveness, culling dead addresses
Returns:
Event Detail |
---|
public Naanou.LookupService.SuccessorChangeHandler SuccessorChange
Active successor has changed
|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |