Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

grpc_lb_v1

v1.14.0
github.com/bglmmz/grpc/balancer/grpclb/grpc_lb_v1

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

116 matches

Top ↑

Functions

RegisterLoadBalancerServer

func RegisterLoadBalancerServer(s *grpc.Server, srv LoadBalancerServer)

Types

ClientStats

type ClientStats struct {
	// The timestamp of generating the report.
	Timestamp *timestamp.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 `protobuf:"varint,6,opt,name=num_calls_finished_with_client_failed_to_send,json=numCallsFinishedWithClientFailedToSend,proto3" json:"num_calls_finished_with_client_failed_to_send,omitempty"`
	// The total number of RPCs that finished and are known to have been received
	// by a server.
	NumCallsFinishedKnownReceived int64 `protobuf:"varint,7,opt,name=num_calls_finished_known_received,json=numCallsFinishedKnownReceived,proto3" json:"num_calls_finished_known_received,omitempty"`
	// The list of dropped calls.
	CallsFinishedWithDrop []*ClientStatsPerToken `protobuf:"bytes,8,rep,name=calls_finished_with_drop,json=callsFinishedWithDrop,proto3" json:"calls_finished_with_drop,omitempty"`
	XXX_NoUnkeyedLiteral  struct{}               `json:"-"`
	XXX_unrecognized      []byte                 `json:"-"`
	XXX_sizecache         int32                  `json:"-"`
}

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

ClientStats.Descriptor

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

ClientStats.GetCallsFinishedWithDrop

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

ClientStats.GetNumCallsFinished

func (m *ClientStats) GetNumCallsFinished() int64

ClientStats.GetNumCallsFinishedKnownReceived

func (m *ClientStats) GetNumCallsFinishedKnownReceived() int64

ClientStats.GetNumCallsFinishedWithClientFailedToSend

func (m *ClientStats) GetNumCallsFinishedWithClientFailedToSend() int64

ClientStats.GetNumCallsStarted

func (m *ClientStats) GetNumCallsStarted() int64

ClientStats.GetTimestamp

func (m *ClientStats) GetTimestamp() *timestamp.Timestamp

ClientStats.ProtoMessage

func (*ClientStats) ProtoMessage()

ClientStats.Reset

func (m *ClientStats) Reset()

ClientStats.String

func (m *ClientStats) String() string

ClientStats.XXX_DiscardUnknown

func (m *ClientStats) XXX_DiscardUnknown()

ClientStats.XXX_Marshal

func (m *ClientStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

ClientStats.XXX_Merge

func (dst *ClientStats) XXX_Merge(src proto.Message)

ClientStats.XXX_Size

func (m *ClientStats) XXX_Size() int

ClientStats.XXX_Unmarshal

func (m *ClientStats) XXX_Unmarshal(b []byte) error

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

ClientStatsPerToken.Descriptor

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

ClientStatsPerToken.GetLoadBalanceToken

func (m *ClientStatsPerToken) GetLoadBalanceToken() string

ClientStatsPerToken.GetNumCalls

func (m *ClientStatsPerToken) GetNumCalls() int64

ClientStatsPerToken.ProtoMessage

func (*ClientStatsPerToken) ProtoMessage()

ClientStatsPerToken.Reset

func (m *ClientStatsPerToken) Reset()

ClientStatsPerToken.String

func (m *ClientStatsPerToken) String() string

ClientStatsPerToken.XXX_DiscardUnknown

func (m *ClientStatsPerToken) XXX_DiscardUnknown()

ClientStatsPerToken.XXX_Marshal

func (m *ClientStatsPerToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

ClientStatsPerToken.XXX_Merge

func (dst *ClientStatsPerToken) XXX_Merge(src proto.Message)

ClientStatsPerToken.XXX_Size

func (m *ClientStatsPerToken) XXX_Size() int

ClientStatsPerToken.XXX_Unmarshal

func (m *ClientStatsPerToken) XXX_Unmarshal(b []byte) error

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

InitialLoadBalanceRequest.Descriptor

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

InitialLoadBalanceRequest.GetName

func (m *InitialLoadBalanceRequest) GetName() string

InitialLoadBalanceRequest.ProtoMessage

func (*InitialLoadBalanceRequest) ProtoMessage()

InitialLoadBalanceRequest.Reset

func (m *InitialLoadBalanceRequest) Reset()

InitialLoadBalanceRequest.String

func (m *InitialLoadBalanceRequest) String() string

InitialLoadBalanceRequest.XXX_DiscardUnknown

func (m *InitialLoadBalanceRequest) XXX_DiscardUnknown()

InitialLoadBalanceRequest.XXX_Marshal

func (m *InitialLoadBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

InitialLoadBalanceRequest.XXX_Merge

func (dst *InitialLoadBalanceRequest) XXX_Merge(src proto.Message)

InitialLoadBalanceRequest.XXX_Size

func (m *InitialLoadBalanceRequest) XXX_Size() int

InitialLoadBalanceRequest.XXX_Unmarshal

func (m *InitialLoadBalanceRequest) XXX_Unmarshal(b []byte) error

InitialLoadBalanceResponse

type InitialLoadBalanceResponse struct {
	// This is an application layer redirect that indicates the client should use
	// the specified server for load balancing. When this field is non-empty in
	// the response, the client should open a separate connection to the
	// load_balancer_delegate and call the BalanceLoad method. Its length should
	// be less than 64 bytes.
	LoadBalancerDelegate string `protobuf:"bytes,1,opt,name=load_balancer_delegate,json=loadBalancerDelegate,proto3" json:"load_balancer_delegate,omitempty"`
	// 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 *duration.Duration `protobuf:"bytes,2,opt,name=client_stats_report_interval,json=clientStatsReportInterval,proto3" json:"client_stats_report_interval,omitempty"`
	XXX_NoUnkeyedLiteral      struct{}           `json:"-"`
	XXX_unrecognized          []byte             `json:"-"`
	XXX_sizecache             int32              `json:"-"`
}

InitialLoadBalanceResponse.Descriptor

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

InitialLoadBalanceResponse.GetClientStatsReportInterval

func (m *InitialLoadBalanceResponse) GetClientStatsReportInterval() *duration.Duration

InitialLoadBalanceResponse.GetLoadBalancerDelegate

func (m *InitialLoadBalanceResponse) GetLoadBalancerDelegate() string

InitialLoadBalanceResponse.ProtoMessage

func (*InitialLoadBalanceResponse) ProtoMessage()

InitialLoadBalanceResponse.Reset

func (m *InitialLoadBalanceResponse) Reset()

InitialLoadBalanceResponse.String

func (m *InitialLoadBalanceResponse) String() string

InitialLoadBalanceResponse.XXX_DiscardUnknown

func (m *InitialLoadBalanceResponse) XXX_DiscardUnknown()

InitialLoadBalanceResponse.XXX_Marshal

func (m *InitialLoadBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

InitialLoadBalanceResponse.XXX_Merge

func (dst *InitialLoadBalanceResponse) XXX_Merge(src proto.Message)

InitialLoadBalanceResponse.XXX_Size

func (m *InitialLoadBalanceResponse) XXX_Size() int

InitialLoadBalanceResponse.XXX_Unmarshal

func (m *InitialLoadBalanceResponse) XXX_Unmarshal(b []byte) error

LoadBalanceRequest

type LoadBalanceRequest struct {
	// Types that are valid to be assigned to LoadBalanceRequestType:
	//	*LoadBalanceRequest_InitialRequest
	//	*LoadBalanceRequest_ClientStats
	LoadBalanceRequestType isLoadBalanceRequest_LoadBalanceRequestType `protobuf_oneof:"load_balance_request_type"`
	XXX_NoUnkeyedLiteral   struct{}                                    `json:"-"`
	XXX_unrecognized       []byte                                      `json:"-"`
	XXX_sizecache          int32                                       `json:"-"`
}

LoadBalanceRequest.Descriptor

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

LoadBalanceRequest.GetClientStats

func (m *LoadBalanceRequest) GetClientStats() *ClientStats

LoadBalanceRequest.GetInitialRequest

func (m *LoadBalanceRequest) GetInitialRequest() *InitialLoadBalanceRequest

LoadBalanceRequest.GetLoadBalanceRequestType

func (m *LoadBalanceRequest) GetLoadBalanceRequestType() isLoadBalanceRequest_LoadBalanceRequestType

LoadBalanceRequest.ProtoMessage

func (*LoadBalanceRequest) ProtoMessage()

LoadBalanceRequest.Reset

func (m *LoadBalanceRequest) Reset()

LoadBalanceRequest.String

func (m *LoadBalanceRequest) String() string

LoadBalanceRequest.XXX_DiscardUnknown

func (m *LoadBalanceRequest) XXX_DiscardUnknown()

LoadBalanceRequest.XXX_Marshal

func (m *LoadBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

LoadBalanceRequest.XXX_Merge

func (dst *LoadBalanceRequest) XXX_Merge(src proto.Message)

LoadBalanceRequest.XXX_OneofFuncs

func (*LoadBalanceRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

LoadBalanceRequest.XXX_Size

func (m *LoadBalanceRequest) XXX_Size() int

LoadBalanceRequest.XXX_Unmarshal

func (m *LoadBalanceRequest) XXX_Unmarshal(b []byte) error

LoadBalanceRequest_ClientStats

type LoadBalanceRequest_ClientStats struct {
	ClientStats *ClientStats `protobuf:"bytes,2,opt,name=client_stats,json=clientStats,proto3,oneof"`
}

LoadBalanceRequest_InitialRequest

type LoadBalanceRequest_InitialRequest struct {
	InitialRequest *InitialLoadBalanceRequest `protobuf:"bytes,1,opt,name=initial_request,json=initialRequest,proto3,oneof"`
}

LoadBalanceResponse

type LoadBalanceResponse struct {
	// Types that are valid to be assigned to LoadBalanceResponseType:
	//	*LoadBalanceResponse_InitialResponse
	//	*LoadBalanceResponse_ServerList
	LoadBalanceResponseType isLoadBalanceResponse_LoadBalanceResponseType `protobuf_oneof:"load_balance_response_type"`
	XXX_NoUnkeyedLiteral    struct{}                                      `json:"-"`
	XXX_unrecognized        []byte                                        `json:"-"`
	XXX_sizecache           int32                                         `json:"-"`
}

LoadBalanceResponse.Descriptor

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

LoadBalanceResponse.GetInitialResponse

func (m *LoadBalanceResponse) GetInitialResponse() *InitialLoadBalanceResponse

LoadBalanceResponse.GetLoadBalanceResponseType

func (m *LoadBalanceResponse) GetLoadBalanceResponseType() isLoadBalanceResponse_LoadBalanceResponseType

LoadBalanceResponse.GetServerList

func (m *LoadBalanceResponse) GetServerList() *ServerList

LoadBalanceResponse.ProtoMessage

func (*LoadBalanceResponse) ProtoMessage()

LoadBalanceResponse.Reset

func (m *LoadBalanceResponse) Reset()

LoadBalanceResponse.String

func (m *LoadBalanceResponse) String() string

LoadBalanceResponse.XXX_DiscardUnknown

func (m *LoadBalanceResponse) XXX_DiscardUnknown()

LoadBalanceResponse.XXX_Marshal

func (m *LoadBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

LoadBalanceResponse.XXX_Merge

func (dst *LoadBalanceResponse) XXX_Merge(src proto.Message)

LoadBalanceResponse.XXX_OneofFuncs

func (*LoadBalanceResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

LoadBalanceResponse.XXX_Size

func (m *LoadBalanceResponse) XXX_Size() int

LoadBalanceResponse.XXX_Unmarshal

func (m *LoadBalanceResponse) XXX_Unmarshal(b []byte) error

LoadBalanceResponse_InitialResponse

type LoadBalanceResponse_InitialResponse struct {
	InitialResponse *InitialLoadBalanceResponse `protobuf:"bytes,1,opt,name=initial_response,json=initialResponse,proto3,oneof"`
}

LoadBalanceResponse_ServerList

type LoadBalanceResponse_ServerList struct {
	ServerList *ServerList `protobuf:"bytes,2,opt,name=server_list,json=serverList,proto3,oneof"`
}

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://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

NewLoadBalancerClient

func NewLoadBalancerClient(cc *grpc.ClientConn) LoadBalancerClient

LoadBalancerServer

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

LoadBalancerServer is the server API for LoadBalancer service.

LoadBalancer_BalanceLoadClient

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

LoadBalancer_BalanceLoadServer

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

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

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

Server.Descriptor

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

Server.GetDrop

func (m *Server) GetDrop() bool

Server.GetIpAddress

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

Server.GetLoadBalanceToken

func (m *Server) GetLoadBalanceToken() string

Server.GetPort

func (m *Server) GetPort() int32

Server.ProtoMessage

func (*Server) ProtoMessage()

Server.Reset

func (m *Server) Reset()

Server.String

func (m *Server) String() string

Server.XXX_DiscardUnknown

func (m *Server) XXX_DiscardUnknown()

Server.XXX_Marshal

func (m *Server) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

Server.XXX_Merge

func (dst *Server) XXX_Merge(src proto.Message)

Server.XXX_Size

func (m *Server) XXX_Size() int

Server.XXX_Unmarshal

func (m *Server) XXX_Unmarshal(b []byte) error

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"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

ServerList.Descriptor

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

ServerList.GetServers

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

ServerList.ProtoMessage

func (*ServerList) ProtoMessage()

ServerList.Reset

func (m *ServerList) Reset()

ServerList.String

func (m *ServerList) String() string

ServerList.XXX_DiscardUnknown

func (m *ServerList) XXX_DiscardUnknown()

ServerList.XXX_Marshal

func (m *ServerList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

ServerList.XXX_Merge

func (dst *ServerList) XXX_Merge(src proto.Message)

ServerList.XXX_Size

func (m *ServerList) XXX_Size() int

ServerList.XXX_Unmarshal

func (m *ServerList) XXX_Unmarshal(b []byte) error

Dependency graph