Options
All
  • Public
  • Public/Protected
  • All
Menu

IAtomicLong is a redundant and highly available distributed counter for 64-bit integers (long type in java).

It works on top of the Raft consensus algorithm. It offers linearizability during crash failures and network partitions. It is CP with respect to the CAP principle. If a network partition occurs, it remains available on at most one side of the partition.

IAtomicLong implementation does not offer exactly-once / effectively-once execution semantics. It goes with at-least-once execution semantics by default and can cause an API call to be committed multiple times in case of CP member failures. It can be tuned to offer at-most-once execution semantics. Please see fail-on-indeterminate-operation-state server-side setting.

Hierarchy

Index

Methods

  • addAndGet(delta: number | Long): Promise<Long>
  • Atomically adds the given value to the current value.

    Parameters

    • delta: number | Long

      the value to add to the current value

    Returns Promise<Long>

    the updated value, the given value added to the current value

  • compareAndSet(expect: number | Long, update: number | Long): Promise<boolean>
  • Atomically sets the value to the given updated value only if the current value equals the expected value.

    Parameters

    • expect: number | Long

      the expected value

    • update: number | Long

      the new value

    Returns Promise<boolean>

    true if successful; or false if the actual value was not equal to the expected value.

  • decrementAndGet(): Promise<Long>
  • Atomically decrements the current value by one.

    Returns Promise<Long>

    the updated value, the current value decremented by one

  • destroy(): Promise<void>
  • Destroys this object cluster-wide. Clears all resources taken for this object.

    Returns Promise<void>

  • get(): Promise<Long>
  • Gets the current value.

    Returns Promise<Long>

    the current value

  • getAndAdd(delta: number | Long): Promise<Long>
  • Atomically adds the given value to the current value.

    Parameters

    • delta: number | Long

      the value to add to the current value

    Returns Promise<Long>

    the old value before the add

  • getAndDecrement(): Promise<Long>
  • Atomically decrements the current value by one.

    Returns Promise<Long>

    the old value

  • getAndIncrement(): Promise<Long>
  • Atomically increments the current value by one.

    Returns Promise<Long>

    the old value

  • getAndSet(newValue: number | Long): Promise<Long>
  • Atomically sets the given value and returns the old value.

    Parameters

    • newValue: number | Long

      the new value

    Returns Promise<Long>

    the old value

  • getName(): string
  • Returns the unique name of this object.

    Returns string

  • getPartitionKey(): string
  • Returns the key of the partition that this DistributedObject is assigned to. For a partitioned data structure, the returned value will not be null, but otherwise undefined.

    Returns string

  • getServiceName(): string
  • incrementAndGet(): Promise<Long>
  • Atomically increments the current value by one.

    Returns Promise<Long>

    the updated value, the current value incremented by one

  • set(newValue: number | Long): Promise<void>
  • Atomically sets the given value.

    Parameters

    • newValue: number | Long

      the new value

    Returns Promise<void>

Generated using TypeDoc