Documentation
¶
Index ¶
- type Budget
- func (cb *Budget) AcquireConnection(providerID string) error
- func (cb *Budget) CanAcquireConnection(providerID string) bool
- func (cb *Budget) CanMigrateConnection(providerID string) bool
- func (cb *Budget) GetAvailableSlots(providerID string) int
- func (cb *Budget) GetProviderStats() map[string]Stats
- func (cb *Budget) GetProviderUsage(providerID string) (current, limit int, exists bool)
- func (cb *Budget) GetTotalBudget() (totalUsed, totalLimit int)
- func (cb *Budget) ReleaseConnection(providerID string)
- func (cb *Budget) RemoveProvider(providerID string)
- func (cb *Budget) SetProviderLimit(providerID string, maxConnections int)
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Budget ¶
type Budget struct {
// contains filtered or unexported fields
}
Budget manages connection limits per provider to prevent exceeding NNTP server quotas
func (*Budget) AcquireConnection ¶
AcquireConnection attempts to acquire a connection slot for the provider
func (*Budget) CanAcquireConnection ¶
CanAcquireConnection checks if a new connection can be acquired for the provider
func (*Budget) CanMigrateConnection ¶
CanMigrateConnection checks if we can create a new connection during migration This considers both current usage and temporary migration overhead
func (*Budget) GetAvailableSlots ¶
GetAvailableSlots returns how many more connections can be created for the provider
func (*Budget) GetProviderStats ¶
GetProviderStats returns detailed statistics for all providers
func (*Budget) GetProviderUsage ¶
GetProviderUsage returns current usage for a provider
func (*Budget) GetTotalBudget ¶
GetTotalBudget returns the total connection budget across all providers
func (*Budget) ReleaseConnection ¶
ReleaseConnection releases a connection slot for the provider
func (*Budget) RemoveProvider ¶
RemoveProvider removes a provider from budget tracking
func (*Budget) SetProviderLimit ¶
SetProviderLimit sets the maximum connections allowed for a provider
type Stats ¶
type Stats struct {
ProviderID string `json:"provider_id"`
CurrentConnections int `json:"current_connections"`
MaxConnections int `json:"max_connections"`
AvailableSlots int `json:"available_slots"`
UtilizationPercent float64 `json:"utilization_percent"`
}
Stats contains statistics for a provider's connection budget