loadbalancer

package
v0.0.0-...-181f41f Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorNoTargetsAvailable = errors.New("no targets available")
)

Functions

This section is empty.

Types

type LlamaCppPickedTarget

type LlamaCppPickedTarget struct {
	Element        *list.Element
	LlamaCppTarget *LlamaCppTarget
}

type LlamaCppTarget

type LlamaCppTarget struct {
	LastUpdate                  time.Time
	LlamaCppTargetConfiguration *LlamaCppTargetConfiguration
	LlamaCppClient              *llamacpp.LlamaCppClient
	LlamaCppHealthStatus        *llamacpp.LlamaCppHealthStatus
	RemainingTicksUntilRemoved  int
	TotalUpdates                int
}

func (*LlamaCppTarget) HasLessSlotsThan

func (self *LlamaCppTarget) HasLessSlotsThan(other *LlamaCppTarget) bool

type LlamaCppTargetConfiguration

type LlamaCppTargetConfiguration struct {
	LlamaCppConfiguration *llamacpp.LlamaCppConfiguration `json:"llama_cpp_configuration"`
}

func (*LlamaCppTargetConfiguration) String

func (self *LlamaCppTargetConfiguration) String() string

type LoadBalancer

type LoadBalancer struct {
	HttpClient                   *http.Client
	LoadBalancerTargetCollection *LoadBalancerTargetCollection
	Logger                       hclog.Logger
}

func NewLoadBalancer

func NewLoadBalancer(
	httpClient *http.Client,
	logger hclog.Logger,
) *LoadBalancer

func (*LoadBalancer) Balance

func (self *LoadBalancer) Balance(request *LoadBalancerRequest) (*url.URL, error)

func (*LoadBalancer) GetLlamaCppTargetForRequest

func (self *LoadBalancer) GetLlamaCppTargetForRequest(request *LoadBalancerRequest) *LlamaCppTarget

func (*LoadBalancer) GetStatus

func (self *LoadBalancer) GetStatus() *LoadBalancerStatus

func (*LoadBalancer) OnTick

func (self *LoadBalancer) OnTick()

func (*LoadBalancer) RegisterOrUpdateTarget

func (self *LoadBalancer) RegisterOrUpdateTarget(
	serverEventsChannel chan<- goroutine.ResultMessage,
	targetConfiguration *LlamaCppTargetConfiguration,
	llamaCppHealthStatus *llamacpp.LlamaCppHealthStatus,
)

type LoadBalancerRequest

type LoadBalancerRequest struct {
	HttpRequest *http.Request
}

func (*LoadBalancerRequest) IsSlottable

func (self *LoadBalancerRequest) IsSlottable() bool

type LoadBalancerStatus

type LoadBalancerStatus struct {
	RegisteredTargets int `json:"registred_targets"`
}

type LoadBalancerTargetCollection

type LoadBalancerTargetCollection struct {
	Targets *list.List
	// contains filtered or unexported fields
}

func (*LoadBalancerTargetCollection) FixTargetOrder

func (self *LoadBalancerTargetCollection) FixTargetOrder(target *LlamaCppTarget)

func (*LoadBalancerTargetCollection) GetHeadTarget

func (self *LoadBalancerTargetCollection) GetHeadTarget() *LlamaCppPickedTarget

func (*LoadBalancerTargetCollection) GetTargetByConfiguration

func (self *LoadBalancerTargetCollection) GetTargetByConfiguration(
	targetConfiguration *LlamaCppTargetConfiguration,
) *LlamaCppTarget

func (*LoadBalancerTargetCollection) GetTargetWithFreeSlotsForBalancing

func (self *LoadBalancerTargetCollection) GetTargetWithFreeSlotsForBalancing() *LlamaCppPickedTarget

func (*LoadBalancerTargetCollection) Len

func (self *LoadBalancerTargetCollection) Len() int

func (*LoadBalancerTargetCollection) RegisterTarget

func (self *LoadBalancerTargetCollection) RegisterTarget(llamaCppTarget *LlamaCppTarget)

func (*LoadBalancerTargetCollection) RemoveTarget

func (self *LoadBalancerTargetCollection) RemoveTarget(llamaCppTarget *LlamaCppTarget)

type ReverseProxyServer

type ReverseProxyServer struct {
	LoadBalancer              *LoadBalancer
	Logger                    hclog.Logger
	ReverseProxyConfiguration *reverseproxy.ReverseProxyConfiguration
}

func (*ReverseProxyServer) Serve

func (self *ReverseProxyServer) Serve(serverEventsChannel chan<- goroutine.ResultMessage)

Jump to

Keyboard shortcuts

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