core

package
v0.8.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 29, 2024 License: Apache-2.0, MIT Imports: 18 Imported by: 0

Documentation

Index

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

func NewAssigner(ctx context.Context, cfg config.Assignment, p2pHost host.Host) (*Assigner, error)

NewAssigner created a new assigner core that handles announce messages and assigns them to the indexers configured in the indexer pool.

func (*Assigner) Allowed

func (a *Assigner) Allowed(peerID peer.ID) bool

Allowed determines whether the assigner is accepting announce messages from the specified publisher.

func (*Assigner) Announce

func (a *Assigner) Announce(ctx context.Context, nextCid cid.Cid, addrInfo peer.AddrInfo) error

Announce sends a direct announce message to the assigner. This publisher in the message will be assigned to one or more indexers.

func (*Assigner) Assigned

func (a *Assigner) Assigned(peerID peer.ID) []int

Assigned returns the indexers that the given peer is assigned to.

func (*Assigner) Close

func (a *Assigner) Close() error

Close shuts down the Subscriber.

func (*Assigner) IndexerAssignedCounts

func (a *Assigner) IndexerAssignedCounts() []int

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) InitDone added in v0.5.4

func (a *Assigner) InitDone() bool

func (*Assigner) OnAssignment

func (a *Assigner) OnAssignment(pubID peer.ID) (<-chan int, context.CancelFunc)

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.

func (*Assigner) PollNow added in v0.5.5

func (a *Assigner) PollNow()

func (*Assigner) Presets

func (a *Assigner) Presets(peerID peer.ID) []int

Presets returns preset indexer assignments for the given peer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL