Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IArrayMap<V>

Specialized version of IMap for ARRAY maps.

RawArrayMap returns array values directly as Buffer with no conversion, and ConvArrayMap performs the conversion specified at construction time.

Keep in mind that ARRAY maps aren't atomic at all.

Type parameters

  • V

Hierarchy

  • IArrayMap

Implemented by

Index

Properties

Methods Batched operations

Methods Convenience

Methods Operations

Properties

length: number

Size of the array in items

Batched operations Methods

  • getBatch(batchSize: number, flags?: number): IterableIterator<V[]>
  • Iterate through the array values.

    This works like values but the iteration is performed in the kernel, returning many items at once. The interator yields each batch produced by the kernel, until an error is found or there are no more entries.

    batchSize specifies the requested size, but batches may be smaller. If the kernel returns a partial batch together with an error, the partial batch will be yielded before throwing the error. If the map is empty, nothing is yielded.

    Since Linux 5.6.

    Parameters

    • batchSize: number

      Amount of entries to request per batch, must be non-zero

    • Optional flags: number

      Operation flags, see MapLookupFlags

    Returns IterableIterator<V[]>

  • setBatch(entries: [number, V][], flags?: number): IArrayMap<V>
  • Sets a batch of array indexes to some values. Throws if any of the indexes is invalid.

    Since Linux 5.6.

    Note that if an error is thrown, part of the entries could already have been processed. The thrown error includes a count field that, if not undefined, corresponds to the amount of processed entries.

    Parameters

    • entries: [number, V][]

      Array entries to set (indexes are not necessarily unique or sorted).

    • Optional flags: number

      Operation flags, see MapUpdateFlags

    Returns IArrayMap<V>

Convenience Methods

  • [iterator](): IterableIterator<V>
  • getAll(): V[]
  • Sets all values of the array using setBatch.

    Note that if an error is thrown, part of the entries could already have been processed. The thrown error includes a count field that, if not undefined, corresponds to the amount of processed entries.

    params

    values New array values (must contain exactly length items)

    Parameters

    • values: V[]

    Returns IArrayMap<V>

  • values(): IterableIterator<V>
  • Iterates through the values of the array.

    Returns IterableIterator<V>

Operations Methods

  • freeze(): void
  • Freezes the map, making it non-modifiable from userspace. The map stays writeable from BPF side.

    Since Linux 5.2.

    Returns void

  • get(key: number, flags?: number): V
  • Fetch the value at a certain index. Throws on invalid indexes.

    Parameters

    • key: number

      Array index

    • Optional flags: number

      Operation flags (since Linux 5.1), see MapLookupFlags

    Returns V

    Array value

  • set(key: number, value: V, flags?: number): IArrayMap<V>
  • Set the value at a certain index. Throws on invalid indexes.

    Parameters

    • key: number

      Array index

    • value: V

      Nwe value

    • Optional flags: number

      Operation flags (since Linux 3.19), see MapUpdateFlags

    Returns IArrayMap<V>

Generated using TypeDoc