Documentation ¶
Overview ¶
Package fakegrpclb provides a fake implementation of the grpclb server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct { lbgrpc.UnimplementedLoadBalancerServer // contains filtered or unexported fields }
Server is a fake implementation of the grpclb LoadBalancer service. It does not support stats reporting from clients, and always sends back a static list of backends to the client to balance load across.
It is safe for concurrent access.
func NewServer ¶
func NewServer(params ServerParams) (*Server, error)
NewServer creates a new Server with passed in params. Returns a non-nil error if the params are invalid.
func (*Server) Address ¶
Address returns the host:port on which the LoadBalancer service is serving.
func (*Server) BalanceLoad ¶
func (s *Server) BalanceLoad(stream lbgrpc.LoadBalancer_BalanceLoadServer) error
BalanceLoad provides a fake implementation of the LoadBalancer service.
type ServerParams ¶
type ServerParams struct { ListenPort int // Listening port for the balancer server. ServerOptions []grpc.ServerOption // gRPC options for the balancer server. LoadBalancedServiceName string // Service name being load balanced for. LoadBalancedServicePort int // Service port being load balanced for. BackendAddresses []string // Service backends to balance load across. ShortStream bool // End balancer stream after sending server list. }
ServerParams wraps options passed while creating a Server.
Click to show internal directories.
Click to hide internal directories.