mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2024-12-27 23:40:16 +08:00
0b5b389640
* dep: switch to core Specifically, remove go-libp2p-{crypto,peer} deps. * catch a few more usages of deprecated packages.
19 lines
511 B
Go
19 lines
511 B
Go
package queue
|
|
|
|
import "github.com/libp2p/go-libp2p-core/peer"
|
|
|
|
// PeerQueue maintains a set of peers ordered according to a metric.
|
|
// Implementations of PeerQueue could order peers based on distances along
|
|
// a KeySpace, latency measurements, trustworthiness, reputation, etc.
|
|
type PeerQueue interface {
|
|
|
|
// Len returns the number of items in PeerQueue
|
|
Len() int
|
|
|
|
// Enqueue adds this node to the queue.
|
|
Enqueue(peer.ID)
|
|
|
|
// Dequeue retrieves the highest (smallest int) priority node
|
|
Dequeue() peer.ID
|
|
}
|