github.com/keltia/go-ipfs@v0.3.8-0.20150909044612-210793031c63/p2p/peer/queue/interface.go (about)

     1  package queue
     2  
     3  import peer "github.com/ipfs/go-ipfs/p2p/peer"
     4  
     5  // PeerQueue maintains a set of peers ordered according to a metric.
     6  // Implementations of PeerQueue could order peers based on distances along
     7  // a KeySpace, latency measurements, trustworthiness, reputation, etc.
     8  type PeerQueue interface {
     9  
    10  	// Len returns the number of items in PeerQueue
    11  	Len() int
    12  
    13  	// Enqueue adds this node to the queue.
    14  	Enqueue(peer.ID)
    15  
    16  	// Dequeue retrieves the highest (smallest int) priority node
    17  	Dequeue() peer.ID
    18  }