Documentation ¶
Index ¶
- type Assigner
- func (a *Assigner) Allowed(peerID peer.ID) bool
- func (a *Assigner) Announce(ctx context.Context, nextCid cid.Cid, addrInfo peer.AddrInfo) error
- func (a *Assigner) Assigned(peerID peer.ID) []int
- func (a *Assigner) Close() error
- func (a *Assigner) IndexerAssignedCounts() []int
- func (a *Assigner) InitDone() bool
- func (a *Assigner) OnAssignment(pubID peer.ID) (<-chan int, context.CancelFunc)
- func (a *Assigner) PollNow()
- func (a *Assigner) Presets(peerID peer.ID) []int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assigner ¶
type Assigner struct {
// contains filtered or unexported fields
}
Assigner is responsible for assigning publishers to indexers.
func NewAssigner ¶
NewAssigner created a new assigner core that handles announce messages and assigns them to the indexers configured in the indexer pool.
func (*Assigner) Allowed ¶
Allowed determines whether the assigner is accepting announce messages from the specified publisher.
func (*Assigner) Announce ¶
Announce sends a direct announce message to the assigner. This publisher in the message will be assigned to one or more indexers.
func (*Assigner) IndexerAssignedCounts ¶
IndexerAssignedCounts returns a slice of counts, one for each indexer in the pool. Each count is the number of publishers assigned to the indexer. The position of each count corresponds to the position of the indexer in the pool.
func (*Assigner) OnAssignment ¶
OnAssignment returns a channel that reports the number of the indexer that the specified peer ID was assigned to, each time that peer is assigned to an indexer. The channel is closed when there are no more indexers required to assign the peer to. Multiple calls using the same pubID return the same channel.
The notification channel is closed when assignment is complete. A new channel will need to be created to receive notification of future assignments/handoff.