Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ConvArrayMap<V>

Implementation of IArrayMap that converts values to 'parsed' representations using the given TypeConversion.

Type parameters

  • V

Hierarchy

  • ConvArrayMap

Implements

Index

Constructors

  • Construct a new instance operating on the given map.

    The map must be of ARRAY type.

    Type parameters

    • V

    Parameters

    • ref: MapRef

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

    • valueConv: TypeConversion<V>

      Type conversion for array values

    Returns ConvArrayMap<V>

Accessors

  • get length(): number

Methods

  • [iterator](): IterableIterator<V>
  • 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
    • Optional flags: number

    Returns V

    Array value

  • getAll(): V[]
  • 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
    • Optional flags: number

    Returns IterableIterator<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.

    Parameters

    • values: V[]

    Returns ConvArrayMap<V>

  • setBatch(entries: [number, V][], flags?: number): ConvArrayMap<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][]
    • Optional flags: number

    Returns ConvArrayMap<V>

  • values(): IterableIterator<V>

Generated using TypeDoc