Property | Type | Description | |
---|---|---|---|
DEGREE | int | ||
DELAY | int | ||
DhtLog | |||
MAJORITY | int | ||
Node |
Property | Type | Description | |
---|---|---|---|
_adgs_table | |||
_adps_table | |||
_online | bool | ||
_rpc | RpcManager | ||
_sync | object |
Method | Description | |
---|---|---|
AsyncCreate ( MemBlock key, MemBlock value, int ttl, Channel returns ) : void | ||
AsyncGet ( MemBlock key, Channel returns ) : void | This starts the get process by sending dht.Get to all the remote end points that contain the key we're looking up. The next step is is when the results are placed in the channel and GetEnqueueHandler is called or GetCloseHandler is called. This means the get needs to be stateful, that information is stored in the _adgs_table. | |
AsyncPut ( MemBlock key, MemBlock value, int ttl, Channel returns ) : void | ||
AsyncPut ( MemBlock key, MemBlock value, int ttl, Channel returns, bool unique ) : void |
This is the generic Put that is used by both the regular Put and Create methods. The use of the unique variable differentiates the two. This is asynchronous. Results are stored in the Channel returns. Creates and Puts return true if successful or exception if there are network errors in adding the entry, creates also fail if a previous entry exists. The work of determining success is handled in PutEnqueueHandler and PutCloseHandler.
|
|
Create ( MemBlock key, MemBlock value, int ttl ) : bool | ||
Dht ( |
A default Dht client provides a DEGREE of 1 and a sychronous wait time of up to 60 seconds.
|
|
Dht ( |
Allows the user to specify the power of two of degrees to use. That is if degree=n, DEGREE for the dht is 2^n.
|
|
Dht ( |
Allows the user to specify the power of two of degrees to use. That is if degree=n, DEGREE for the dht is 2^n.
|
|
Get ( MemBlock key ) : System.Collections.Hashtable[] | ||
GetEnqueueHandler ( Object o, |
This is called as a result of a successful retrieval of data from a remote end point and performs follow up gets for remaining values This adds the results to the entry in the _adgs_table. Once a value has been received by a majority of nodes, it is enqueued into the requestors returns channel. If not all results were retrieved follow up gets are performed, this is determined by looking at the state of the token, a non-null token implies there are remaining results. |
|
MapToRing ( byte key ) : MemBlock[] |
Get the hash of the first key and add 1/DEGREE * Address space to each successive key. The results are the positions in the ring where the data should be stored.
|
|
Put ( MemBlock key, MemBlock value, int ttl ) : bool | ||
Put ( MemBlock key, MemBlock value, int ttl, bool unique ) : bool |
This is the sychronous version of the generic Put used by both the Put and Create methods. The use of the unique variable differentiates the two. Returns true if successful or an exception if there are network errors in adding the entry, creates also fail if a previous entry exists.
|
|
PutCloseHandler ( Object o, |
Method | Description | |
---|---|---|
GetCloseHandler ( object o, |
This is called by the Get callbacks when all the results for a get have come in. This looks at the results, finds holes, and does a follow up put to place the data back into the dht via GetFollowUp.
|
|
GetFollowUp ( AsDhtGetState adgs ) : void |
Restores any of the Dht results that don't return all their values. We only get here at the end of a Dht return operation. This analyzes the holes and fills them in individually. This only fills holes where there was a positive result (MAJORITY of results received). |
|
GetLeaveEarly ( AsDhtGetState adgs ) : void |
This helps us leave the Get early if we either have no results or our remaining results will not reach a majority due to too many nodes missing data. This closes the clients returns queue.
|
|
StateChangeHandler ( |
We're online once we are seeking connections, we're offline once Disconnect has been called.
|
public AsyncCreate ( MemBlock key, MemBlock value, int ttl, Channel returns ) : void | ||
key | MemBlock | |
value | MemBlock | |
ttl | int | |
returns | Channel | |
return | void |
public AsyncGet ( MemBlock key, Channel returns ) : void | ||
key | MemBlock | |
returns | Channel | |
return | void |
public AsyncPut ( MemBlock key, MemBlock value, int ttl, Channel returns ) : void | ||
key | MemBlock | |
value | MemBlock | |
ttl | int | |
returns | Channel | |
return | void |
public AsyncPut ( MemBlock key, MemBlock value, int ttl, Channel returns, bool unique ) : void | ||
key | MemBlock | The index to store the value at. |
value | MemBlock | The value to store. |
ttl | int | The dht lease time for the key:value pair. |
returns | Channel | The Channel where the result will be placed. |
unique | bool | True to do a create, false otherwise. |
return | void |
public Create ( MemBlock key, MemBlock value, int ttl ) : bool | ||
key | MemBlock | |
value | MemBlock | |
ttl | int | |
return | bool |
public Dht ( |
||
node | The node to provide service for. | |
return | System |
public Dht ( |
||
node | The node to provide service for. | |
degree | int | n where DEGREE=2^n amount of replications to perform. /// |
return | System |
public Dht ( |
||
node | The node to provide service for. | |
degree | int | n where DEGREE=2^n amount of replications to /// perform. |
delay | int | User specified delay for synchronous calls in /// seconds. |
return | System |
public Get ( MemBlock key ) : System.Collections.Hashtable[] | ||
key | MemBlock | |
return | System.Collections.Hashtable[] |
protected GetCloseHandler ( object o, |
||
o | object | The channel representing a specific get. |
args | Unused. | |
return | void |
public GetEnqueueHandler ( Object o, |
||
o | Object | The channel used to store the results. |
args | Unused. | |
return | void |
protected GetFollowUp ( AsDhtGetState adgs ) : void | ||
adgs | AsDhtGetState | The AsDhtGetState to analyze for follow up. |
return | void |
protected GetLeaveEarly ( AsDhtGetState adgs ) : void | ||
adgs | AsDhtGetState | The AsDhtGetState to qualify for leaving early |
return | void |
public MapToRing ( byte key ) : MemBlock[] | ||
key | byte | The key to index. |
return | MemBlock[] |
public Put ( MemBlock key, MemBlock value, int ttl ) : bool | ||
key | MemBlock | |
value | MemBlock | |
ttl | int | |
return | bool |
public Put ( MemBlock key, MemBlock value, int ttl, bool unique ) : bool | ||
key | MemBlock | The index to store the value at. |
value | MemBlock | The value to store. |
ttl | int | The dht lease time for the key:value pair. |
unique | bool | True to do a create, false otherwise. |
return | bool |
public PutCloseHandler ( Object o, |
||
o | Object | The channel used by put. |
args | Unused. | |
return | void |
protected StateChangeHandler ( |
||
n | ||
state | ||
return | void |
public static BooleanSwitch,System.Diagnostics DhtLog | ||
return |
protected Hashtable,System.Collections _adgs_table | ||
return |
protected Hashtable,System.Collections _adps_table | ||
return |