routing

package
v1.2.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrMultipleNodesFound added in v1.1.4

type ErrMultipleNodesFound struct {
	// contains filtered or unexported fields
}

ErrMultipleNodesFound is returned when multiple nodes were found for a requested node id prefix

func NewErrMultipleNodesFound added in v1.1.4

func NewErrMultipleNodesFound(nodeIDPrefix string, matchingNodeIDs []string) ErrMultipleNodesFound

func (ErrMultipleNodesFound) Error added in v1.1.4

func (e ErrMultipleNodesFound) Error() string

type ErrNodeNotFound added in v1.0.4

type ErrNodeNotFound struct {
	// contains filtered or unexported fields
}

ErrNodeNotFound is returned when nodeInfo was not found for a requested node id

func NewErrNodeNotFound added in v1.0.4

func NewErrNodeNotFound(nodeID string) ErrNodeNotFound

func (ErrNodeNotFound) Error added in v1.0.4

func (e ErrNodeNotFound) Error() string

type NodeInfoProvider

type NodeInfoProvider struct {
	// contains filtered or unexported fields
}

func NewNodeInfoProvider

func NewNodeInfoProvider(params NodeInfoProviderParams) *NodeInfoProvider

func (*NodeInfoProvider) GetNodeInfo

func (n *NodeInfoProvider) GetNodeInfo(ctx context.Context) models.NodeInfo

func (*NodeInfoProvider) RegisterNodeInfoDecorator added in v1.2.1

func (n *NodeInfoProvider) RegisterNodeInfoDecorator(decorator models.NodeInfoDecorator)

RegisterNodeInfoDecorator registers a node info decorator with the node info provider.

type NodeInfoProviderParams

type NodeInfoProviderParams struct {
	NodeID          string
	LabelsProvider  models.LabelsProvider
	BacalhauVersion models.BuildVersionInfo
}

type NodeInfoPublisher

type NodeInfoPublisher struct {
	// contains filtered or unexported fields
}

func NewNodeInfoPublisher

func NewNodeInfoPublisher(params NodeInfoPublisherParams) *NodeInfoPublisher

func (*NodeInfoPublisher) Publish

func (n *NodeInfoPublisher) Publish(ctx context.Context) error

Publish publishes the node info to the pubsub topic manually and won't wait for the background task to do it.

func (*NodeInfoPublisher) Stop

func (n *NodeInfoPublisher) Stop(ctx context.Context)

Stop stops the background task that publishes the node info periodically

type NodeInfoPublisherIntervalConfig added in v1.0.4

type NodeInfoPublisherIntervalConfig struct {
	// Interval is the interval between publishing node info
	Interval time.Duration

	// During node startup, we can publish node info more frequently to speed up the discovery process.
	// EagerPublishInterval is the interval between publishing node info during startup.
	EagerPublishInterval time.Duration
	// EagerPublishDuration is the duration of the eager publish period. After this period, the node will publish node info
	// with the standard interval.
	EagerPublishDuration time.Duration
}

func (NodeInfoPublisherIntervalConfig) IsEagerPublishEnabled added in v1.0.4

func (n NodeInfoPublisherIntervalConfig) IsEagerPublishEnabled() bool

IsEagerPublishEnabled returns true if eager publish is enabled

func (NodeInfoPublisherIntervalConfig) IsZero added in v1.0.4

IsZero returns true if the interval config is zero

type NodeInfoPublisherParams

type NodeInfoPublisherParams struct {
	PubSub           pubsub.Publisher[models.NodeInfo]
	NodeInfoProvider models.NodeInfoProvider
	IntervalConfig   NodeInfoPublisherIntervalConfig
}

type NodeInfoStore

type NodeInfoStore interface {
	libp2p_routing.PeerRouting
	// Add adds a node info to the repo.
	Add(ctx context.Context, nodeInfo models.NodeInfo) error
	// Get returns the node info for the given node ID.
	Get(ctx context.Context, nodeID string) (models.NodeInfo, error)
	// GetByPrefix returns the node info for the given node ID.
	// Supports both full and short node IDs.
	GetByPrefix(ctx context.Context, prefix string) (models.NodeInfo, error)
	// List returns a list of nodes
	List(ctx context.Context) ([]models.NodeInfo, error)
	// Delete deletes a node info from the repo.
	Delete(ctx context.Context, nodeID string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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