Documentation ¶
Index ¶
- Variables
- func InitLogger()
- type Backend
- type BackendRegistry
- func (r *BackendRegistry) AddBackendToRegistry(backend domain.Backend)
- func (r *BackendRegistry) GetBackendById(backendId uint64) (domain.Backend, bool)
- func (r *BackendRegistry) Subscribe(backendId uint64) <-chan domain.BackendStatus
- func (r *BackendRegistry) UpdateHealth(status domain.BackendStatus) error
- type Config
- type HealthChecker
- type LoadBalancer
- type RateLimiter
- type Route
Constants ¶
This section is empty.
Variables ¶
View Source
var Logger *zap.Logger
Functions ¶
func InitLogger ¶
func InitLogger()
Types ¶
type BackendRegistry ¶
type BackendRegistry struct {
// contains filtered or unexported fields
}
func (*BackendRegistry) AddBackendToRegistry ¶
func (r *BackendRegistry) AddBackendToRegistry(backend domain.Backend)
func (*BackendRegistry) GetBackendById ¶
func (r *BackendRegistry) GetBackendById(backendId uint64) (domain.Backend, bool)
Get the backend with id
func (*BackendRegistry) Subscribe ¶
func (r *BackendRegistry) Subscribe(backendId uint64) <-chan domain.BackendStatus
Method for load balancers to subscribe to specific backend health updates
func (*BackendRegistry) UpdateHealth ¶
func (r *BackendRegistry) UpdateHealth(status domain.BackendStatus) error
Method to update the health status of a backend
type Config ¶
type Config struct { Routes []Route `mapstructure:"routes"` RateLimiter RateLimiter `mapstructure:"rateLimiter"` LoadBalancer LoadBalancer `mapstructure:"loadbalancer"` HealthChecker HealthChecker `mapstructure:"healthchecker"` }
func LoadConfig ¶
type HealthChecker ¶
type HealthChecker struct { HealthyServerFrequency string `mapstructure:"healthyserver_freq"` UnhealthyServerFrequency string `mapstructure:"unhealthyserver_freq"` }
Healthchecker holds the health checker info
type LoadBalancer ¶
type LoadBalancer struct { Address string `mapstructure:"address"` CertFile string `mapstructure:"cert_file"` KeyFile string `mapstructure:"key_file"` }
LoadBalancer holds the load balancer address
type RateLimiter ¶
type RateLimiter struct { Type string `mapstructure:"type"` // e.g. "none", "sliding_window", "token_bucket" Limit int `mapstructure:"limit"` // request limit for the time window/bucket Window string `mapstructure:"window"` // only for window-based rate limiters }
RateLimiter defines the structure for rate limiter configuration
Click to show internal directories.
Click to hide internal directories.