Home Reference Source
public class | source

Broadcast

Extends:

* → Broadcast

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
private

Method Summary

Public Methods
public

Clear the AntiEntropy mechanism

public

send(message: Object, id: Object, isReady: Object): boolean

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

_receive(id: string, message: Object): void

Handler executed when a message is recevied

private

_reviewBuffer(): void

Scan internal buffer to deliver waiting messages

private

_sendAll(message: Object): void

Send a message to all neighbours

private

Check if a message should be propagated or not

Public Constructors

public constructor(source: AbstractNetwork, protocol: string) source

Constructor

Params:

NameTypeAttributeDescription
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 clearAntiEntropy() source

Clear the AntiEntropy mechanism

public send(message: Object, id: Object, isReady: Object): boolean source

Send a message in broadcast

Params:

NameTypeAttributeDescription
message Object

The message to send

id Object
  • optional

{e: <stringId>, c: <Integer>} this uniquely represents the id of the operation

isReady Object
  • optional

{e: <stringId>, c: <Integer>} this uniquely represents the id of the operation that we must wait before delivering the message

Return:

boolean

public sendAntiEntropyResponse(origin: [type], causalityAtReceipt: [type], elements: [type]): [type] source

this method was deprecated.

Send entropy response

Params:

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

NameTypeAttributeDescription
delta *
  • optional

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:

NameTypeAttributeDescription
id *
messageCausality *
ourCausality *

private _findInBuffer(id: string): int source

Try to find the index of a message in the internal buffer

Params:

NameTypeAttributeDescription
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

Params:

NameTypeAttributeDescription
id string

Message issuer's ID

message Object

The message received

Return:

void

private _reviewBuffer(): void source

Scan internal buffer to deliver waiting messages

Return:

void

private _sendAll(message: Object): void source

Send a message to all neighbours

Params:

NameTypeAttributeDescription
message Object

The message to send

Return:

void

private _shouldStopPropagation(message: Object): boolean source

Check if a message should be propagated or not

Params:

NameTypeAttributeDescription
message Object

The message to check

Return:

boolean

True if the message should not be propagated, False if it should be.