internal

package
v0.33.21-fix-get-highe... Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RPCSentTracker

type RPCSentTracker struct {
	component.Component
	// contains filtered or unexported fields
}

RPCSentTracker tracks RPC messages and the size of the last largest iHave rpc control message sent.

func NewRPCSentTracker

func NewRPCSentTracker(config *RPCSentTrackerConfig) *RPCSentTracker

NewRPCSentTracker returns a new *NewRPCSentTracker.

func (*RPCSentTracker) LastHighestIHaveRPCSize

func (t *RPCSentTracker) LastHighestIHaveRPCSize() int64

LastHighestIHaveRPCSize returns the last highest size of iHaves sent in a rpc. Returns: - int64: the last highest size.

func (*RPCSentTracker) Track

func (t *RPCSentTracker) Track(rpc *pubsub.RPC) error

Track submits the control message to the worker queue for async tracking. Args: - *pubsub.RPC: the rpc sent. All errors returned from this function can be considered benign.

func (*RPCSentTracker) WasIHaveRPCSent

func (t *RPCSentTracker) WasIHaveRPCSent(messageID string) bool

WasIHaveRPCSent checks if an iHave control message with the provided message ID was sent. Args: - messageID: the message ID of the iHave RPC. Returns: - bool: true if the iHave rpc with the provided message ID was sent.

type RPCSentTrackerConfig

type RPCSentTrackerConfig struct {
	Logger zerolog.Logger
	//RPCSentCacheSize size of the *rpcSentCache cache.
	RPCSentCacheSize uint32
	// RPCSentCacheCollector metrics collector for the *rpcSentCache cache.
	RPCSentCacheCollector module.HeroCacheMetrics
	// WorkerQueueCacheCollector metrics factory for the worker pool.
	WorkerQueueCacheCollector module.HeroCacheMetrics
	// WorkerQueueCacheSize the worker pool herostore cache size.
	WorkerQueueCacheSize uint32
	// NumOfWorkers number of workers in the worker pool.
	NumOfWorkers int
	// LastHighestIhavesSentResetInterval the refresh interval to reset the lastHighestIHaveRPCSize.
	LastHighestIhavesSentResetInterval time.Duration
}

RPCSentTrackerConfig configuration for the RPCSentTracker.

Jump to

Keyboard shortcuts

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