|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |
Holds Naanou.Common.KeyContainer. Manages the storing and expiry of keys stored by a node by other network peers.
External entities only have read-only access to storage
Field Summary | |
---|---|
System.Collections.Hashtable |
hash
Hashtable of ArrayList or Naanou.Common.KeyContainer. Keyed by the KeyContainer's key. |
int |
INITIAL_SIZE
Initial number of entries for hashtable |
Naanou.LookupService.Node | node |
int |
peakSize
Keeps track of the largest size seen of the storage |
int |
QUERY_PROGRESS_LENGTH
How many entries to buffer before sending off to client |
Constructor Summary | |
---|---|
KeyStorage(Naanou.LookupService.Node node) Constructor |
Property Summary | |
---|---|
int |
Count
Gets the number of keys stored |
double |
PeakUtilisation
Gets the peak utilisation (%) of key storage |
double |
Utilisation
Gets the utilisation (%) of key storage |
Method Summary | |
---|---|
void |
Add(Naanou.Common.KeyContainer key) Adds a key. |
void | CacheKey(Naanou.Common.KeyContainer key) |
void |
Clear() Clears all keys |
bool | Contains(Naanou.Common.KeyContainer key) |
bool |
Contains(Naanou.Common.KeyContainer key, bool reInsert) Checks whether storage contains a key. |
string |
Dump() Dumps data into a string |
System.Collections.ArrayList |
DumpKeys() Dumps all keys into one giant ArrayList |
Naanou.Common.Search.SearchResult | GetContentHashResult(Naanou.Common.KeyContainer key, Naanou.Common.Search.SearchPart part) |
Naanou.Common.KeyContainer[] |
GetKeys(Naanou.Common.Hash id) Returns a set of keys that have a certain id, without caring about who put them there |
Naanou.Common.KeyContainer[] |
GetKeys(Naanou.Common.Hash id, Naanou.Common.Hash inserter) Returns a set of keys that have a certain id and were inserted by a particular id |
Naanou.Common.Search.SearchResult | GetOtherResult(Naanou.Common.KeyContainer key, Naanou.Common.Search.SearchPart part) |
void |
Maintain(int found, int removed, int cached) Weeds out expired keys as well as performs caching of keys |
void |
NeighbourSync() Attempts to synchronise to neighbours by getting their keys and inserting locally |
void |
Query(Naanou.Common.Search.SearchPart part, Naanou.Common.QueryProgressDelegate callback, string clientIdSerial, string requestSerial) Query (sync). Called by Node |
void |
RemoveKey(Naanou.Common.Hash id, Naanou.Common.Hash inserter, Naanou.LookupService.KeyRemoveReason reason) Removes key. Removals of non-existent keys is silent |
void |
RemoveList(System.Collections.ArrayList list, Naanou.Common.Hash id, bool maintainenceRun, Naanou.LookupService.KeyRemoveReason reason, int removedCount, int found, int cached) Removes a particular key from a list, and also is used by Maintain method to do GCing and caching |
string |
ToString() Returns a string representation of key storage, including usage information |
Methods inherited from class System.Object |
---|
Equals, Finalize, GetHashCode, GetType, MemberwiseClone |
Event Summary | |
---|---|
Naanou.LookupService.KeyAddedEventHandler |
KeyAdded
Key has been added |
Naanou.LookupService.KeyRemovedEventHandler |
KeyRemoved
Key has been removed |
Naanou.LookupService.KeysClearedEventHandler |
KeysCleared
Keys have been cleared |
Field Detail |
---|
private System.Collections.Hashtable hash
Hashtable of ArrayList or Naanou.Common.KeyContainer. Keyed by the KeyContainer's key.
private int INITIAL_SIZE
Initial number of entries for hashtable
private Naanou.LookupService.Node node
private int peakSize
Keeps track of the largest size seen of the storage
public int QUERY_PROGRESS_LENGTH
How many entries to buffer before sending off to client
Constructor Detail |
---|
public KeyStorage(Naanou.LookupService.Node node)
Constructor
Property Detail |
---|
public int Count
Gets the number of keys stored
public double PeakUtilisation
Gets the peak utilisation (%) of key storage
public double Utilisation
Gets the utilisation (%) of key storage
Method Detail |
---|
internal void Add(Naanou.Common.KeyContainer key)
Adds a key.
Fires Naanou.LookupService.KeyStorage.KeyAdded event
Parameters:key
- Key to storeSystem.ArgumentNullException
- If key is emptySystem.ArgumentException
- If key existsprivate void CacheKey(Naanou.Common.KeyContainer key)
internal void Clear()
Clears all keys
public bool Contains(Naanou.Common.KeyContainer key)
public bool Contains(Naanou.Common.KeyContainer key, bool reInsert)
Checks whether storage contains a key.
Parameters:
key
- Key to lookuppublic string Dump()
Dumps data into a string
Returns:
public System.Collections.ArrayList DumpKeys()
Dumps all keys into one giant ArrayList
Returns:
private Naanou.Common.Search.SearchResult GetContentHashResult(Naanou.Common.KeyContainer key, Naanou.Common.Search.SearchPart part)
public Naanou.Common.KeyContainer[] GetKeys(Naanou.Common.Hash id)
Returns a set of keys that have a certain id, without caring about who put them there
Parameters:
id
- Idpublic Naanou.Common.KeyContainer[] GetKeys(Naanou.Common.Hash id, Naanou.Common.Hash inserter)
Returns a set of keys that have a certain id and were inserted by a particular id
Parameters:
id
- Idinserter
- Inserter (can be null)System.ArgumentNullException
- If id is nullprivate Naanou.Common.Search.SearchResult GetOtherResult(Naanou.Common.KeyContainer key, Naanou.Common.Search.SearchPart part)
public void Maintain(int found, int removed, int cached)
Weeds out expired keys as well as performs caching of keys
Parameters:
found
- Number of keys found to be storedremoved
- Number of keys removedcached
- Number of keys cachedpublic void NeighbourSync()
Attempts to synchronise to neighbours by getting their keys and inserting locally
internal void Query(Naanou.Common.Search.SearchPart part, Naanou.Common.QueryProgressDelegate callback, string clientIdSerial, string requestSerial)
Query (sync). Called by Node
Parameters:
part
- What we're aftercallback
- Callback for resultsclientIdSerial
- Client id serialinternal void RemoveKey(Naanou.Common.Hash id, Naanou.Common.Hash inserter, Naanou.LookupService.KeyRemoveReason reason)
Removes key. Removals of non-existent keys is silent
Parameters:
id
- Idinserter
- Inserter who's key we wish to removereason
- Reason for removalprivate void RemoveList(System.Collections.ArrayList list, Naanou.Common.Hash id, bool maintainenceRun, Naanou.LookupService.KeyRemoveReason reason, int removedCount, int found, int cached)
Removes a particular key from a list, and also is used by Maintain method to do GCing and caching
Parameters:
list
- Listid
- Id to remove (or null)reason
- Reason for removalremovedCount
- Number of keys removedfound
- Number of keys foundcached
- Number keys cachedmaintainenceRun
- Set to true if crawling as part of a maintainence runpublic string ToString()
Returns a string representation of key storage, including usage information
Returns:
Event Detail |
---|
public Naanou.LookupService.KeyAddedEventHandler KeyAdded
Key has been added
public Naanou.LookupService.KeyRemovedEventHandler KeyRemoved
Key has been removed
public Naanou.LookupService.KeysClearedEventHandler KeysCleared
Keys have been cleared
|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |