C# Class Brunet.Services.Dht.TableServerData

Show file Open project: pstjuste/brunet Class Usage Examples

Public Properties

Property Type Description
TimeBetweenCleanup int

Protected Properties

Property Type Description
_base_dir string
count int

Public Methods

Method 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

Method Description
Test0 ( ) : void
Test1 ( ) : void
Test2 ( ) : void

Method Details

AddEntry() public method

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.
return void

CacheEviction() public method

public CacheEviction ( Object o, EventArgs args ) : void
o Object
args System.EventArgs
return void

CacheMiss() public method

public CacheMiss ( Object o, EventArgs args ) : void
o Object
args System.EventArgs
return void

CheckEntries() public method

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
return void

CleanUp() public method

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.
return void

DeleteExpired() public method

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.
return int

Dump() public method

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

GeneratePath() public method

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

GeneratePath() public method

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.
return string

GetEntries() public method

Retrieves the entries for the specified key.
public GetEntries ( MemBlock key ) : LinkedList
key MemBlock
return LinkedList

GetKeys() public method

Returns the list of keys.
public GetKeys ( ) : LinkedList
return LinkedList

GetKeysBetween() public method

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.
return LinkedList

RemoveEntry() public method

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.
return void

TableServerData() public method

public TableServerData ( ) : System
return System

TableServerData() public method

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.
return System

TableServerData() public method

public TableServerData ( String dir ) : System
dir String
return System

UpdateEntry() public method

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.
return void

Property Details

TimeBetweenCleanup public property

The time in seconds between cleanups.
public int TimeBetweenCleanup
return int

_base_dir protected property

The base directory for uncached entries.
protected string _base_dir
return string

count protected property

The total amount of key:value pairs stored.
protected int count
return int