Commit Graph

5 Commits (39a27090e9eaa7d7122a5c775f21ae822af54da8)

Author SHA1 Message Date
Thomas Eizinger 3993346596
docs(aya-ebpf): extend docs of `Array` 2 months ago
Thomas Eizinger 9f3a944f9b
feat(aya-ebpf): introduce `array::OutOfBounds` error
Like regular arrays in Rust, arrays in eBPF are initialised upon
creation. Unlike regular arrays though, the memory is simply initialised
to all zeros without the user having to provide the array elements.

Like regular arrays, accessing the value at a specified index will yield
a reference as long as the index is within the bounds of the array.

At present, the API for `Array::get` returns an `Option` where the
`None` case signals the "out-of-bounds" case. Given that the user never
explicitly provided any values, the `None` case may be mistaked as "the
value has not been set" rather than "out of bounds".

To make this more obvious, we change the API to return a new
`OutOfBounds` error instead. This aligns the API with the user-space
equivalent of the `Array` struct.
2 months ago
jinlong 2fb19f3ee2 feat: Add `set` for `Array<T>`
Signed-off-by: jinlong <jinlong@tencent.com>
3 months ago
Tamir Duberstein 601c89dd23 aya-ebpf: extract insert,remove,lookup
These functions (and more) are duplicated all over the place.
3 months ago
Dave Tucker 41c61560ea chore(aya-ebpf): Rename bpf -> ebpf
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
1 year ago