Documentation
¶
Index ¶
- func NormalizeStrategy(strategy string) string
- type Balancer
- type ClientStickyBalancer
- func (sb *ClientStickyBalancer) AddModel(model *models.ModelConfig)
- func (sb *ClientStickyBalancer) Models() []*models.ModelConfig
- func (sb *ClientStickyBalancer) Next(ctx SelectionContext) *models.ModelConfig
- func (sb *ClientStickyBalancer) RemoveModel(modelName string)
- func (sb *ClientStickyBalancer) Size() int
- type LatencyBalancer
- func (lb *LatencyBalancer) AddModel(model *models.ModelConfig)
- func (lb *LatencyBalancer) Models() []*models.ModelConfig
- func (lb *LatencyBalancer) Next(ctx SelectionContext) *models.ModelConfig
- func (lb *LatencyBalancer) Observe(model *models.ModelConfig, latency time.Duration, success bool)
- func (lb *LatencyBalancer) RemoveModel(modelName string)
- func (lb *LatencyBalancer) Size() int
- type Observer
- type RoundRobinBalancer
- func (rb *RoundRobinBalancer) AddModel(model *models.ModelConfig)
- func (rb *RoundRobinBalancer) Models() []*models.ModelConfig
- func (rb *RoundRobinBalancer) Next(ctx SelectionContext) *models.ModelConfig
- func (rb *RoundRobinBalancer) RemoveModel(modelName string)
- func (rb *RoundRobinBalancer) Size() int
- type SelectionContext
- type WeightedBalancer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeStrategy ¶
Types ¶
type Balancer ¶
type Balancer interface {
Next(ctx SelectionContext) *models.ModelConfig
Models() []*models.ModelConfig
AddModel(model *models.ModelConfig)
RemoveModel(modelName string)
Size() int
}
Balancer chooses one upstream model endpoint for each request.
type ClientStickyBalancer ¶
type ClientStickyBalancer struct {
// contains filtered or unexported fields
}
func NewClientStickyBalancer ¶
func NewClientStickyBalancer() *ClientStickyBalancer
func (*ClientStickyBalancer) AddModel ¶
func (sb *ClientStickyBalancer) AddModel(model *models.ModelConfig)
func (*ClientStickyBalancer) Models ¶
func (sb *ClientStickyBalancer) Models() []*models.ModelConfig
func (*ClientStickyBalancer) Next ¶
func (sb *ClientStickyBalancer) Next(ctx SelectionContext) *models.ModelConfig
func (*ClientStickyBalancer) RemoveModel ¶
func (sb *ClientStickyBalancer) RemoveModel(modelName string)
func (*ClientStickyBalancer) Size ¶
func (sb *ClientStickyBalancer) Size() int
type LatencyBalancer ¶
type LatencyBalancer struct {
// contains filtered or unexported fields
}
func NewLatencyBalancer ¶
func NewLatencyBalancer() *LatencyBalancer
func (*LatencyBalancer) AddModel ¶
func (lb *LatencyBalancer) AddModel(model *models.ModelConfig)
func (*LatencyBalancer) Models ¶
func (lb *LatencyBalancer) Models() []*models.ModelConfig
func (*LatencyBalancer) Next ¶
func (lb *LatencyBalancer) Next(ctx SelectionContext) *models.ModelConfig
func (*LatencyBalancer) Observe ¶
func (lb *LatencyBalancer) Observe(model *models.ModelConfig, latency time.Duration, success bool)
func (*LatencyBalancer) RemoveModel ¶
func (lb *LatencyBalancer) RemoveModel(modelName string)
func (*LatencyBalancer) Size ¶
func (lb *LatencyBalancer) Size() int
type Observer ¶
type Observer interface {
Observe(model *models.ModelConfig, latency time.Duration, success bool)
}
type RoundRobinBalancer ¶
type RoundRobinBalancer struct {
// contains filtered or unexported fields
}
RoundRobinBalancer picks endpoints in order.
func NewRoundRobinBalancer ¶
func NewRoundRobinBalancer() *RoundRobinBalancer
func (*RoundRobinBalancer) AddModel ¶
func (rb *RoundRobinBalancer) AddModel(model *models.ModelConfig)
func (*RoundRobinBalancer) Models ¶
func (rb *RoundRobinBalancer) Models() []*models.ModelConfig
func (*RoundRobinBalancer) Next ¶
func (rb *RoundRobinBalancer) Next(ctx SelectionContext) *models.ModelConfig
func (*RoundRobinBalancer) RemoveModel ¶
func (rb *RoundRobinBalancer) RemoveModel(modelName string)
func (*RoundRobinBalancer) Size ¶
func (rb *RoundRobinBalancer) Size() int
type SelectionContext ¶
type WeightedBalancer ¶
type WeightedBalancer struct {
// contains filtered or unexported fields
}
WeightedBalancer picks endpoints by configured weight.
func NewWeightedBalancer ¶
func NewWeightedBalancer() *WeightedBalancer
func (*WeightedBalancer) AddModel ¶
func (wb *WeightedBalancer) AddModel(model *models.ModelConfig)
func (*WeightedBalancer) Models ¶
func (wb *WeightedBalancer) Models() []*models.ModelConfig
func (*WeightedBalancer) Next ¶
func (wb *WeightedBalancer) Next(ctx SelectionContext) *models.ModelConfig
func (*WeightedBalancer) RemoveModel ¶
func (wb *WeightedBalancer) RemoveModel(modelName string)
func (*WeightedBalancer) Size ¶
func (wb *WeightedBalancer) Size() int
Click to show internal directories.
Click to hide internal directories.