Construct a new instance operating on the given map.
Reference to the map. See MapRef if you want to implement your own instances.
Type conversion for keys
Type conversion for values
Convenience function. Alias of entries.
Convenience function. Non-atomically iterates over the map's entries, deleting them.
Convenience function. Non-atomically iterates through the map's entries, deleting them while iterating.
Delete a single map entry.
Returns true
if an entry was found
and deleted, false
otherwise.
Perform delete operation on the passed entries.
Since Linux 5.6.
Unlike in delete, an entry isn't found,
ENOENT
will be thrown and no more entries will
be processed.
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.
Convenience function. Non-atomically iterates through the map's entries. Gets the next key before yielding the current one, making it suitable for deleting entries while iterating.
Freezes the map, making it non-modifiable from userspace. The map stays writeable from BPF side.
Since Linux 5.2.
Fetch the value for a single key.
Entry value, or undefined
if no such entry exists
Iterate through the map entries.
This works like entries 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.
Atomically deletes an entry and returns its former value,
or undefined
if no entry was found. This operation is
generally implemented only for stack / queue types.
Since Linux 4.20. Most map types probably won't implement this operation.
Convenience function. Tests if the map has an entry.
Non-atomically iterates through the map's keys, starting by the key immediately following the passed one. If no key isn't passed or it doesn't exist, iteration starts by the first key in the map.
Note: Not passing a key is only supported on kernels 4.12 and above.
Because this calls BPF_MAP_GET_NEXT_KEY
repeatedly,
if the map's keys are deleted while it's being iterated
(by this or another program), iteration could restart to
the beginning. However, this method fetches the next key
before yielding the current one, making it safe to delete
the current key (and any past ones).
Keep in mind that the order of keys depends on the type of map, and isn't necessarily guaranteed to be consistent.
Add or override a single map entry.
Perform set operation on the passed entries.
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.
Convenience function. Non-atomically iterates through the map's values.
Generated using TypeDoc
Implementation of IMap that converts keys and values to 'parsed' representations using the given TypeConversion.