Skip to content

using BatchLookupAndDelete for PerCPU hashmap #1315

Answered by lmb
msherif1234 asked this question in Q&A
Discussion options

You must be logged in to vote

You're mixing MapIterator with the batch API. The two are mutually exclusive. The core loop you want is this:

ebpf/map_test.go

Lines 2181 to 2190 in f95957d

var cursor BatchCursor
for {
_, err := m.BatchLookupAndDelete(&cursor, k, v, nil)
if errors.Is(err, ErrKeyNotExist) {
break
}
if err != nil {
b.Fatal(err)
}
}

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by msherif1234
Comment options

You must be logged in to vote
2 replies
@ti-mo
Comment options

@msherif1234
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants