Documentation ¶
Index ¶
- type List
- func (pl *List) Choose(ctx context.Context, req *transport.Request) (peer.Peer, func(error), error)
- func (pl *List) Introspect() introspection.ChooserStatus
- func (pl *List) IsRunning() bool
- func (pl *List) NotifyStatusChanged(pid peer.Identifier)
- func (pl *List) Start() error
- func (pl *List) Stop() error
- func (pl *List) Update(updates peer.ListUpdates) error
- type PeerRing
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type List ¶
type List struct {
// contains filtered or unexported fields
}
List is a PeerList which rotates which peers are to be selected in a circle
func (*List) Introspect ¶
func (pl *List) Introspect() introspection.ChooserStatus
Introspect returns a ChooserStatus with a summary of the Peers.
func (*List) NotifyStatusChanged ¶
func (pl *List) NotifyStatusChanged(pid peer.Identifier)
NotifyStatusChanged when the peer's status changes
type PeerRing ¶
type PeerRing struct {
// contains filtered or unexported fields
}
PeerRing provides a safe way to interact (Add/Remove/Get) with a potentially changing list of peer objects PeerRing is NOT Thread-safe, make sure to only call PeerRing functions with a lock
func NewPeerRing ¶
NewPeerRing creates a new PeerRing with an initial capacity
func (*PeerRing) Add ¶
Add a peer.Peer to the end of the PeerRing, if the ring is empty it initializes the nextNode marker
func (*PeerRing) GetPeer ¶
func (pr *PeerRing) GetPeer(pid peer.Identifier) peer.Peer
GetPeer returns the Peer from the Ring or Nil
func (*PeerRing) Next ¶
Next returns the next peer in the ring, or nil if there is no peer in the ring after it has the next peer, it increments the nextPeer marker in the ring