Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SharedData

Shared data allows you to share data safely between different parts of your application in a safe way.

Shared data provides:

  • synchronous shared maps (local)
  • asynchronous maps (local or cluster-wide)
  • asynchronous locks (local or cluster-wide)
  • asynchronous counters (local or cluster-wide)

WARNING: In clustered mode, asynchronous maps/locks/counters rely on distributed data structures provided by the cluster manager. Beware that the latency relative to asynchronous maps/locks/counters operations can be much higher in clustered than in local mode.

Please see the documentation for more information.

Hierarchy

  • SharedData

Index

Methods

getAsyncMap

  • Get the AsyncMap with the specified name. When clustered, the map is accessible to all nodes in the cluster and data put into the map from any node is visible to to any other node.

    WARNING: In clustered mode, asynchronous shared maps rely on distributed data structures provided by the cluster manager. Beware that the latency relative to asynchronous shared maps operations can be much higher in clustered than in local mode.

    Type parameters

    • K

    • V

    Parameters

    • name: string

    Returns PromiseLike<AsyncMap<K, V>>

  • Get the AsyncMap with the specified name. When clustered, the map is accessible to all nodes in the cluster and data put into the map from any node is visible to to any other node.

    WARNING: In clustered mode, asynchronous shared maps rely on distributed data structures provided by the cluster manager. Beware that the latency relative to asynchronous shared maps operations can be much higher in clustered than in local mode.

    Type parameters

    • K

    • V

    Parameters

    Returns void

getClusterWideMap

  • Get the cluster wide map with the specified name. The map is accessible to all nodes in the cluster and data put into the map from any node is visible to to any other node.

    Type parameters

    • K

    • V

    Parameters

    • name: string

    Returns PromiseLike<AsyncMap<K, V>>

  • Get the cluster wide map with the specified name. The map is accessible to all nodes in the cluster and data put into the map from any node is visible to to any other node.

    Type parameters

    • K

    • V

    Parameters

    Returns void

getCounter

  • Get an asynchronous counter. The counter will be passed to the handler.

    Parameters

    • name: string

    Returns PromiseLike<Counter>

  • Get an asynchronous counter. The counter will be passed to the handler.

    Parameters

    Returns void

getLocalAsyncMap

  • Get the AsyncMap with the specified name.

    When clustered, the map is NOT accessible to all nodes in the cluster. Only the instance which created the map can put and retrieve data from this map.

    Type parameters

    • K

    • V

    Parameters

    • name: string

    Returns PromiseLike<AsyncMap<K, V>>

  • Get the AsyncMap with the specified name.

    When clustered, the map is NOT accessible to all nodes in the cluster. Only the instance which created the map can put and retrieve data from this map.

    Type parameters

    • K

    • V

    Parameters

    Returns void

getLocalCounter

  • Get an asynchronous local counter. The counter will be passed to the handler.

    Parameters

    • name: string

    Returns PromiseLike<Counter>

  • Get an asynchronous local counter. The counter will be passed to the handler.

    Parameters

    Returns void

getLocalLock

  • Get an asynchronous local lock with the specified name. The lock will be passed to the handler when it is available.

    In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.

    Parameters

    • name: string

    Returns PromiseLike<Lock>

  • Get an asynchronous local lock with the specified name. The lock will be passed to the handler when it is available.

    In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.

    Parameters

    Returns void

getLocalLockWithTimeout

  • getLocalLockWithTimeout(name: string, timeout: number): PromiseLike<Lock>
  • getLocalLockWithTimeout(name: string, timeout: number, resultHandler: ((res: AsyncResult<Lock>) => void) | Handler<AsyncResult<Lock>>): void
  • Like {@link SharedData#getLocalLock} but specifying a timeout. If the lock is not obtained within the timeout a failure will be sent to the handler.

    In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.

    Parameters

    • name: string
    • timeout: number

    Returns PromiseLike<Lock>

  • Like {@link SharedData#getLocalLock} but specifying a timeout. If the lock is not obtained within the timeout a failure will be sent to the handler.

    In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.

    Parameters

    Returns void

getLocalMap

  • getLocalMap<K, V>(name: string): LocalMap<K, V>
  • Return a LocalMap with the specific name.

    Type parameters

    • K

    • V

    Parameters

    • name: string

    Returns LocalMap<K, V>

getLock

  • Get an asynchronous lock with the specified name. The lock will be passed to the handler when it is available.

    In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.

    Parameters

    • name: string

    Returns PromiseLike<Lock>

  • Get an asynchronous lock with the specified name. The lock will be passed to the handler when it is available.

    In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.

    Parameters

    Returns void

getLockWithTimeout

  • getLockWithTimeout(name: string, timeout: number): PromiseLike<Lock>
  • getLockWithTimeout(name: string, timeout: number, resultHandler: ((res: AsyncResult<Lock>) => void) | Handler<AsyncResult<Lock>>): void
  • Like {@link SharedData#getLock} but specifying a timeout. If the lock is not obtained within the timeout a failure will be sent to the handler.

    In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.

    Parameters

    • name: string
    • timeout: number

    Returns PromiseLike<Lock>

  • Like {@link SharedData#getLock} but specifying a timeout. If the lock is not obtained within the timeout a failure will be sent to the handler.

    In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.

    Parameters

    Returns void

Generated using TypeDoc