kadence/quasar~ QuasarPlugin

Implements the primary interface for the publish-subscribe system and decorates the given node object with it's public methods

Constructor

new QuasarPlugin(node)

Parameters:
NameTypeDescription
nodeKademliaNode

Members

neighbors

Returns our ALPHA closest neighbors

Properties
NameTypeDescription
neighborsArray.<Bucket~contact>

Methods

hasNeighborSubscribedTo(topic) → {boolean}

Check if our neighbors are subscribed to the topic

Parameters:
NameTypeDescription
topicstring

Topic to check subscription

Returns:
Type: 
boolean

isSubscribedTo(topic) → {boolean}

Check if we are subscribed to the topic

Parameters:
NameTypeDescription
topicstring

Topic to check subscription

Returns:
Type: 
boolean

pullFilterFrom(contact, callback)

Requests the attenuated bloom filter from the supplied contact

Parameters:
NameTypeDescription
contactBucket~contact
callbackfunction

pullFilters(callbackopt)

Requests neighbor bloom filters and merges with our records

Parameters:
NameTypeAttributesDescription
callbackfunction<optional>

pushFilters(callbackopt)

Notifies neighbors that our subscriptions have changed

Parameters:
NameTypeAttributesDescription
callbackfunction<optional>

pushFilterTo(contact, callback)

Sends our attenuated bloom filter to the supplied contact

Parameters:
NameTypeDescription
contactBucket~contact
callbackfunction

quasarPublish(topic, contents, optionsopt, callbackopt)

Publishes the content to the network by selecting ALPHA contacts closest to the node identity (or the supplied routing key). Errors if message is unable to be delivered to any contacts. Tries to deliver to ALPHA contacts until exhausted.

Parameters:
NameTypeAttributesDescription
topicstring

Identifier for subscribers

contentsobject

Arbitrary publication payload

optionsobject<optional>
Properties
NameTypeAttributesDescription
routingKeystring<optional>

Publish to neighbors close to this key instead of our own identity

callbackQuasarPlugin~quasarPublishCallback<optional>

quasarSubscribe(topics, handler)

Publishes the content to the network

Parameters:
NameTypeDescription
topicsstring | Array.<string>

Identifier for subscribers

handlerQuasarPlugin~quasarSubscribeHandler