Documentation ¶
Index ¶
- Constants
- type TestServer
- func (TestServer) EmptyCall(ctx context.Context, req *grpc_testing.Empty) (*grpc_testing.Empty, error)
- func (TestServer) FullDuplexCall(str grpc_testing.TestService_FullDuplexCallServer) error
- func (TestServer) HalfDuplexCall(str grpc_testing.TestService_HalfDuplexCallServer) error
- func (TestServer) StreamingInputCall(str grpc_testing.TestService_StreamingInputCallServer) error
- func (TestServer) StreamingOutputCall(req *grpc_testing.StreamingOutputCallRequest, ...) error
- func (TestServer) UnaryCall(ctx context.Context, req *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error)
Constants ¶
const ( // MetadataReplyHeaders is a request header that contains values that will // be echoed back to the client as response headers. The format of the value // is "key: val". To have the server reply with more than one response // header, supply multiple values in request metadata. MetadataReplyHeaders = "reply-with-headers" // MetadataReplyTrailers is a request header that contains values that will // be echoed back to the client as response trailers. Its format its the // same as MetadataReplyHeaders. MetadataReplyTrailers = "reply-with-trailers" // MetadataFailEarly is a request header that, if present and not zero, // indicates that the RPC should fail immediately with that code. MetadataFailEarly = "fail-early" // MetadataFailLate is a request header that, if present and not zero, // indicates that the RPC should fail at the end with that code. This is // different from MetadataFailEarly only for streaming calls. An early // failure means the call to fail before any request stream is read or any // response stream is generated. A late failure means the entire request and // response streams will be consumed/processed and only then will the error // code be sent. MetadataFailLate = "fail-late" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestServer ¶
type TestServer struct{}
TestServer implements the TestService interface defined in example.proto.
func (TestServer) EmptyCall ¶
func (TestServer) EmptyCall(ctx context.Context, req *grpc_testing.Empty) (*grpc_testing.Empty, error)
EmptyCall accepts one empty request and issues one empty response.
func (TestServer) FullDuplexCall ¶
func (TestServer) FullDuplexCall(str grpc_testing.TestService_FullDuplexCallServer) error
FullDuplexCall accepts a sequence of requests with each request served by the server immediately. As one request could lead to multiple responses, this interface demonstrates the idea of full duplexing.
func (TestServer) HalfDuplexCall ¶
func (TestServer) HalfDuplexCall(str grpc_testing.TestService_HalfDuplexCallServer) error
HalfDuplexCall accepts a sequence of requests and issues a sequence of responses. The server buffers all the client requests and then serves them in order. A stream of responses is returned to the client once the client half-closes the stream.
func (TestServer) StreamingInputCall ¶
func (TestServer) StreamingInputCall(str grpc_testing.TestService_StreamingInputCallServer) error
StreamingInputCall accepts a sequence of requests and issues one response (streamed upload). The server returns the aggregated size of client payloads as the result.
func (TestServer) StreamingOutputCall ¶
func (TestServer) StreamingOutputCall(req *grpc_testing.StreamingOutputCallRequest, str grpc_testing.TestService_StreamingOutputCallServer) error
StreamingOutputCall accepts one request and issues a sequence of responses (streamed download). The server returns the payload with client desired type and sizes as specified in the request's ResponseParameters.
func (TestServer) UnaryCall ¶
func (TestServer) UnaryCall(ctx context.Context, req *grpc_testing.SimpleRequest) (*grpc_testing.SimpleResponse, error)
UnaryCall accepts one request and issues one response. The response includes the client's payload as-is.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
testserver
Command testserver spins up a test GRPC server.
|
Command testserver spins up a test GRPC server. |