2015-10-01 06:42:55 +08:00
|
|
|
package queue
|
|
|
|
|
2017-02-04 02:32:21 +08:00
|
|
|
import peer "gx/ipfs/QmbKtZxyDqUJp7Ad8tGr5nrLqoi9nfgqFxcNbmLJbfaHPe/go-libp2p-peer"
|
2015-10-01 06:42:55 +08:00
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|