Home Reference Source
public class | source

Cyclon

Extends:

n2n-overlay-wrtc~N2N → Cyclon

Implementation of CYCLON: Inexpensive Membership Management for Unstructured P2P Overlays Spyros Voulgaris,1,2 Daniela Gavidia,1 and Maarten van Steen1 @article{voulgaris2005cyclon, title={Cyclon: Inexpensive membership management for unstructured p2p overlays}, author={Voulgaris, Spyros and Gavidia, Daniela and Van Steen, Maarten}, journal={Journal of Network and Systems Management}, volume={13}, number={2}, pages={197--217}, year={2005}, publisher={Springer} }

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public get
Private Members
private
private

Method Summary

Public Methods
public

exchange(): *

public

Get k neighbors from the partial view.

public

join(sender: callback): Promise

Joining a network.

Private Methods
private

_close(peerId: string)

private

_exchange(): *

private

_getSample(size: *): *

private

_onArcDown(peerId: string | null)

private

_onBridge(from: *, to: *)

private

_onExchange(id: *, message: *)

private

_onJoin(id: *)

private

_onLeave(id: *)

private

_open(peerId: *)

private

_receive(peerId: string, message: object | MExchange | MJoin)

private

_start()

private

_stop()

Public Constructors

public constructor() source

Public Members

public get partialView: * source

Private Members

private _partialView: * source

private _periodic: * source

Public Methods

public exchange(): * source

Return:

*

public getPeers(k: number): string[] source

Get k neighbors from the partial view. If k is not reached, it tries to fill the gap with neighbors from the inview. It is worth noting that each peer controls its outview but not its inview. The more the neigbhors from the outview the better.

Params:

NameTypeAttributeDescription
k number

The number of neighbors requested. If k is not defined, it returns every known identifiers of the partial view.

Return:

string[]

Array of identifiers.

public join(sender: callback): Promise source

Joining a network.

Params:

NameTypeAttributeDescription
sender callback

Function that will be called each time an offer arrives to this peer. It is the responsability of the caller to send these offer (using sender) to the contact inside the network.

Return:

Promise

A promise that is resolved when the peer joins the network -- the resolve contains the peerId; rejected after a timeout, or already connected state.

Private Methods

private _close(peerId: string) source

Params:

NameTypeAttributeDescription
peerId string

The identifier of the removed arc.

private _exchange(): * source

Return:

*

private _getSample(size: *): * source

Params:

NameTypeAttributeDescription
size *

Return:

*

private _onArcDown(peerId: string | null) source

Params:

NameTypeAttributeDescription
peerId string | null

The identifier of the peer we failed to establish a connection with. Null if it was yet to be known.

private _onBridge(from: *, to: *) source

Params:

NameTypeAttributeDescription
from *
to *

private _onExchange(id: *, message: *) source

Params:

NameTypeAttributeDescription
id *
message *

private _onJoin(id: *) source

Params:

NameTypeAttributeDescription
id *

private _onLeave(id: *) source

Params:

NameTypeAttributeDescription
id *

private _open(peerId: *) source

Params:

NameTypeAttributeDescription
peerId *

private _receive(peerId: string, message: object | MExchange | MJoin) source

Params:

NameTypeAttributeDescription
peerId string

The identifier of the peer that sent the message.

message object | MExchange | MJoin

The message received.

private _start() source

private _stop() source