grpctest

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: ISC Imports: 19 Imported by: 0

Documentation

Overview

Code generated by protoc-gen-go-ttrpc. DO NOT EDIT. source: test.proto

Index

Constants

View Source
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-metadata"
	// 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

View Source
var (
	PayloadType_name = map[int32]string{
		0: "COMPRESSABLE",
		1: "UNCOMPRESSABLE",
		2: "RANDOM",
	}
	PayloadType_value = map[string]int32{
		"COMPRESSABLE":   0,
		"UNCOMPRESSABLE": 1,
		"RANDOM":         2,
	}
)

Enum value maps for PayloadType.

Functions

func RegisterTestServiceService

func RegisterTestServiceService(srv *ttrpc.Server, svc TestServiceService)

func RegisterUnimplementedServiceService

func RegisterUnimplementedServiceService(srv *ttrpc.Server, svc UnimplementedServiceService)

func Run

func Run() error

func ScriptMain

func ScriptMain() int

Types

type EchoStatus

type EchoStatus struct {
	Code    int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

A protobuf representation for grpc status. This is used by test clients to specify a status that the server should attempt to return.

func (*EchoStatus) Descriptor deprecated

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

Deprecated: Use EchoStatus.ProtoReflect.Descriptor instead.

func (*EchoStatus) GetCode

func (x *EchoStatus) GetCode() int32

func (*EchoStatus) GetMessage

func (x *EchoStatus) GetMessage() string

func (*EchoStatus) ProtoMessage

func (*EchoStatus) ProtoMessage()

func (*EchoStatus) ProtoReflect

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

func (*EchoStatus) Reset

func (x *EchoStatus) Reset()

func (*EchoStatus) String

func (x *EchoStatus) String() string

type Empty

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

func (*Empty) Descriptor deprecated

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

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

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

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

type Payload

type Payload struct {

	// The type of data in body.
	Type PayloadType `protobuf:"varint,1,opt,name=type,proto3,enum=PayloadType" json:"type,omitempty"`
	// Primary contents of payload.
	Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
	// contains filtered or unexported fields
}

A block of data, to simply increase gRPC message size.

func (*Payload) Descriptor deprecated

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

Deprecated: Use Payload.ProtoReflect.Descriptor instead.

func (*Payload) GetBody

func (x *Payload) GetBody() []byte

func (*Payload) GetType

func (x *Payload) GetType() PayloadType

func (*Payload) ProtoMessage

func (*Payload) ProtoMessage()

func (*Payload) ProtoReflect

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

func (*Payload) Reset

func (x *Payload) Reset()

func (*Payload) String

func (x *Payload) String() string

type PayloadType

type PayloadType int32

The type of payload that should be returned.

const (
	// Compressable text format.
	PayloadType_COMPRESSABLE PayloadType = 0
	// Uncompressable binary format.
	PayloadType_UNCOMPRESSABLE PayloadType = 1
	// Randomly chosen from all other formats defined in this enum.
	PayloadType_RANDOM PayloadType = 2
)

func (PayloadType) Descriptor

func (PayloadType) Enum

func (x PayloadType) Enum() *PayloadType

func (PayloadType) EnumDescriptor deprecated

func (PayloadType) EnumDescriptor() ([]byte, []int)

Deprecated: Use PayloadType.Descriptor instead.

func (PayloadType) Number

func (x PayloadType) Number() protoreflect.EnumNumber

func (PayloadType) String

func (x PayloadType) String() string

func (PayloadType) Type

type ResponseParameters

type ResponseParameters struct {

	// Desired payload sizes in responses from the server.
	// If response_type is COMPRESSABLE, this denotes the size before compression.
	Size int32 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"`
	// Desired interval between consecutive responses in the response stream in
	// microseconds.
	IntervalUs int32 `protobuf:"varint,2,opt,name=interval_us,json=intervalUs,proto3" json:"interval_us,omitempty"`
	// contains filtered or unexported fields
}

Configuration for a particular response.

func (*ResponseParameters) Descriptor deprecated

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

Deprecated: Use ResponseParameters.ProtoReflect.Descriptor instead.

func (*ResponseParameters) GetIntervalUs

func (x *ResponseParameters) GetIntervalUs() int32

func (*ResponseParameters) GetSize

func (x *ResponseParameters) GetSize() int32

func (*ResponseParameters) ProtoMessage

func (*ResponseParameters) ProtoMessage()

func (*ResponseParameters) ProtoReflect

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

func (*ResponseParameters) Reset

func (x *ResponseParameters) Reset()

func (*ResponseParameters) String

func (x *ResponseParameters) String() string

type SimpleRequest

type SimpleRequest struct {

	// Desired payload type in the response from the server.
	// If response_type is RANDOM, server randomly chooses one from other formats.
	ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,proto3,enum=PayloadType" json:"response_type,omitempty"`
	// Desired payload size in the response from the server.
	// If response_type is COMPRESSABLE, this denotes the size before compression.
	ResponseSize int32 `protobuf:"varint,2,opt,name=response_size,json=responseSize,proto3" json:"response_size,omitempty"`
	// Optional input payload sent along with the request.
	Payload *Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
	// Whether SimpleResponse should include username.
	FillUsername bool `protobuf:"varint,4,opt,name=fill_username,json=fillUsername,proto3" json:"fill_username,omitempty"`
	// Whether SimpleResponse should include OAuth scope.
	FillOauthScope bool `protobuf:"varint,5,opt,name=fill_oauth_scope,json=fillOauthScope,proto3" json:"fill_oauth_scope,omitempty"`
	// Whether server should return a given status
	ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus,proto3" json:"response_status,omitempty"`
	// contains filtered or unexported fields
}

Unary request.

func (*SimpleRequest) Descriptor deprecated

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

Deprecated: Use SimpleRequest.ProtoReflect.Descriptor instead.

func (*SimpleRequest) GetFillOauthScope

func (x *SimpleRequest) GetFillOauthScope() bool

func (*SimpleRequest) GetFillUsername

func (x *SimpleRequest) GetFillUsername() bool

func (*SimpleRequest) GetPayload

func (x *SimpleRequest) GetPayload() *Payload

func (*SimpleRequest) GetResponseSize

func (x *SimpleRequest) GetResponseSize() int32

func (*SimpleRequest) GetResponseStatus

func (x *SimpleRequest) GetResponseStatus() *EchoStatus

func (*SimpleRequest) GetResponseType

func (x *SimpleRequest) GetResponseType() PayloadType

func (*SimpleRequest) ProtoMessage

func (*SimpleRequest) ProtoMessage()

func (*SimpleRequest) ProtoReflect

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

func (*SimpleRequest) Reset

func (x *SimpleRequest) Reset()

func (*SimpleRequest) String

func (x *SimpleRequest) String() string

type SimpleResponse

type SimpleResponse struct {

	// Payload to increase message size.
	Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	// The user the request came from, for verifying authentication was
	// successful when the client expected it.
	Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
	// OAuth scope.
	OauthScope string `protobuf:"bytes,3,opt,name=oauth_scope,json=oauthScope,proto3" json:"oauth_scope,omitempty"`
	// contains filtered or unexported fields
}

Unary response, as configured by the request.

func (*SimpleResponse) Descriptor deprecated

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

Deprecated: Use SimpleResponse.ProtoReflect.Descriptor instead.

func (*SimpleResponse) GetOauthScope

func (x *SimpleResponse) GetOauthScope() string

func (*SimpleResponse) GetPayload

func (x *SimpleResponse) GetPayload() *Payload

func (*SimpleResponse) GetUsername

func (x *SimpleResponse) GetUsername() string

func (*SimpleResponse) ProtoMessage

func (*SimpleResponse) ProtoMessage()

func (*SimpleResponse) ProtoReflect

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

func (*SimpleResponse) Reset

func (x *SimpleResponse) Reset()

func (*SimpleResponse) String

func (x *SimpleResponse) String() string

type StreamingInputCallRequest

type StreamingInputCallRequest struct {

	// Optional input payload sent along with the request.
	Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

Client-streaming request.

func (*StreamingInputCallRequest) Descriptor deprecated

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

Deprecated: Use StreamingInputCallRequest.ProtoReflect.Descriptor instead.

func (*StreamingInputCallRequest) GetPayload

func (x *StreamingInputCallRequest) GetPayload() *Payload

func (*StreamingInputCallRequest) ProtoMessage

func (*StreamingInputCallRequest) ProtoMessage()

func (*StreamingInputCallRequest) ProtoReflect

func (*StreamingInputCallRequest) Reset

func (x *StreamingInputCallRequest) Reset()

func (*StreamingInputCallRequest) String

func (x *StreamingInputCallRequest) String() string

type StreamingInputCallResponse

type StreamingInputCallResponse struct {

	// Aggregated size of payloads received from the client.
	AggregatedPayloadSize int32 `` /* 127-byte string literal not displayed */
	// contains filtered or unexported fields
}

Client-streaming response.

func (*StreamingInputCallResponse) Descriptor deprecated

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

Deprecated: Use StreamingInputCallResponse.ProtoReflect.Descriptor instead.

func (*StreamingInputCallResponse) GetAggregatedPayloadSize

func (x *StreamingInputCallResponse) GetAggregatedPayloadSize() int32

func (*StreamingInputCallResponse) ProtoMessage

func (*StreamingInputCallResponse) ProtoMessage()

func (*StreamingInputCallResponse) ProtoReflect

func (*StreamingInputCallResponse) Reset

func (x *StreamingInputCallResponse) Reset()

func (*StreamingInputCallResponse) String

func (x *StreamingInputCallResponse) String() string

type StreamingOutputCallRequest

type StreamingOutputCallRequest struct {

	// Desired payload type in the response from the server.
	// If response_type is RANDOM, the payload from each response in the stream
	// might be of different types. This is to simulate a mixed type of payload
	// stream.
	ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,proto3,enum=PayloadType" json:"response_type,omitempty"`
	// Configuration for each expected response message.
	ResponseParameters []*ResponseParameters `protobuf:"bytes,2,rep,name=response_parameters,json=responseParameters,proto3" json:"response_parameters,omitempty"`
	// Optional input payload sent along with the request.
	Payload *Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
	// Whether server should return a given status
	ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus,proto3" json:"response_status,omitempty"`
	// contains filtered or unexported fields
}

Server-streaming request.

func (*StreamingOutputCallRequest) Descriptor deprecated

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

Deprecated: Use StreamingOutputCallRequest.ProtoReflect.Descriptor instead.

func (*StreamingOutputCallRequest) GetPayload

func (x *StreamingOutputCallRequest) GetPayload() *Payload

func (*StreamingOutputCallRequest) GetResponseParameters

func (x *StreamingOutputCallRequest) GetResponseParameters() []*ResponseParameters

func (*StreamingOutputCallRequest) GetResponseStatus

func (x *StreamingOutputCallRequest) GetResponseStatus() *EchoStatus

func (*StreamingOutputCallRequest) GetResponseType

func (x *StreamingOutputCallRequest) GetResponseType() PayloadType

func (*StreamingOutputCallRequest) ProtoMessage

func (*StreamingOutputCallRequest) ProtoMessage()

func (*StreamingOutputCallRequest) ProtoReflect

func (*StreamingOutputCallRequest) Reset

func (x *StreamingOutputCallRequest) Reset()

func (*StreamingOutputCallRequest) String

func (x *StreamingOutputCallRequest) String() string

type StreamingOutputCallResponse

type StreamingOutputCallResponse struct {

	// Payload to increase response size.
	Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

Server-streaming response, as configured by the request and parameters.

func (*StreamingOutputCallResponse) Descriptor deprecated

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

Deprecated: Use StreamingOutputCallResponse.ProtoReflect.Descriptor instead.

func (*StreamingOutputCallResponse) GetPayload

func (x *StreamingOutputCallResponse) GetPayload() *Payload

func (*StreamingOutputCallResponse) ProtoMessage

func (*StreamingOutputCallResponse) ProtoMessage()

func (*StreamingOutputCallResponse) ProtoReflect

func (*StreamingOutputCallResponse) Reset

func (x *StreamingOutputCallResponse) Reset()

func (*StreamingOutputCallResponse) String

func (x *StreamingOutputCallResponse) String() string

type TestServer

type TestServer struct{}

TestServer implements the TestService interface defined in example.proto.

func (TestServer) EmptyCall

func (TestServer) EmptyCall(ctx context.Context, req *Empty) (*Empty, error)

EmptyCall accepts one empty request and issues one empty response.

func (TestServer) FullDuplexCall

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

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

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

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 *SimpleRequest) (*SimpleResponse, error)

UnaryCall accepts one request and issues one response. The response includes the client's payload as-is.

type TestService_FullDuplexCallClient

type TestService_FullDuplexCallClient interface {
	Send(*StreamingOutputCallRequest) error
	Recv() (*StreamingOutputCallResponse, error)
	ttrpc.ClientStream
}

type TestService_FullDuplexCallServer

type TestService_FullDuplexCallServer interface {
	Send(*StreamingOutputCallResponse) error
	Recv() (*StreamingOutputCallRequest, error)
	ttrpc.StreamServer
}

type TestService_HalfDuplexCallClient

type TestService_HalfDuplexCallClient interface {
	Send(*StreamingOutputCallRequest) error
	Recv() (*StreamingOutputCallResponse, error)
	ttrpc.ClientStream
}

type TestService_HalfDuplexCallServer

type TestService_HalfDuplexCallServer interface {
	Send(*StreamingOutputCallResponse) error
	Recv() (*StreamingOutputCallRequest, error)
	ttrpc.StreamServer
}

type TestService_StreamingInputCallClient

type TestService_StreamingInputCallClient interface {
	Send(*StreamingInputCallRequest) error
	CloseAndRecv() (*StreamingInputCallResponse, error)
	ttrpc.ClientStream
}

type TestService_StreamingInputCallServer

type TestService_StreamingInputCallServer interface {
	Recv() (*StreamingInputCallRequest, error)
	ttrpc.StreamServer
}

type TestService_StreamingOutputCallClient

type TestService_StreamingOutputCallClient interface {
	Recv() (*StreamingOutputCallResponse, error)
	ttrpc.ClientStream
}

type TestService_StreamingOutputCallServer

type TestService_StreamingOutputCallServer interface {
	Send(*StreamingOutputCallResponse) error
	ttrpc.StreamServer
}

type UnimplementedServiceService

type UnimplementedServiceService interface {
	UnimplementedCall(context.Context, *Empty) (*Empty, error)
}

func NewUnimplementedServiceClient

func NewUnimplementedServiceClient(client *ttrpc.Client) UnimplementedServiceService

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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