grpc_lb_v1

package
v1.59.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0 Imports: 10 Imported by: 37

Documentation

Index

Constants

View Source
const (
	LoadBalancer_BalanceLoad_FullMethodName = "/grpc.lb.v1.LoadBalancer/BalanceLoad"
)

Variables

View Source
var File_grpc_lb_v1_load_balancer_proto protoreflect.FileDescriptor
View Source
var LoadBalancer_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "grpc.lb.v1.LoadBalancer",
	HandlerType: (*LoadBalancerServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "BalanceLoad",
			Handler:       _LoadBalancer_BalanceLoad_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "grpc/lb/v1/load_balancer.proto",
}

LoadBalancer_ServiceDesc is the grpc.ServiceDesc for LoadBalancer service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterLoadBalancerServer

func RegisterLoadBalancerServer(s grpc.ServiceRegistrar, srv LoadBalancerServer)

Types

type ClientStats

type ClientStats struct {

	// The timestamp of generating the report.
	Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// The total number of RPCs that started.
	NumCallsStarted int64 `protobuf:"varint,2,opt,name=num_calls_started,json=numCallsStarted,proto3" json:"num_calls_started,omitempty"`
	// The total number of RPCs that finished.
	NumCallsFinished int64 `protobuf:"varint,3,opt,name=num_calls_finished,json=numCallsFinished,proto3" json:"num_calls_finished,omitempty"`
	// The total number of RPCs that failed to reach a server except dropped RPCs.
	NumCallsFinishedWithClientFailedToSend int64 `` /* 188-byte string literal not displayed */
	// The total number of RPCs that finished and are known to have been received
	// by a server.
	NumCallsFinishedKnownReceived int64 `` /* 155-byte string literal not displayed */
	// The list of dropped calls.
	CallsFinishedWithDrop []*ClientStatsPerToken `` /* 128-byte string literal not displayed */
	// contains filtered or unexported fields
}

Contains client level statistics that are useful to load balancing. Each count except the timestamp should be reset to zero after reporting the stats.

func (*ClientStats) Descriptor deprecated

func (*ClientStats) Descriptor() ([]byte, []int)

Deprecated: Use ClientStats.ProtoReflect.Descriptor instead.

func (*ClientStats) GetCallsFinishedWithDrop

func (x *ClientStats) GetCallsFinishedWithDrop() []*ClientStatsPerToken

func (*ClientStats) GetNumCallsFinished

func (x *ClientStats) GetNumCallsFinished() int64

func (*ClientStats) GetNumCallsFinishedKnownReceived

func (x *ClientStats) GetNumCallsFinishedKnownReceived() int64

func (*ClientStats) GetNumCallsFinishedWithClientFailedToSend

func (x *ClientStats) GetNumCallsFinishedWithClientFailedToSend() int64

func (*ClientStats) GetNumCallsStarted

func (x *ClientStats) GetNumCallsStarted() int64

func (*ClientStats) GetTimestamp

func (x *ClientStats) GetTimestamp() *timestamppb.Timestamp

func (*ClientStats) ProtoMessage

func (*ClientStats) ProtoMessage()

func (*ClientStats) ProtoReflect added in v1.33.2

func (x *ClientStats) ProtoReflect() protoreflect.Message

func (*ClientStats) Reset

func (x *ClientStats) Reset()

func (*ClientStats) String

func (x *ClientStats) String() string

type ClientStatsPerToken

type ClientStatsPerToken struct {

	// See Server.load_balance_token.
	LoadBalanceToken string `protobuf:"bytes,1,opt,name=load_balance_token,json=loadBalanceToken,proto3" json:"load_balance_token,omitempty"`
	// The total number of RPCs that finished associated with the token.
	NumCalls int64 `protobuf:"varint,2,opt,name=num_calls,json=numCalls,proto3" json:"num_calls,omitempty"`
	// contains filtered or unexported fields
}

Contains the number of calls finished for a particular load balance token.

func (*ClientStatsPerToken) Descriptor deprecated

func (*ClientStatsPerToken) Descriptor() ([]byte, []int)

Deprecated: Use ClientStatsPerToken.ProtoReflect.Descriptor instead.

func (*ClientStatsPerToken) GetLoadBalanceToken

func (x *ClientStatsPerToken) GetLoadBalanceToken() string

func (*ClientStatsPerToken) GetNumCalls

func (x *ClientStatsPerToken) GetNumCalls() int64

func (*ClientStatsPerToken) ProtoMessage

func (*ClientStatsPerToken) ProtoMessage()

func (*ClientStatsPerToken) ProtoReflect added in v1.33.2

func (x *ClientStatsPerToken) ProtoReflect() protoreflect.Message

func (*ClientStatsPerToken) Reset

func (x *ClientStatsPerToken) Reset()

func (*ClientStatsPerToken) String

func (x *ClientStatsPerToken) String() string

type FallbackResponse added in v1.27.0

type FallbackResponse struct {
	// contains filtered or unexported fields
}

func (*FallbackResponse) Descriptor deprecated added in v1.27.0

func (*FallbackResponse) Descriptor() ([]byte, []int)

Deprecated: Use FallbackResponse.ProtoReflect.Descriptor instead.

func (*FallbackResponse) ProtoMessage added in v1.27.0

func (*FallbackResponse) ProtoMessage()

func (*FallbackResponse) ProtoReflect added in v1.33.2

func (x *FallbackResponse) ProtoReflect() protoreflect.Message

func (*FallbackResponse) Reset added in v1.27.0

func (x *FallbackResponse) Reset()

func (*FallbackResponse) String added in v1.27.0

func (x *FallbackResponse) String() string

type InitialLoadBalanceRequest

type InitialLoadBalanceRequest struct {

	// The name of the load balanced service (e.g., service.googleapis.com). Its
	// length should be less than 256 bytes.
	// The name might include a port number. How to handle the port number is up
	// to the balancer.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*InitialLoadBalanceRequest) Descriptor deprecated

func (*InitialLoadBalanceRequest) Descriptor() ([]byte, []int)

Deprecated: Use InitialLoadBalanceRequest.ProtoReflect.Descriptor instead.

func (*InitialLoadBalanceRequest) GetName

func (x *InitialLoadBalanceRequest) GetName() string

func (*InitialLoadBalanceRequest) ProtoMessage

func (*InitialLoadBalanceRequest) ProtoMessage()

func (*InitialLoadBalanceRequest) ProtoReflect added in v1.33.2

func (*InitialLoadBalanceRequest) Reset

func (x *InitialLoadBalanceRequest) Reset()

func (*InitialLoadBalanceRequest) String

func (x *InitialLoadBalanceRequest) String() string

type InitialLoadBalanceResponse

type InitialLoadBalanceResponse struct {

	// This interval defines how often the client should send the client stats
	// to the load balancer. Stats should only be reported when the duration is
	// positive.
	ClientStatsReportInterval *durationpb.Duration `` /* 140-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*InitialLoadBalanceResponse) Descriptor deprecated

func (*InitialLoadBalanceResponse) Descriptor() ([]byte, []int)

Deprecated: Use InitialLoadBalanceResponse.ProtoReflect.Descriptor instead.

func (*InitialLoadBalanceResponse) GetClientStatsReportInterval

func (x *InitialLoadBalanceResponse) GetClientStatsReportInterval() *durationpb.Duration

func (*InitialLoadBalanceResponse) ProtoMessage

func (*InitialLoadBalanceResponse) ProtoMessage()

func (*InitialLoadBalanceResponse) ProtoReflect added in v1.33.2

func (*InitialLoadBalanceResponse) Reset

func (x *InitialLoadBalanceResponse) Reset()

func (*InitialLoadBalanceResponse) String

func (x *InitialLoadBalanceResponse) String() string

type LoadBalanceRequest

type LoadBalanceRequest struct {

	// Types that are assignable to LoadBalanceRequestType:
	//
	//	*LoadBalanceRequest_InitialRequest
	//	*LoadBalanceRequest_ClientStats
	LoadBalanceRequestType isLoadBalanceRequest_LoadBalanceRequestType `protobuf_oneof:"load_balance_request_type"`
	// contains filtered or unexported fields
}

func (*LoadBalanceRequest) Descriptor deprecated

func (*LoadBalanceRequest) Descriptor() ([]byte, []int)

Deprecated: Use LoadBalanceRequest.ProtoReflect.Descriptor instead.

func (*LoadBalanceRequest) GetClientStats

func (x *LoadBalanceRequest) GetClientStats() *ClientStats

func (*LoadBalanceRequest) GetInitialRequest

func (x *LoadBalanceRequest) GetInitialRequest() *InitialLoadBalanceRequest

func (*LoadBalanceRequest) GetLoadBalanceRequestType

func (m *LoadBalanceRequest) GetLoadBalanceRequestType() isLoadBalanceRequest_LoadBalanceRequestType

func (*LoadBalanceRequest) ProtoMessage

func (*LoadBalanceRequest) ProtoMessage()

func (*LoadBalanceRequest) ProtoReflect added in v1.33.2

func (x *LoadBalanceRequest) ProtoReflect() protoreflect.Message

func (*LoadBalanceRequest) Reset

func (x *LoadBalanceRequest) Reset()

func (*LoadBalanceRequest) String

func (x *LoadBalanceRequest) String() string

type LoadBalanceRequest_ClientStats

type LoadBalanceRequest_ClientStats struct {
	// The client stats should be periodically reported to the load balancer
	// based on the duration defined in the InitialLoadBalanceResponse.
	ClientStats *ClientStats `protobuf:"bytes,2,opt,name=client_stats,json=clientStats,proto3,oneof"`
}

type LoadBalanceRequest_InitialRequest

type LoadBalanceRequest_InitialRequest struct {
	// This message should be sent on the first request to the load balancer.
	InitialRequest *InitialLoadBalanceRequest `protobuf:"bytes,1,opt,name=initial_request,json=initialRequest,proto3,oneof"`
}

type LoadBalanceResponse

type LoadBalanceResponse struct {

	// Types that are assignable to LoadBalanceResponseType:
	//
	//	*LoadBalanceResponse_InitialResponse
	//	*LoadBalanceResponse_ServerList
	//	*LoadBalanceResponse_FallbackResponse
	LoadBalanceResponseType isLoadBalanceResponse_LoadBalanceResponseType `protobuf_oneof:"load_balance_response_type"`
	// contains filtered or unexported fields
}

func (*LoadBalanceResponse) Descriptor deprecated

func (*LoadBalanceResponse) Descriptor() ([]byte, []int)

Deprecated: Use LoadBalanceResponse.ProtoReflect.Descriptor instead.

func (*LoadBalanceResponse) GetFallbackResponse added in v1.27.0

func (x *LoadBalanceResponse) GetFallbackResponse() *FallbackResponse

func (*LoadBalanceResponse) GetInitialResponse

func (x *LoadBalanceResponse) GetInitialResponse() *InitialLoadBalanceResponse

func (*LoadBalanceResponse) GetLoadBalanceResponseType

func (m *LoadBalanceResponse) GetLoadBalanceResponseType() isLoadBalanceResponse_LoadBalanceResponseType

func (*LoadBalanceResponse) GetServerList

func (x *LoadBalanceResponse) GetServerList() *ServerList

func (*LoadBalanceResponse) ProtoMessage

func (*LoadBalanceResponse) ProtoMessage()

func (*LoadBalanceResponse) ProtoReflect added in v1.33.2

func (x *LoadBalanceResponse) ProtoReflect() protoreflect.Message

func (*LoadBalanceResponse) Reset

func (x *LoadBalanceResponse) Reset()

func (*LoadBalanceResponse) String

func (x *LoadBalanceResponse) String() string

type LoadBalanceResponse_FallbackResponse added in v1.27.0

type LoadBalanceResponse_FallbackResponse struct {
	// If this field is set, then the client should eagerly enter fallback
	// mode (even if there are existing, healthy connections to backends).
	FallbackResponse *FallbackResponse `protobuf:"bytes,3,opt,name=fallback_response,json=fallbackResponse,proto3,oneof"`
}

type LoadBalanceResponse_InitialResponse

type LoadBalanceResponse_InitialResponse struct {
	// This message should be sent on the first response to the client.
	InitialResponse *InitialLoadBalanceResponse `protobuf:"bytes,1,opt,name=initial_response,json=initialResponse,proto3,oneof"`
}

type LoadBalanceResponse_ServerList

type LoadBalanceResponse_ServerList struct {
	// Contains the list of servers selected by the load balancer. The client
	// should send requests to these servers in the specified order.
	ServerList *ServerList `protobuf:"bytes,2,opt,name=server_list,json=serverList,proto3,oneof"`
}

type LoadBalancerClient

type LoadBalancerClient interface {
	// Bidirectional rpc to get a list of servers.
	BalanceLoad(ctx context.Context, opts ...grpc.CallOption) (LoadBalancer_BalanceLoadClient, error)
}

LoadBalancerClient is the client API for LoadBalancer service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type LoadBalancerServer

type LoadBalancerServer interface {
	// Bidirectional rpc to get a list of servers.
	BalanceLoad(LoadBalancer_BalanceLoadServer) error
}

LoadBalancerServer is the server API for LoadBalancer service. All implementations should embed UnimplementedLoadBalancerServer for forward compatibility

type LoadBalancer_BalanceLoadClient

type LoadBalancer_BalanceLoadClient interface {
	Send(*LoadBalanceRequest) error
	Recv() (*LoadBalanceResponse, error)
	grpc.ClientStream
}

type LoadBalancer_BalanceLoadServer

type LoadBalancer_BalanceLoadServer interface {
	Send(*LoadBalanceResponse) error
	Recv() (*LoadBalanceRequest, error)
	grpc.ServerStream
}

type Server

type Server struct {

	// A resolved address for the server, serialized in network-byte-order. It may
	// either be an IPv4 or IPv6 address.
	IpAddress []byte `protobuf:"bytes,1,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"`
	// A resolved port number for the server.
	Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"`
	// An opaque but printable token for load reporting. The client must include
	// the token of the picked server into the initial metadata when it starts a
	// call to that server. The token is used by the server to verify the request
	// and to allow the server to report load to the gRPC LB system. The token is
	// also used in client stats for reporting dropped calls.
	//
	// Its length can be variable but must be less than 50 bytes.
	LoadBalanceToken string `protobuf:"bytes,3,opt,name=load_balance_token,json=loadBalanceToken,proto3" json:"load_balance_token,omitempty"`
	// Indicates whether this particular request should be dropped by the client.
	// If the request is dropped, there will be a corresponding entry in
	// ClientStats.calls_finished_with_drop.
	Drop bool `protobuf:"varint,4,opt,name=drop,proto3" json:"drop,omitempty"`
	// contains filtered or unexported fields
}

Contains server information. When the drop field is not true, use the other fields.

func (*Server) Descriptor deprecated

func (*Server) Descriptor() ([]byte, []int)

Deprecated: Use Server.ProtoReflect.Descriptor instead.

func (*Server) GetDrop

func (x *Server) GetDrop() bool

func (*Server) GetIpAddress

func (x *Server) GetIpAddress() []byte

func (*Server) GetLoadBalanceToken

func (x *Server) GetLoadBalanceToken() string

func (*Server) GetPort

func (x *Server) GetPort() int32

func (*Server) ProtoMessage

func (*Server) ProtoMessage()

func (*Server) ProtoReflect added in v1.33.2

func (x *Server) ProtoReflect() protoreflect.Message

func (*Server) Reset

func (x *Server) Reset()

func (*Server) String

func (x *Server) String() string

type ServerList

type ServerList struct {

	// Contains a list of servers selected by the load balancer. The list will
	// be updated when server resolutions change or as needed to balance load
	// across more servers. The client should consume the server list in order
	// unless instructed otherwise via the client_config.
	Servers []*Server `protobuf:"bytes,1,rep,name=servers,proto3" json:"servers,omitempty"`
	// contains filtered or unexported fields
}

func (*ServerList) Descriptor deprecated

func (*ServerList) Descriptor() ([]byte, []int)

Deprecated: Use ServerList.ProtoReflect.Descriptor instead.

func (*ServerList) GetServers

func (x *ServerList) GetServers() []*Server

func (*ServerList) ProtoMessage

func (*ServerList) ProtoMessage()

func (*ServerList) ProtoReflect added in v1.33.2

func (x *ServerList) ProtoReflect() protoreflect.Message

func (*ServerList) Reset

func (x *ServerList) Reset()

func (*ServerList) String

func (x *ServerList) String() string

type UnimplementedLoadBalancerServer added in v1.24.0

type UnimplementedLoadBalancerServer struct {
}

UnimplementedLoadBalancerServer should be embedded to have forward compatible implementations.

func (UnimplementedLoadBalancerServer) BalanceLoad added in v1.24.0

type UnsafeLoadBalancerServer added in v1.33.0

type UnsafeLoadBalancerServer interface {
	// contains filtered or unexported methods
}

UnsafeLoadBalancerServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to LoadBalancerServer will result in compilation errors.

Jump to

Keyboard shortcuts

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