Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface MultiMap<K, V>

A specialized map whose keys can be associated with multiple values.

Methods that require serialization/deserialization may throw RangeError, e.g when there is no suitable serializer for a certain type.

Type parameters

  • K

  • V

Hierarchy

  • DistributedObject
    • MultiMap

Index

Methods

addEntryListener

  • addEntryListener(listener: EntryListener<K, V>, key?: K, includeValue?: boolean): Promise<string>
  • Adds an entry listener to this multi-map.

    Parameters

    • listener: EntryListener<K, V>

      entry listener to be attached

    • Optional key: K

      if specified then this entry listener will only be notified of updates related to this key.

    • Optional includeValue: boolean

      if true, then the event will include the modified value.

    Returns Promise<string>

    registration ID for this entry listener

clear

  • clear(): Promise<void>
  • Removes all entries from this multi-map.

    Returns Promise<void>

containsEntry

  • containsEntry(key: K, value: V): Promise<boolean>
  • Parameters

    • key: K

      key to match against.

    • value: V

      value to match against.

    Returns Promise<boolean>

    true if this multi-map has an association between the specified key and the specified value, false otherwise.

containsKey

  • containsKey(key: K): Promise<boolean>
  • Checks if this multi-map contains a specified key.

    Parameters

    • key: K

      key to search for.

    Returns Promise<boolean>

    true if this map contains the specified key, false otherwise.

containsValue

  • containsValue(value: V): Promise<boolean>
  • Parameters

    • value: V

      value to search for.

    Returns Promise<boolean>

    true if the specified value is associated with at least one key in this multi-map, false otherwise.

destroy

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

    Returns Promise<void>

entrySet

  • entrySet(): Promise<[K, V][]>
  • Returns all entries in this multi-map. If a certain key has multiple values associated with it, then one pair will be returned for each value.

    Returns Promise<[K, V][]>

    an array of all key value pairs stored in this multi-map.

forceUnlock

  • forceUnlock(key: K): Promise<void>
  • Forcefully unlocks the specified key, disregarding the acquisition count. This in contrast to the regular unlock, which has to be called the same amount of times as the lock was acquired.

    Parameters

    • key: K

      key to be unlocked.

    Returns Promise<void>

get

  • get(key: K): Promise<ReadOnlyLazyList<V>>
  • Retrieves a list of values associated with the specified key.

    Parameters

    • key: K

      key to search for.

    Returns Promise<ReadOnlyLazyList<V>>

    a list of values associated with the specified key.

getName

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

    Returns string

getPartitionKey

  • 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

  • getServiceName(): string
  • Returns the service name for this object.

    Returns string

isLocked

  • isLocked(key: K): Promise<boolean>
  • Parameters

    • key: K

      key to be checked

    Returns Promise<boolean>

    true if this key is locked, false otherwise

keySet

  • keySet(): Promise<K[]>
  • Returns Promise<K[]>

    an array of all keys in this multi-map.

lock

  • lock(key: K, leaseMillis?: number): Promise<void>
  • Locks the specified key. If the specified key cannot be locked immediately, then the returned Promise will be resolved only when the lock becomes available. All attempts to access the locked key will block until the lock is released.

    Locking is reentrant, meaning that the lock owner client can obtain the lock multiple times. If the lock was acquired multiple times, then unlock() method must be called the same amount of times, otherwise the lock will remain unavailable.

    If lease time is specified, then the lock will automatically become available after the specified time has passed. If lease time is not specified or is less than zero, then lock owner must call unlock to make the lock available.

    Parameters

    • key: K

      key to be locked.

    • Optional leaseMillis: number

      lease time in milliseconds.

    Returns Promise<void>

put

  • put(key: K, value: V): Promise<boolean>
  • Adds a key-value pair to this multi-map. If this multi-map already has some value associated with the specified key, then calling this method will not replace the old value. Instead, both values will be associated with the same key.

    Parameters

    • key: K

      key to add.

    • value: V

      value to associate with the key.

    Returns Promise<boolean>

    true if this multi-map did not have the specified value associated with the specified key, false otherwise.

putAll

  • putAll(pairs: [K, V[]][]): Promise<void>
  • Stores the given key, value array pairs in the MultiMap.

    The behaviour of this operation is undefined if the specified pairs are modified while this operation is in progress.

    No atomicity guarantees are given. It could be that in case of failure some of the key/value-pairs get written, while others are not.

    Parameters

    • pairs: [K, V[]][]

      key-value array pairs

    Returns Promise<void>

remove

  • remove(key: K, value: V): Promise<boolean>
  • Removes an association of the specified value with the specified key. Calling this method does not affect other values associated with the same key.

    Parameters

    • key: K

      key from which the value should be detached.

    • value: V

      value to be removed.

    Returns Promise<boolean>

    true if the value was detached from the specified key, false if it was not.

removeAll

  • removeAll(key: K): Promise<ReadOnlyLazyList<V>>
  • Detaches all values from the specified key.

    Parameters

    • key: K

      key from which all entries should be removed.

    Returns Promise<ReadOnlyLazyList<V>>

    a list of old values that were associated with this key prior to this method call.

removeEntryListener

  • removeEntryListener(listenerId: string): Promise<boolean>
  • Removes the entry listener by the registration ID.

    Parameters

    • listenerId: string

      registration ID that was returned when this listener was added.

    Returns Promise<boolean>

size

  • size(): Promise<number>
  • Returns Promise<number>

    the total number of values in this multi-map.

tryLock

  • tryLock(key: K, timeoutMillis?: number, leaseMillis?: number): Promise<boolean>
  • Attempts to acquire the lock for the specified key within the specified timeout. The returned promise will be returned either when the lock becomes available or when the timeout is reached.

    If the specified key cannot be locked immediately, then the returned Promise will be resolved only when the lock becomes available. All attempts to access the locked key will block until the lock is released.

    Locking is reentrant, meaning that the lock owner client can obtain the lock multiple times. If the lock was acquired multiple times, then unlock() method must be called the same amount of times, otherwise the lock will remain unavailable.

    If lease time is specified, then the lock will automatically become available after the specified time has passed. If lease time is not specified or is less than zero, then lock owner must call unlock to make the lock available.

    Parameters

    • key: K

      key to be locked

    • Optional timeoutMillis: number

      timeout for locking, in milliseconds

    • Optional leaseMillis: number

      lease time in milliseconds

    Returns Promise<boolean>

unlock

  • unlock(key: K): Promise<void>
  • Unlocks the specified key

    Parameters

    • key: K

      key to be unlocked

    Returns Promise<void>

valueCount

  • valueCount(key: K): Promise<number>
  • Parameters

    • key: K

      key to search for.

    Returns Promise<number>

    the number of values associated with the specified key.

values

  • values(): Promise<ReadOnlyLazyList<V>>
  • Returns Promise<ReadOnlyLazyList<V>>

    a flat list of all values stored in this multi-map.

Generated using TypeDoc