Documentation ¶
Overview ¶
Package helloworld implements the helloworld grpc service. This package is used for testing the load-test-grpc task
Index ¶
- Variables
- func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer)
- type CallType
- type Greeter
- func (s *Greeter) GetCalls(key CallType) [][]*HelloRequest
- func (s *Greeter) GetConnectionCount() int
- func (s *Greeter) GetCount(key CallType) int
- func (s *Greeter) GetCountByWorker(key CallType) map[string]int
- func (s *Greeter) GetSendCounts(key CallType) map[int]int
- func (s *Greeter) ResetCounters()
- func (s *Greeter) SayHello(ctx context.Context, in *HelloRequest) (*HelloReply, error)
- func (s *Greeter) SayHelloBidi(stream Greeter_SayHelloBidiServer) error
- func (s *Greeter) SayHelloCS(stream Greeter_SayHelloCSServer) error
- func (s *Greeter) SayHellos(req *HelloRequest, stream Greeter_SayHellosServer) error
- type GreeterClient
- type GreeterServer
- type Greeter_SayHelloBidiClient
- type Greeter_SayHelloBidiServer
- type Greeter_SayHelloCSClient
- type Greeter_SayHelloCSServer
- type Greeter_SayHellosClient
- type Greeter_SayHellosServer
- type HWStatsHandler
- func (c *HWStatsHandler) GetConnectionCount() int
- func (c *HWStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
- func (c *HWStatsHandler) HandleRPC(_ context.Context, _ stats.RPCStats)
- func (c *HWStatsHandler) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context
- func (c *HWStatsHandler) TagRPC(ctx context.Context, _ *stats.RPCTagInfo) context.Context
- type HelloReply
- type HelloRequest
- type UnimplementedGreeterServer
- func (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error)
- func (UnimplementedGreeterServer) SayHelloBidi(Greeter_SayHelloBidiServer) error
- func (UnimplementedGreeterServer) SayHelloCS(Greeter_SayHelloCSServer) error
- func (UnimplementedGreeterServer) SayHellos(*HelloRequest, Greeter_SayHellosServer) error
- type UnsafeGreeterServer
Constants ¶
This section is empty.
Variables ¶
var File_helloworld_greeter_proto protoreflect.FileDescriptor
var Greeter_ServiceDesc = grpc.ServiceDesc{ ServiceName: "helloworld.Greeter", HandlerType: (*GreeterServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "SayHello", Handler: _Greeter_SayHello_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "SayHelloCS", Handler: _Greeter_SayHelloCS_Handler, ClientStreams: true, }, { StreamName: "SayHellos", Handler: _Greeter_SayHellos_Handler, ServerStreams: true, }, { StreamName: "SayHelloBidi", Handler: _Greeter_SayHelloBidi_Handler, ServerStreams: true, ClientStreams: true, }, }, Metadata: "helloworld/greeter.proto", }
Greeter_ServiceDesc is the grpc.ServiceDesc for Greeter service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterGreeterServer ¶
func RegisterGreeterServer(s grpc.ServiceRegistrar, srv GreeterServer)
Types ¶
type CallType ¶
type CallType string
CallType represents one of the gRPC call types: unary, client streaming, server streaming, bidi
var Bidi CallType = "bidi"
Bidi is a bidi / duplex call
var ClientStream CallType = "cs"
ClientStream is a client streaming call
var ServerStream CallType = "ss"
ServerStream is a server streaming call
var Unary CallType = "unary"
Unary is a unary call
type Greeter ¶
type Greeter struct { StreamData []*HelloReply Stats *HWStatsHandler // the following line is a modification on top of the source (see source credit above) // must embed unimplemented GreeterServer UnimplementedGreeterServer // contains filtered or unexported fields }
Greeter implements the GreeterServer for tests
func (*Greeter) GetCalls ¶
func (s *Greeter) GetCalls(key CallType) [][]*HelloRequest
GetCalls gets the received messages for specific call type
func (*Greeter) GetConnectionCount ¶
GetConnectionCount gets the connection count
func (*Greeter) GetCountByWorker ¶
GetCountByWorker gets count of requests by goroutine
func (*Greeter) GetSendCounts ¶
GetSendCounts gets the stream send counts
func (*Greeter) ResetCounters ¶
func (s *Greeter) ResetCounters()
ResetCounters resets the call counts
func (*Greeter) SayHello ¶
func (s *Greeter) SayHello(ctx context.Context, in *HelloRequest) (*HelloReply, error)
SayHello implements helloworld.GreeterServer
func (*Greeter) SayHelloBidi ¶
func (s *Greeter) SayHelloBidi(stream Greeter_SayHelloBidiServer) error
SayHelloBidi duplex call handler
func (*Greeter) SayHelloCS ¶
func (s *Greeter) SayHelloCS(stream Greeter_SayHelloCSServer) error
SayHelloCS is client streaming handler
func (*Greeter) SayHellos ¶
func (s *Greeter) SayHellos(req *HelloRequest, stream Greeter_SayHellosServer) error
SayHellos lists all hellos
type GreeterClient ¶
type GreeterClient interface { SayHello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloReply, error) SayHelloCS(ctx context.Context, opts ...grpc.CallOption) (Greeter_SayHelloCSClient, error) SayHellos(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (Greeter_SayHellosClient, error) SayHelloBidi(ctx context.Context, opts ...grpc.CallOption) (Greeter_SayHelloBidiClient, error) }
GreeterClient is the client API for Greeter 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.
func NewGreeterClient ¶
func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient
type GreeterServer ¶
type GreeterServer interface { SayHello(context.Context, *HelloRequest) (*HelloReply, error) SayHelloCS(Greeter_SayHelloCSServer) error SayHellos(*HelloRequest, Greeter_SayHellosServer) error SayHelloBidi(Greeter_SayHelloBidiServer) error // contains filtered or unexported methods }
GreeterServer is the server API for Greeter service. All implementations must embed UnimplementedGreeterServer for forward compatibility
type Greeter_SayHelloBidiClient ¶
type Greeter_SayHelloBidiClient interface { Send(*HelloRequest) error Recv() (*HelloReply, error) grpc.ClientStream }
type Greeter_SayHelloBidiServer ¶
type Greeter_SayHelloBidiServer interface { Send(*HelloReply) error Recv() (*HelloRequest, error) grpc.ServerStream }
type Greeter_SayHelloCSClient ¶
type Greeter_SayHelloCSClient interface { Send(*HelloRequest) error CloseAndRecv() (*HelloReply, error) grpc.ClientStream }
type Greeter_SayHelloCSServer ¶
type Greeter_SayHelloCSServer interface { SendAndClose(*HelloReply) error Recv() (*HelloRequest, error) grpc.ServerStream }
type Greeter_SayHellosClient ¶
type Greeter_SayHellosClient interface { Recv() (*HelloReply, error) grpc.ClientStream }
type Greeter_SayHellosServer ¶
type Greeter_SayHellosServer interface { Send(*HelloReply) error grpc.ServerStream }
type HWStatsHandler ¶
type HWStatsHandler struct {
// contains filtered or unexported fields
}
HWStatsHandler is for gRPC stats
func (*HWStatsHandler) GetConnectionCount ¶
func (c *HWStatsHandler) GetConnectionCount() int
GetConnectionCount gets the connection count
func (*HWStatsHandler) HandleConn ¶
func (c *HWStatsHandler) HandleConn(_ context.Context, _ stats.ConnStats)
HandleConn handle the connection
func (*HWStatsHandler) HandleRPC ¶
func (c *HWStatsHandler) HandleRPC(_ context.Context, _ stats.RPCStats)
HandleRPC implements per-RPC tracing and stats instrumentation.
func (*HWStatsHandler) TagConn ¶
func (c *HWStatsHandler) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context
TagConn exists to satisfy gRPC stats.Handler.
func (*HWStatsHandler) TagRPC ¶
func (c *HWStatsHandler) TagRPC(ctx context.Context, _ *stats.RPCTagInfo) context.Context
TagRPC implements per-RPC context management.
type HelloReply ¶
type HelloReply struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
The response message containing the greetings
func (*HelloReply) Descriptor
deprecated
func (*HelloReply) Descriptor() ([]byte, []int)
Deprecated: Use HelloReply.ProtoReflect.Descriptor instead.
func (*HelloReply) GetMessage ¶
func (x *HelloReply) GetMessage() string
func (*HelloReply) ProtoMessage ¶
func (*HelloReply) ProtoMessage()
func (*HelloReply) ProtoReflect ¶
func (x *HelloReply) ProtoReflect() protoreflect.Message
func (*HelloReply) Reset ¶
func (x *HelloReply) Reset()
func (*HelloReply) String ¶
func (x *HelloReply) String() string
type HelloRequest ¶
type HelloRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
The request message containing the user's name.
func (*HelloRequest) Descriptor
deprecated
func (*HelloRequest) Descriptor() ([]byte, []int)
Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.
func (*HelloRequest) GetName ¶
func (x *HelloRequest) GetName() string
func (*HelloRequest) ProtoMessage ¶
func (*HelloRequest) ProtoMessage()
func (*HelloRequest) ProtoReflect ¶
func (x *HelloRequest) ProtoReflect() protoreflect.Message
func (*HelloRequest) Reset ¶
func (x *HelloRequest) Reset()
func (*HelloRequest) String ¶
func (x *HelloRequest) String() string
type UnimplementedGreeterServer ¶
type UnimplementedGreeterServer struct { }
UnimplementedGreeterServer must be embedded to have forward compatible implementations.
func (UnimplementedGreeterServer) SayHello ¶
func (UnimplementedGreeterServer) SayHello(context.Context, *HelloRequest) (*HelloReply, error)
func (UnimplementedGreeterServer) SayHelloBidi ¶
func (UnimplementedGreeterServer) SayHelloBidi(Greeter_SayHelloBidiServer) error
func (UnimplementedGreeterServer) SayHelloCS ¶
func (UnimplementedGreeterServer) SayHelloCS(Greeter_SayHelloCSServer) error
func (UnimplementedGreeterServer) SayHellos ¶
func (UnimplementedGreeterServer) SayHellos(*HelloRequest, Greeter_SayHellosServer) error
type UnsafeGreeterServer ¶
type UnsafeGreeterServer interface {
// contains filtered or unexported methods
}
UnsafeGreeterServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to GreeterServer will result in compilation errors.