Documentation
¶
Overview ¶
Package bbeequeue supports receiving data from type BPF_MAP_TYPE_RINGBUF eBPF maps using idiomatic Go channels. This package does not attempt to be a jack-of-all-trades implementation, but instead to cover the basic use case of providing channel access to eBPF ringbuffer maps.
Usage ¶
New returns a new channel producing T values until the passed context gets done. The default is an unbuffered channel, specify WithSize in the call to New in order to create a buffered channel of the configured size.
import "github.com/thediveo/bbeequeue"
ctx, cancel := context.WithCancel(context.TODO())
ch, err := bbeequeue.New[Foo](ctx, mymap)
for {
event, ok := <-ch
if !ok {
break
}
}
Trivia ¶
The package name “bbeequeue” is a terrible pun on eBPF's bee mascot, ringbuffers or queues, and finally, burning things beyond recognition, also known as “BBQ”.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns a new channel for receiving T values from the specified eBPF ringbuffer map until the passed context gets done. When the context is done, the channel will close automatically.
New optionally takes configuration options (that's why they are called options ... “my name is Option, Optional Option”):
- WithSize configures the channel buffer size; it defaults to 0 in which case the returned channel is unbuffered. New will return an error when trying to configure a negative size.
- WithErrorChannel configures a caller-supplied channel that will receive any errors occurring when reading and unmarshalling data from the ringbuffer. Please note that this channel will never be closed automatically.
Types ¶
type Option ¶
type Option func(o *options) error
Option configures optional settings.
func WithErrorChannel ¶
WithErrorChannel configures a caller-supplied error channel on which ringbuffer receive und data unmarshalling errors are reported. This channel will not be automatically closed.