Home Reference Source
public class | source

TManOverlay

Extends:

* → TManOverlay

A TManOverlay is an abstract network used to build overlay based on the TMan network over WebRTC.

See:

Constructor Summary

Public Constructor
public

Constructor

Member Summary

Public Members
public get

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

Method Summary

Public Methods
public

getNeighbours(limit: integer): string[]

Get the IDs of all available neighbours

Private Methods
private

_buildRPS(options: Object): TMan

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

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:

NameTypeAttributeDescription
options Object

Additional options used to build the network

Return:

NetworkManager

networkManager - Network manager used as root for the overlay

Public Members

public get descriptor: Object: * source

Get our current descriptor

Return:

Object

The peer current descriptor

public set descriptor(newDescriptor: Object): void source

Update the peer descriptor

Return:

void

public get inviewId: string: * source

The in-view ID of the peer in the network

Return:

string

The in-view ID of the peer

public options: * source

public get outviewId: string: * source

The out-view ID of the peer in the network

Return:

string

The out-view ID of the peer

Private Members

private _manager: * source

Public Methods

public getNeighbours(limit: integer): string[] source

Get the IDs of all available neighbours

Params:

NameTypeAttributeDescription
limit integer

Max number of neighbours to look for

Return:

string[]

Set of IDs for all available neighbours

Private Methods

private _buildRPS(options: Object): TMan source

Build a TMan network

Params:

NameTypeAttributeDescription
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.

Return:

number

The delay in milliseconds after which the descriptor must be recomputed

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:

NameTypeAttributeDescription
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

0 if peerA == peerB, 1 if peerA < peerB and -1 if peerA > peerB (according to the ranking algorithm)

private _rankingFunction(): * source

Utility to rank two peers

Return:

*

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.

Return:

Object

The start descriptor used by the TMan overlay