Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RPCSentTracker ¶
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.