Classes
Methods
(inner) knuthShuffle(array) → {array}
Shuffles an array in place.
Name | Type | Description |
---|---|---|
array | array | Array to shuffle |
- Type:
- array
(inner) preventConvoy(func, maxtimeopt) → {function}
Wraps the supplied function in a pseudo-random length timeout to help prevent convoy effects. These occur when a number of processes need to use a resource in turn. There is a tendency for such bursts of activity to drift towards synchronization, which can be disasterous. In Kademlia all nodes are requird to republish their contents every hour (T_REPLICATE). A convoy effect might lead to this being synchronized across the network, which would appear to users as the network dying every hour. The default timeout will be between 0 and 30 minutes unless specified.
Name | Type | Attributes | Description |
---|---|---|---|
func | function | Function to wrap to execution later | |
maxtime | number | <optional> | Maximum timeout |
- Type:
- function
Type Definitions
ExpirationStream
Reads objects from a module:kdns/node~ReadableStore and if an item should be expired, requests deletion.
- WritableStream.<module:kdns/node~StoredItem>
Name | Type | Description |
---|---|---|
objectMode | boolean | true |
NodeOptions
Overridable options passed to Node.
- Object
Name | Type | Description |
---|---|---|
router | module:kdns/router~Router | |
protocol | module:kdns/protocol~Protocol |
ReadableStore
Stream consumed by module:kdns/node~ReplicatorStream and module:kdns/node~ReplicatorStream.
- ReadableStream.<module:kdns/node~StoredItem>
Name | Type | Description |
---|---|---|
objectMode | boolean | true |
ReplicatorStream
Reads objects from a module:kdns/node~ReadableStore and if an item should be replicated, performs an iterative store operation.
- WritableStream.<module:kdns/node~StoredItem>
Name | Type | Description |
---|---|---|
objectMode | boolean |
StoredItem
Format of a storage entry.
- Object
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
blob | buffer | Raw bytes for the stored item | |||||||||
meta | object | Metadata needed for replication and expiration Properties
|