C# Class Brunet.Services.Dht.RpcDhtProxy

Provides RpcProxyHandler service, which reinserts dht entry before its ttl expires
Inheritance: IRpcHandler
Show file Open project: pstjuste/brunet Class Usage Examples

Public Properties

Property Type Description
RETRY_TIMEOUT int

Protected Properties

Property Type Description
_dht IDht
_entries Dictionary>
_rpc RpcManager
_sync object

Public Methods

Method Description
EntryCallback ( object o ) : void

If half of ttl time passed, this event handler is called. AlarmEventHandler calls "DhtClient.Put" command to insert the entry to other nodes. It restarts the timer. If error occurs during ASyncPut, it retries after 30 seconds

HandleRpc ( ISender caller, string method, IList arguments, object request_state ) : void
ListEntries ( ) : object

Returns all stored values in a list.

Register ( MemBlock key, MemBlock value, int ttl ) : bool

This is a RpcDhtProxy rpc call entry, which can be called using "RpcDhtProxy.Register" Register the entry to Entry. If the key,value pair does not exist in _entries, it creates the pair in the list. Otherwise, it updates the ttl. After inserting the entry, this module try to register the key, value pair to neighbor node.

RpcDhtProxy ( IDht dht, Node node ) : System

Initiates a RpcProxyHandler instance. It uses reflection for rpc call. Thus, it does not have to inherit IRpcHanler.This instance keeps Entry to keep track of key, value, and ttl

Unregister ( MemBlock key, MemBlock value ) : bool

Unregister the proxy entry. Removes the entry from Dictionary and set the stop the timer to disable future reference

Method Details

EntryCallback() public method

If half of ttl time passed, this event handler is called. AlarmEventHandler calls "DhtClient.Put" command to insert the entry to other nodes. It restarts the timer. If error occurs during ASyncPut, it retries after 30 seconds
public EntryCallback ( object o ) : void
o object Entry which initiates ttl time expire event
return void

HandleRpc() public method

public HandleRpc ( ISender caller, string method, IList arguments, object request_state ) : void
caller ISender
method string
arguments IList
request_state object
return void

ListEntries() public method

Returns all stored values in a list.
public ListEntries ( ) : object
return object

Register() public method

This is a RpcDhtProxy rpc call entry, which can be called using "RpcDhtProxy.Register" Register the entry to Entry. If the key,value pair does not exist in _entries, it creates the pair in the list. Otherwise, it updates the ttl. After inserting the entry, this module try to register the key, value pair to neighbor node.
public Register ( MemBlock key, MemBlock value, int ttl ) : bool
key MemBlock dht entry key to insert
value MemBlock dht entry value to insert
ttl int dht entry ttl to insert
return bool

RpcDhtProxy() public method

Initiates a RpcProxyHandler instance. It uses reflection for rpc call. Thus, it does not have to inherit IRpcHanler.This instance keeps Entry to keep track of key, value, and ttl
public RpcDhtProxy ( IDht dht, Node node ) : System
dht IDht IDht instance
node Brunet.Node node which is currently connected.
return System

Unregister() public method

Unregister the proxy entry. Removes the entry from Dictionary and set the stop the timer to disable future reference
public Unregister ( MemBlock key, MemBlock value ) : bool
key MemBlock
value MemBlock
return bool

Property Details

RETRY_TIMEOUT public static property

public static int RETRY_TIMEOUT
return int

_dht protected property

protected IDht _dht
return IDht

_entries protected property

protected Dictionary> _entries
return Dictionary>

_rpc protected property

protected RpcManager _rpc
return RpcManager

_sync protected property

protected object _sync
return object