MCPcopy Create free account

hub / github.com/appleboy/loadbalancer-algorithms / functions

Functions64 in github.com/appleboy/loadbalancer-algorithms

↓ 40 callersFunctionNewProxy
NewProxy creates a new instance of Proxy with the specified address.
proxy/proxy.go:20
↓ 38 callersMethodNextServer
()
weighted/weighted.go:20
↓ 19 callersMethodGetName
GetName returns the name of the proxy.
proxy/proxy.go:55
↓ 12 callersFunctionNew
New creates a new instance of the round-robin load balancer with the specified servers. If no servers are provided, it creates an empty load balancer
roundrobin/roundrobin.go:151
↓ 7 callersMethodServers
()
weighted/weighted.go:23
↓ 4 callersMethodAddServer
(*url.URL, int)
weighted/weighted.go:21
↓ 4 callersMethodAddServers
AddServers adds one or more servers to the load balancer.
roundrobin/roundrobin.go:20
↓ 4 callersFunctionNew
()
weighted/weighted.go:151
↓ 3 callersMethodRemoveAll
()
weighted/weighted.go:24
↓ 2 callersMethodIsAvailable
IsAvailable returns whether the proxy origin was successfully connected at the last check time.
proxy/health/health.go:132
↓ 2 callersFunctionNew
(origin *url.URL, opts ...Opts)
proxy/health/health.go:27
↓ 2 callersMethodRemoveServer
(*url.URL)
weighted/weighted.go:22
↓ 2 callersMethodRemoveServers
RemoveServers removes one or more servers from the load balancer.
roundrobin/roundrobin.go:23
↓ 2 callersMethodcheckHealth
checkHealth checks the health of the proxy origin.
proxy/health/health.go:65
↓ 1 callersMethodServeHTTP
ServeHTTP handles the incoming HTTP request and forwards it to the underlying proxy server. It increments the load counter by 1 before forwarding the
proxy/proxy.go:43
↓ 1 callersFunctionWithCheck
WithCheck sets the health check function for the proxy.
proxy/health/options.go:6
↓ 1 callersFunctionWithPeriodSeconds
WithPeriodSeconds sets the period for the health check.
proxy/health/options.go:13
↓ 1 callersFunctioncheckURL
(a, b *url.URL)
weighted/weighted.go:162
↓ 1 callersFunctiondefaultDNSCheck
defaultDNSCheck is a default health check function that checks if the DNS resolution to the address is successful.
proxy/health/health.go:180
↓ 1 callersFunctiondefaultHTTPCheck
defaultHTTPCheck is a default health check function that checks if the HTTP connection to the address is successful.
proxy/health/health.go:140
↓ 1 callersFunctiondefaultTCPCheck
defaultTCPCheck is a default health check function that checks if the TCP connection to the address is successful.
proxy/health/health.go:170
↓ 1 callersFunctiongcd
(a, b int)
weighted/weighted.go:166
↓ 1 callersMethodrun
()
proxy/health/health.go:92
↓ 1 callersMethodstop
stop stops the currently rinning check func.
proxy/health/health.go:122
MethodAddServer
(url *url.URL, weight int)
weighted/weighted.go:89
MethodAddServers
AddServers adds the given servers to the roundrobin load balancer. It takes a variadic parameter of type *proxy.Proxy, representing the servers to be
roundrobin/roundrobin.go:65
FunctionBenchmarkAddServers
(b *testing.B)
roundrobin/roundrobin_test.go:156
FunctionBenchmarkNext
(b *testing.B)
roundrobin/roundrobin_test.go:124
FunctionBenchmarkNext
(b *testing.B)
weighted/weighted_test.go:83
FunctionBenchmarkNextParallel
(b *testing.B)
roundrobin/roundrobin_test.go:139
FunctionBenchmarkRemoveServers
(b *testing.B)
roundrobin/roundrobin_test.go:172
FunctionBenchmarkServers
(b *testing.B)
roundrobin/roundrobin_test.go:196
FunctionExampleRoundRobin
()
roundrobin/roundrobin_test.go:211
FunctionExampleRoundRobin
()
weighted/weighted_test.go:55
MethodGetLoading
GetLoading returns the current loading of the proxy.
proxy/proxy.go:50
MethodIsAvailable
IsAvailable returns whether the proxy origin was successfully connected at the last check time.
proxy/proxy.go:60
MethodNextServer
NextServer returns the next server in the rotation.
roundrobin/roundrobin.go:17
MethodNextServer
NextServer returns the next server in the round-robin algorithm. If there are no servers available, it returns nil. The server selection is based on a
roundrobin/roundrobin.go:47
MethodNextServer
while (true) { i = (i + 1) mod n; if (i == 0) { cw = cw - gcd(S); if (cw <= 0) { cw = max(S); if (cw == 0)
weighted/weighted.go:62
MethodRemoveAll
RemoveAll removes all servers from the load balancer.
roundrobin/roundrobin.go:29
MethodRemoveAll
RemoveAll removes all servers from the roundrobin load balancer. It resets both the server list and the rotation counter atomically.
roundrobin/roundrobin.go:142
MethodRemoveAll
()
weighted/weighted.go:136
MethodRemoveServer
(url *url.URL)
weighted/weighted.go:112
MethodRemoveServers
RemoveServers removes the specified servers from the roundrobin load balancer. It takes a variadic parameter 'names' which represents the names of the
roundrobin/roundrobin.go:81
MethodReset
Reset resets all current weights.
weighted/weighted.go:26
MethodReset
Reset resets all current weights.
weighted/weighted.go:146
MethodServers
Servers returns a list of all servers in the load balancer.
roundrobin/roundrobin.go:26
MethodServers
Servers returns a copy of all servers in the roundrobin load balancer. It returns a new slice to prevent external modifications to the internal state.
roundrobin/roundrobin.go:130
MethodServers
()
weighted/weighted.go:125
FunctionTestAddServers
(t *testing.T)
roundrobin/roundrobin_test.go:29
FunctionTestDefaultDNSCheck
(t *testing.T)
proxy/health/health_test.go:135
FunctionTestDefaultHTTPCheck
(t *testing.T)
proxy/health/health_test.go:81
FunctionTestDefaultTCPCheck
(t *testing.T)
proxy/health/health_test.go:48
FunctionTestNextServer
(t *testing.T)
roundrobin/roundrobin_test.go:11
FunctionTestProxyHealth_IsAvailable
(t *testing.T)
proxy/health/health_test.go:12
FunctionTestProxyHealth_checkHealth
(t *testing.T)
proxy/health/health_test.go:168
FunctionTestProxy_ServeHTTP
(t *testing.T)
proxy/proxy_test.go:10
FunctionTestRemoveAll
(t *testing.T)
roundrobin/roundrobin_test.go:62
FunctionTestRemoveServer
(t *testing.T)
weighted/weighted_test.go:31
FunctionTestRemoveServers
(t *testing.T)
roundrobin/roundrobin_test.go:100
FunctionTestServers
(t *testing.T)
roundrobin/roundrobin_test.go:78
FunctionWithInitialDelaySeconds
WithInitialDelaySeconds sets the initial delay for the health check.
proxy/health/options.go:20
Functionmain
()
_example/roundrobin/main.go:10
Functionmain
()
_example/weighted/main.go:15