C# Class Brunet.Services.Dht.TableServerData

Afficher le fichier Open project: pstjuste/brunet Class Usage Examples

Méthodes publiques

Свойство Type Description
TimeBetweenCleanup int

Protected Properties

Свойство Type Description
_base_dir string
count int

Méthodes publiques

Méthode Description
AddEntry ( Entry entry ) : void

This adds an entry and should only be called if no such entry exists, as it does not look to see if a duplicate entry already exists. This creates a new LinkedList if this is the first entry for the specific key and stores it in the _data hashtable. This increments count.

Because data is stored by non-decreasing end time, we must place this at the correct position, which by starting at the last entry is right after the first entry that has a shorter end time.

CacheEviction ( Object o, EventArgs args ) : void
CacheMiss ( Object o, EventArgs args ) : void
CheckEntries ( ) : void

Deletes any of the expired entries by traversing the entire data store. This is done only once every 24 hours to reduce heavy memory access due to short lived unused entries.

CleanUp ( Object o, EventArgs args ) : void

Called to clean up the disk data left behind by the dht

DeleteExpired ( MemBlock key ) : int

Deletes all expired entries for the specified key. For each entry deleted, count is decremented. This should be called before accessing the data stored in this table.

Dump ( ) : ArrayList

Converts all the entries into Adr compatible types so that they can be sent over BrunetRpc and XmlRpc

GeneratePath ( MemBlock key ) : string

Generates a path given a key.

GeneratePath ( MemBlock key, string &path, string &filename ) : string

Generates a path given a key.

GetEntries ( MemBlock key ) : LinkedList

Retrieves the entries for the specified key.

GetKeys ( ) : LinkedList

Returns the list of keys.

GetKeysBetween ( AHAddress add1, AHAddress add2 ) : LinkedList

Returns a list of keys stored at this node that exist between the two addresses. Such keys returned are the storest path between the two addresses.

RemoveEntry ( MemBlock key, MemBlock value ) : void

This removes an entry from the TableServerData, the current dht does not support deletes, but if the second stage of a put (the remote PutHandler) fails, the entry needs to be deleted from this node.

TableServerData ( ) : System
TableServerData ( Node node ) : System

Creates a new data store for the dht.

TableServerData ( String dir ) : System
UpdateEntry ( MemBlock key, MemBlock value, DateTime end_time ) : void

This should be called if an entry already exists as it will find the entry and update its lease time. If an entry does not exist nothing happens.

Private Methods

Méthode Description
Test0 ( ) : void
Test1 ( ) : void
Test2 ( ) : void

Method Details

AddEntry() public méthode

This adds an entry and should only be called if no such entry exists, as it does not look to see if a duplicate entry already exists. This creates a new LinkedList if this is the first entry for the specific key and stores it in the _data hashtable. This increments count.
Because data is stored by non-decreasing end time, we must place this at the correct position, which by starting at the last entry is right after the first entry that has a shorter end time.
public AddEntry ( Entry entry ) : void
entry Entry The data to store.
Résultat void

CacheEviction() public méthode

public CacheEviction ( Object o, EventArgs args ) : void
o Object
args System.EventArgs
Résultat void

CacheMiss() public méthode

public CacheMiss ( Object o, EventArgs args ) : void
o Object
args System.EventArgs
Résultat void

CheckEntries() public méthode

Deletes any of the expired entries by traversing the entire data store. This is done only once every 24 hours to reduce heavy memory access due to short lived unused entries.
public CheckEntries ( ) : void
Résultat void

CleanUp() public méthode

Called to clean up the disk data left behind by the dht
public CleanUp ( Object o, EventArgs args ) : void
o Object Unused.
args System.EventArgs Unused.
Résultat void

DeleteExpired() public méthode

Deletes all expired entries for the specified key. For each entry deleted, count is decremented. This should be called before accessing the data stored in this table.
public DeleteExpired ( MemBlock key ) : int
key Brunet.Util.MemBlock The index to check for expired entries.
Résultat int

Dump() public méthode

Converts all the entries into Adr compatible types so that they can be sent over BrunetRpc and XmlRpc
public Dump ( ) : ArrayList
Résultat System.Collections.ArrayList

GeneratePath() public méthode

Generates a path given a key.
public GeneratePath ( MemBlock key ) : string
key MemBlock The key to generate a path for.
Résultat string

GeneratePath() public méthode

Generates a path given a key.
public GeneratePath ( MemBlock key, string &path, string &filename ) : string
key MemBlock The key to generate a path for.
path string Returns the directory portion of the path.
filename string Returns the filename portion of the path.
Résultat string

GetEntries() public méthode

Retrieves the entries for the specified key.
public GetEntries ( MemBlock key ) : LinkedList
key MemBlock
Résultat LinkedList

GetKeys() public méthode

Returns the list of keys.
public GetKeys ( ) : LinkedList
Résultat LinkedList

GetKeysBetween() public méthode

Returns a list of keys stored at this node that exist between the two addresses. Such keys returned are the storest path between the two addresses.
public GetKeysBetween ( AHAddress add1, AHAddress add2 ) : LinkedList
add1 AHAddress One of the address end points.
add2 AHAddress Another of the address end points.
Résultat LinkedList

RemoveEntry() public méthode

This removes an entry from the TableServerData, the current dht does not support deletes, but if the second stage of a put (the remote PutHandler) fails, the entry needs to be deleted from this node.
public RemoveEntry ( MemBlock key, MemBlock value ) : void
key MemBlock The index the data is stored at.
value MemBlock The data to remove.
Résultat void

TableServerData() public méthode

public TableServerData ( ) : System
Résultat System

TableServerData() public méthode

Creates a new data store for the dht.
public TableServerData ( Node node ) : System
node Node For uncache data, we use the node to alert us to delete the entries as well the address to define a path to store them.
Résultat System

TableServerData() public méthode

public TableServerData ( String dir ) : System
dir String
Résultat System

UpdateEntry() public méthode

This should be called if an entry already exists as it will find the entry and update its lease time. If an entry does not exist nothing happens.
public UpdateEntry ( MemBlock key, MemBlock value, DateTime end_time ) : void
key MemBlock The index to store the value.
value MemBlock The data to store.
end_time DateTime The lease time for the data.
Résultat void

Property Details

TimeBetweenCleanup public_oe property

The time in seconds between cleanups.
public int TimeBetweenCleanup
Résultat int

_base_dir protected_oe property

The base directory for uncached entries.
protected string _base_dir
Résultat string

count protected_oe property

The total amount of key:value pairs stored.
protected int count
Résultat int