new PeerDictionary()
A dictionary used to manage information discovered about peers. It's only difference from a typical dictionary is that we have to manage how many entries are in the dictionary so that we don't overflow memory. Therefore once we reach a certain number of entries any new entries will require old entries to be removed.
Methods
addUpdateEntry(peerId, peerTableEntry) → (nullable) {error}
Adds the entry if the peerId isn't yet in the table otherwise updates the existing entry. If the new entry will increase the size of the dictionary beyond the fixed maximum then the oldest resolved entry MUST be removed. If there are no remaining resolved entries to remove then the oldest waiting entry MUST be removed (and the associated timer killed). If there are no remaining resolved entries to remove then kill MUST be called on the oldest CONTROLLED_BY_POOL entry and it MUST be removed.
Parameters:
| Name | Type | Description |
|---|---|---|
peerId |
string | |
peerTableEntry |
module:thaliPeerDictionary~NotificationPeerDictionaryEntry |
Returns:
Null if all went well otherwise an error.
- Type
- error
removeEntry(peerId)
Removes the identified entry. It is not an error to specify a peerId that is not in the dictionary.
Parameters:
| Name | Type | Description |
|---|---|---|
peerId |
string |