Home Reference Source
import ArcStore from 'neighborhood-wrtc/lib/arcstore.js'
public class | source

ArcStore

Table that contains all living sockets that might be in use. Peers can comprise multiples protocols that may use multiple times an arc.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

store: *

public

tid: *

Method Summary

Public Methods
public

contains(peerId: string): boolean

Check if the store has at least one occurrence of the peer.

public

get(peerId: string): ELiving

Get the entry of the arc leading to PeerId

public

insert(peerId: string, socket: object, tid: string): Boolean

add another arc leading to peerId in the store

public

remove(peerId: string): ELiving

ProtocolId removes an arc to the peerId.

public

removes all arcs.

public

removePeer(peerId: string): Map

Remove all arcs leading to peerId.

Public Constructors

public constructor() source

Public Members

public store: * source

public tid: * source

Public Methods

public contains(peerId: string): boolean source

Check if the store has at least one occurrence of the peer.

Params:

NameTypeAttributeDescription
peerId string

The identifier of the peer to check.

Return:

boolean

true if it exists, false otherwise.

public get(peerId: string): ELiving source

Get the entry of the arc leading to PeerId

Params:

NameTypeAttributeDescription
peerId string

The identifier of the remote peer

Return:

ELiving

The entry containing peerId, null if it does not exists.

public insert(peerId: string, socket: object, tid: string): Boolean source

add another arc leading to peerId in the store

Params:

NameTypeAttributeDescription
peerId string

The identifier of the peer reachable through the socket.

socket object

The WebRTC socket. Can be null if the socket to peerId is known to be in the store.

tid string

TemporyId of a set of offer that we store in order to say if the already see a set of offers. (trickle true problems)

Return:

Boolean

Return true if increment was done, false otherwise

public remove(peerId: string): ELiving source

ProtocolId removes an arc to the peerId.

Params:

NameTypeAttributeDescription
peerId string

The identifier of the peer accessible through the arc to delete.

Return:

ELiving

The entry if no protocol is using the socket, null otherwise.

public removeAll(): object[] source

removes all arcs.

Return:

object[]

Objects comprising {peer, socket, occ}; peer being the identifier of the peer reachable through the socket, socket being a WebRTC connection that is not used by any protocols, null if protocols still use it, occ being the number of arcs removed by protocolId.

public removePeer(peerId: string): Map source

Remove all arcs leading to peerId.

Params:

NameTypeAttributeDescription
peerId string

The identifier of the peer reachable by a WebRTC connection to remove.

Return:

Map

Map where key is the identifier of the protocol that sees its arcs being removed, and value is the number of arcs removed;