libkeypool

package
v1.0.0-rc.8 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidPolicy

func ValidPolicy(name Policy) bool

Types

type KeyPool

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

func NewKeyPool

func NewKeyPool(keys []string, policy Policy, breaker *ProviderCircuitBreaker) (*KeyPool, error)

func (*KeyPool) Keys

func (p *KeyPool) Keys() []string

func (*KeyPool) Policy

func (p *KeyPool) Policy() Policy

func (*KeyPool) SelectKey

func (p *KeyPool) SelectKey(identity string, now time.Time) string

type Policy

type Policy string
const (
	PolicyStickyClient Policy = "sticky_client"
	PolicyRoundRobin   Policy = "round_robin"
)

func Policies

func Policies() []Policy

type ProviderCircuitBreaker

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

func NewProviderCircuitBreaker

func NewProviderCircuitBreaker(threshold int, cooldown time.Duration) (*ProviderCircuitBreaker, error)

func (*ProviderCircuitBreaker) AllowAt

func (cb *ProviderCircuitBreaker) AllowAt(identity string, now time.Time) bool

func (*ProviderCircuitBreaker) MarkFailureAt

func (cb *ProviderCircuitBreaker) MarkFailureAt(identity string, now time.Time) bool

func (*ProviderCircuitBreaker) MarkSuccess

func (cb *ProviderCircuitBreaker) MarkSuccess(identity string)

func (*ProviderCircuitBreaker) OpenAt

func (cb *ProviderCircuitBreaker) OpenAt(identity string, now time.Time)

func (*ProviderCircuitBreaker) State

func (cb *ProviderCircuitBreaker) State(identity string, now time.Time) string

Jump to

Keyboard shortcuts

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