github.com/MetalBlockchain/metalgo@v1.11.9/network/p2p/node_sampler.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package p2p
     5  
     6  import (
     7  	"context"
     8  
     9  	"github.com/MetalBlockchain/metalgo/ids"
    10  )
    11  
    12  // NodeSampler samples nodes in network
    13  type NodeSampler interface {
    14  	// Sample returns at most [limit] nodes. This may return fewer nodes if
    15  	// fewer than [limit] are available.
    16  	Sample(ctx context.Context, limit int) []ids.NodeID
    17  }