Options
All
  • Public
  • Public/Protected
  • All
Menu

Class NullLock

Dummy lock implementation that doesn't do anything.

It can be used in testing or in situations when lock is required but shall be disabled.

see

ILock

Hierarchy

  • NullLock

Implements

Index

Methods

acquireLock

  • acquireLock(correlationId: string, key: string, ttl: number, timeout: number, callback: function): void
  • Makes multiple attempts to acquire a lock by its key within give time interval.

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • key: string

      a unique lock key to acquire.

    • ttl: number

      a lock timeout (time to live) in milliseconds.

    • timeout: number

      a lock acquisition timeout.

    • callback: function

      callback function that receives error or null for success.

        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

releaseLock

  • releaseLock(correlationId: string, key: string, callback?: function): void
  • Releases prevously acquired lock by its key.

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • key: string

      a unique lock key to release.

    • Optional callback: function

      callback function that receives error or null for success.

        • (err: any): void
        • Parameters

          • err: any

          Returns void

    Returns void

tryAcquireLock

  • tryAcquireLock(correlationId: string, key: string, ttl: number, callback: function): void
  • Makes a single attempt to acquire a lock by its key. It returns immediately a positive or negative result.

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    • key: string

      a unique lock key to acquire.

    • ttl: number

      a lock timeout (time to live) in milliseconds.

    • callback: function

      callback function that receives a lock result or error.

        • (err: any, result: boolean): void
        • Parameters

          • err: any
          • result: boolean

          Returns void

    Returns void

Generated using TypeDoc