import Broadcast from 'foglet-core/src/network/communication/broadcast/broadcast.js'
Broadcast
Extends:
Broadcast represent the base implementation of a broadcast protocol for the foglet library. Based on the CausalBrodacastDefinition Package: see: https://github.com/Chat-Wane/CausalBroadcastDefinition
Constructor Summary
Public Constructor | ||
public |
constructor(source: AbstractNetwork, protocol: string) Constructor |
Member Summary
Public Members | ||
public |
options: {"id": *, "delta": *} |
Private Members | ||
private |
_buffer: *[] |
|
private |
|
|
private |
_causality: * |
|
private |
|
Method Summary
Public Methods | ||
public |
Clear the AntiEntropy mechanism |
|
public |
Send a message in broadcast |
|
public |
sendAntiEntropyResponse(origin: [type], causalityAtReceipt: [type], elements: [type]): [type] this method was deprecated.
Send entropy response |
|
public |
startAntiEntropy(delta: *) We started Antientropy mechanism in order to retreive old missed files |
Private Methods | ||
private |
_defaultBehaviorAntiEntropy(id: *, messageCausality: *, ourCausality: *) This callback depends on the type of the applications, this is the default behavior when you receive old missed files |
|
private |
_findInBuffer(id: string): int Try to find the index of a message in the internal buffer |
|
private |
Handler executed when a message is recevied |
|
private |
_reviewBuffer(): void Scan internal buffer to deliver waiting messages |
|
private |
Send a message to all neighbours |
|
private |
_shouldStopPropagation(message: Object): boolean Check if a message should be propagated or not |
Public Constructors
public constructor(source: AbstractNetwork, protocol: string) source
Constructor
Params:
Name | Type | Attribute | Description |
source | AbstractNetwork | The source RPS/overlay |
|
protocol | string | The name of the broadcast protocol |
Public Members
public options: {"id": *, "delta": *} source
Private Members
private _buffer: *[] source
private _bufferAntiEntropy: * source
private _causality: * source
private _intervalAntiEntropy: * source
Public Methods
public send(message: Object, id: Object, isReady: Object): boolean source
Send a message in broadcast
Params:
Name | Type | Attribute | Description |
message | Object | The message to send |
|
id | Object |
|
{e: <stringId>, c: <Integer>} this uniquely represents the id of the operation |
isReady | Object |
|
{e: <stringId>, c: <Integer>} this uniquely represents the id of the operation that we must wait before delivering the message |
public sendAntiEntropyResponse(origin: [type], causalityAtReceipt: [type], elements: [type]): [type] source
Send entropy response
Params:
Name | Type | Attribute | Description |
origin | [type] | [description] |
|
causalityAtReceipt | [type] | [description] |
|
elements | [type] | [description] |
Return:
[type] | [description] |
public startAntiEntropy(delta: *) source
We started Antientropy mechanism in order to retreive old missed files
Params:
Name | Type | Attribute | Description |
delta | * |
|
Private Methods
private _defaultBehaviorAntiEntropy(id: *, messageCausality: *, ourCausality: *) source
This callback depends on the type of the applications, this is the default behavior when you receive old missed files
Params:
Name | Type | Attribute | Description |
id | * | ||
messageCausality | * | ||
ourCausality | * |
private _findInBuffer(id: string): int source
Try to find the index of a message in the internal buffer
Params:
Name | Type | Attribute | Description |
id | string | Message's ID |
Return:
int | The index of the message in the buffer, or -1 if not found |
private _receive(id: string, message: Object): void source
Handler executed when a message is recevied
Return:
void |