Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TopicCache

Interface for the topic cache The topic cache used by the internal session to cache all topic values that the session subscribes to.

Hierarchy

  • TopicCache

Index

Constructors

constructor

  • Create a new TopicCache instance

    Parameters

    Returns TopicCache

Properties

Private byId

byId: object

All the topic cache entries by their ID

Type declaration

Private byPath

byPath: object

All the topic cache entries by their topic path

Type declaration

Private datatypes

datatypes: DataTypes

A reference to the DataTypes object that supplies the available data types

Methods

clear

  • clear(): void
  • Clear all streams from the cache

    Returns void

handleDelta

  • Handle a delta on a given topic ID

    Parameters

    • id: number

      the topic ID

    • delta: Buffer

      the delta content

    • registry: StreamRegistry

      the stream registry

    • handler: ErrorHandler

      an error handler

    Returns void

handleSubscription

  • Handle a subscription to a new topic

    This is called by the internal session when the client subscribes to a new topic. A new entry TopicCacheEntry is created and all streams in the stream registry that select the subscribed path will be added to that entry.

    The entry will then be notified of the initial subscription.

    Parameters

    Returns void

handleUnsubscription

  • Handle an unsubscription event on a given topic ID

    Parameters

    Returns void

handleValue

  • Handle a value on a given topic ID

    Parameters

    • id: number

      the topic ID

    • content: Buffer

      the new content

    • registry: StreamRegistry

      the stream registry

    • handler: ErrorHandler

      an error handler

    Returns void

newStream

  • Add a new stream into the topic cache

    The stream will be added to all current entries that the stream selects.

    Parameters

    Returns void

notifyUnsubscriptionOfAllTopics

  • Clear the topic cache and notify all entries of an unsubscription

    Parameters

    Returns void

removeAllStreams

  • removeAllStreams(): void
  • Remove all streams from the cache

    Removes all streams from all entries without removing the entries themselves

    Returns void

removeStream

  • Remove a stream from the topic cache

    Removes the stream from all entries that contain it.

    Parameters

    Returns void