TManOverlay
Extends:
A TManOverlay is an abstract network used to build overlay based on the TMan network over WebRTC.
Constructor Summary
Public Constructor | ||
public |
constructor(options: Object): NetworkManager Constructor |
Member Summary
Public Members | ||
public get |
descriptor: Object: * Get our current descriptor |
|
public set |
descriptor(newDescriptor: Object): void Update the peer descriptor |
|
public get |
The in-view ID of the peer in the network |
|
public |
options: * |
|
public get |
The out-view ID of the peer in the network |
Private Members | ||
private |
_manager: * |
Method Summary
Public Methods | ||
public |
getNeighbours(limit: integer): string[] Get the IDs of all available neighbours |
Private Methods | ||
private |
Build a TMan network |
|
private |
Give the delay in milliseconds after which the descriptor must be recomputed. |
|
private |
_rankPeers(neighbour: *, descriptorA: Object, descriptorB: Object, peerA: TManOverlay, peerB: TManOverlay): integer Compare two peers and rank them according to a ranking function. |
|
private |
_rankingFunction(): * Utility to rank two peers |
|
private |
Gives the start descriptor used by the TMan overlay (can be an empty object). |
Public Constructors
public constructor(options: Object): NetworkManager source
Constructor
Params:
Name | Type | Attribute | Description |
options | Object | Additional options used to build the network |
Public Members
public options: * source
Private Members
private _manager: * source
Public Methods
public getNeighbours(limit: integer): string[] source
Get the IDs of all available neighbours
Params:
Name | Type | Attribute | Description |
limit | integer | Max number of neighbours to look for |
Private Methods
private _buildRPS(options: Object): TMan source
Build a TMan network
Params:
Name | Type | Attribute | Description |
options | Object | Options used to build the TMan |
Return:
TMan | The TMan network |
private _descriptorTimeout(): number source
Give the delay in milliseconds after which the descriptor must be recomputed. Subclasses of TManOverlay must implement this method.
private _rankPeers(neighbour: *, descriptorA: Object, descriptorB: Object, peerA: TManOverlay, peerB: TManOverlay): integer source
Compare two peers and rank them according to a ranking function.
This function must return 0 if peerA == peerB
, 1 if peerA < peerB
and -1 if peerA > peerB
.
Subclasses of TManOverlay must implement this method.
Params:
Name | Type | Attribute | Description |
neighbour | * | The neighbour to rank with |
|
descriptorA | Object | Descriptor of the first peer |
|
descriptorB | Object | Descriptor of the second peer |
|
peerA | TManOverlay | (optional) The overlay of the first peer |
|
peerB | TManOverlay | (optional) The overlay of the second peer |
Return:
integer |
|
private _startDescriptor(): Object source
Gives the start descriptor used by the TMan overlay (can be an empty object). Subclasses of TManOverlay must implement this method.