mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
p2p/enode: add more documentation on AsyncFilter
This commit is contained in:
parent
54f52bd604
commit
2da18aaeae
1 changed files with 3 additions and 0 deletions
|
|
@ -172,6 +172,9 @@ type asyncFilterIter struct {
|
||||||
type AsyncFilterFunc func(context.Context, *Node) *Node
|
type AsyncFilterFunc func(context.Context, *Node) *Node
|
||||||
|
|
||||||
// AsyncFilter creates an iterator which checks nodes in parallel.
|
// AsyncFilter creates an iterator which checks nodes in parallel.
|
||||||
|
// The 'check' function is called on multiple goroutines to filter each node
|
||||||
|
// from the upstream iterator. When check returns nil, the node will be skipped.
|
||||||
|
// It can also return a new node to be returned by the iterator instead of the .
|
||||||
func AsyncFilter(it Iterator, check AsyncFilterFunc, workers int) Iterator {
|
func AsyncFilter(it Iterator, check AsyncFilterFunc, workers int) Iterator {
|
||||||
f := &asyncFilterIter{
|
f := &asyncFilterIter{
|
||||||
it: ensureSourceIter(it),
|
it: ensureSourceIter(it),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue