In Aya, an instance of the
Bpf type manages the lifetime of all the eBPF objects created
Consider the following example:
- When you call
load_file, all the maps referenced by the eBPF code are created and stored inside the returned Bpf instance.
- Similarly when you load a program to the kernel, it's stored inside the
- When you attach a program, it stays attached until the parent
Bpfinstance gets dropped.
- At this point the
bpfvariable has been droppped. Our program and maps are detached/unloaded.