C# Класс Brunet.Services.Dht.TableServerData

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
TimeBetweenCleanup int

Защищенные свойства (Protected)

Свойство Тип Описание
_base_dir string
count int

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
Test0 ( ) : void
Test1 ( ) : void
Test2 ( ) : void

Описание методов

AddEntry() публичный Метод

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.
Результат void

CacheEviction() публичный Метод

public CacheEviction ( Object o, EventArgs args ) : void
o Object
args System.EventArgs
Результат void

CacheMiss() публичный Метод

public CacheMiss ( Object o, EventArgs args ) : void
o Object
args System.EventArgs
Результат void

CheckEntries() публичный Метод

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
Результат void

CleanUp() публичный Метод

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.
Результат void

DeleteExpired() публичный Метод

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.
Результат int

Dump() публичный Метод

Converts all the entries into Adr compatible types so that they can be sent over BrunetRpc and XmlRpc
public Dump ( ) : ArrayList
Результат System.Collections.ArrayList

GeneratePath() публичный Метод

Generates a path given a key.
public GeneratePath ( MemBlock key ) : string
key MemBlock The key to generate a path for.
Результат string

GeneratePath() публичный Метод

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.
Результат string

GetEntries() публичный Метод

Retrieves the entries for the specified key.
public GetEntries ( MemBlock key ) : LinkedList
key MemBlock
Результат LinkedList

GetKeys() публичный Метод

Returns the list of keys.
public GetKeys ( ) : LinkedList
Результат LinkedList

GetKeysBetween() публичный Метод

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.
Результат LinkedList

RemoveEntry() публичный Метод

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.
Результат void

TableServerData() публичный Метод

public TableServerData ( ) : System
Результат System

TableServerData() публичный Метод

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.
Результат System

TableServerData() публичный Метод

public TableServerData ( String dir ) : System
dir String
Результат System

UpdateEntry() публичный Метод

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.
Результат void

Описание свойств

TimeBetweenCleanup публичное свойство

The time in seconds between cleanups.
public int TimeBetweenCleanup
Результат int

_base_dir защищенное свойство

The base directory for uncached entries.
protected string _base_dir
Результат string

count защищенное свойство

The total amount of key:value pairs stored.
protected int count
Результат int