Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RawArrayMap

Raw version of the IArrayMap interface where values are returned directly as Buffers.

Hierarchy

  • RawArrayMap

Implements

Index

Constructors

  • Construct a new instance operating on the given map.

    The map must be of ARRAY type.

    Parameters

    • ref: MapRef

      Reference to the map. See MapRef if you want to implement your own instances.

    Returns RawArrayMap

Properties

length: number

Size of the array in items

ref: MapRef

Methods

  • [iterator](): IterableIterator<Buffer>
  • 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, out?: Buffer): Buffer
  • Fetch the value at a certain index. Throws on invalid indexes.

    Parameters

    • key: number
    • flags: number = 0
    • Optional out: Buffer

    Returns Buffer

    Array value

  • getAll(): Buffer[]
  • getBatch(batchSize: number, flags?: number): IterableIterator<Buffer[]>
  • 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
    • flags: number = 0

    Returns IterableIterator<Buffer[]>

  • set(key: number, value: Buffer, flags?: number): RawArrayMap
  • 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.

    Parameters

    • values: Buffer[]

    Returns RawArrayMap

  • setBatch(entries: [number, Buffer][], flags?: number): RawArrayMap
  • 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, Buffer][]
    • flags: number = 0

    Returns RawArrayMap

  • values(): IterableIterator<Buffer>

Generated using TypeDoc