pool

package
v0.0.1-alpha5 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterConfigHandlers

func RegisterConfigHandlers(ctx context.Context, configManager *config.Manager, poolManager Manager)

RegisterConfigHandlers registers handlers for pool-related configuration changes

Types

type Manager

type Manager interface {
	// GetPool returns the current connection pool or error if not available
	GetPool() (nntppool.UsenetConnectionPool, error)

	// SetProviders creates/recreates the pool with new providers
	SetProviders(providers []nntppool.UsenetProviderConfig) error

	// ClearPool shuts down and removes the current pool
	ClearPool() error

	// HasPool returns true if a pool is currently available
	HasPool() bool

	// GetMetrics returns the current pool metrics with calculated speeds
	GetMetrics() (MetricsSnapshot, error)
}

Manager provides centralized NNTP connection pool management

func NewManager

func NewManager(ctx context.Context) Manager

NewManager creates a new pool manager

type MetricsSnapshot

type MetricsSnapshot struct {
	BytesDownloaded          int64            `json:"bytes_downloaded"`
	BytesUploaded            int64            `json:"bytes_uploaded"`
	ArticlesDownloaded       int64            `json:"articles_downloaded"`
	ArticlesPosted           int64            `json:"articles_posted"`
	TotalErrors              int64            `json:"total_errors"`
	ProviderErrors           map[string]int64 `json:"provider_errors"`
	DownloadSpeedBytesPerSec float64          `json:"download_speed_bytes_per_sec"`
	UploadSpeedBytesPerSec   float64          `json:"upload_speed_bytes_per_sec"`
	Timestamp                time.Time        `json:"timestamp"`
}

MetricsSnapshot represents pool metrics at a point in time with calculated values

type MetricsTracker

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

MetricsTracker tracks pool metrics over time and calculates rates

func NewMetricsTracker

func NewMetricsTracker(pool nntppool.UsenetConnectionPool) *MetricsTracker

NewMetricsTracker creates a new metrics tracker

func (*MetricsTracker) GetSnapshot

func (mt *MetricsTracker) GetSnapshot() MetricsSnapshot

GetSnapshot returns the current metrics with calculated speeds

func (*MetricsTracker) Start

func (mt *MetricsTracker) Start(ctx context.Context)

Start begins collecting metrics samples

func (*MetricsTracker) Stop

func (mt *MetricsTracker) Stop()

Stop stops collecting metrics samples

Jump to

Keyboard shortcuts

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