Balancer

The grpc_proxy.service contains classes:

  • grpc_proxy.service.LoadBalancer

  • grpc_proxy.service.RandomChoice

  • grpc_proxy.service.PickFirst

class grpc_proxy.balancer.GrpcProxyNoHostError(*args: Any, **kwargs: Any)[source]
class grpc_proxy.balancer.LoadBalancer(service, method, adresses=[], options=[], metadata=None)[source]

Base class for all load nalancer classes.

sent(request, metadata)[source]

A method for process given request.

Parameters
Returns

Return tuple of host and responce from the target services.

Return type

(str, binary)

class grpc_proxy.balancer.PickFirst(service, method, adresses=[], options=[], metadata=None)[source]

Implementation of pick first balancer with random host choosing.

sent(request, metadata)[source]

A method for process given request.

Parameters
Returns

Return tuple of host and responce from the target services.

Return type

(str, binary)

class grpc_proxy.balancer.RandomChoice(service, method, adresses=[], options=[], metadata=None)[source]

Implementation of random balancer with random host choosing.

sent(request, metadata)[source]

A method for process given request.

Parameters
Returns

Return tuple of host and responce from the target services.

Return type

(str, binary)