grpcfine

package
v0.0.0-...-d39c007 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_grpcfine_proto protoreflect.FileDescriptor
View Source
var Transport_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "grpcfine.fine.viceroy.v1.Transport",
	HandlerType: (*TransportServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Stream",
			Handler:       _Transport_Stream_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "grpcfine.proto",
}

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

Functions

func NewClientTransport

func NewClientTransport(stream Transport_StreamClient, codec Codec) fine.Transport

NewClientTransport returns a new fine.Transport from a gRPC Transport stream.

func NewServerStreamHandler

func NewServerStreamHandler(l log.Logger, stream Transport_StreamServer, codec Codec) (server.Handler, func(), error)

NewServerStreamHandler converts a Transport server stream into an server.Handler that can be used invoke commands. Call Wait to wait for the handler to close.

func RegisterTransportServer

func RegisterTransportServer(s grpc.ServiceRegistrar, srv TransportServer)

func WithCodec

func WithCodec(ctx context.Context, c Codec) context.Context

WithCodec injects a Condec into a gRPC reuqest context.

Types

type Codec

type Codec interface {
	Name() string

	DecodeRequest(*Request) (fine.RequestHeader, fine.Request, error)
	DecodeResponse(*Response) (fine.ResponseHeader, fine.Response, error)
	EncodeRequest(*fine.RequestHeader, fine.Request) (*Request, error)
	EncodeResponse(*fine.ResponseHeader, fine.Response) (*Response, error)
}

func GetCodec

func GetCodec(ctx context.Context) (Codec, error)

GetCodec retrieves a Codec from a gRPC request context. If there was no codec, the default codec is used.

func MsgpackCodec

func MsgpackCodec() Codec

MsgpackCodec returns a Codec using msgpack.

type Request

type Request struct {
	Header []byte `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	Data   []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

Request is a serialized FINE request. The request header and request data are specified separately. Data may be empty for requests that do not have any payload.

func (*Request) Descriptor deprecated

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

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetData

func (x *Request) GetData() []byte

func (*Request) GetHeader

func (x *Request) GetHeader() []byte

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

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

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type Response

type Response struct {
	Header []byte `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	Data   []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

Response is a serialized FINE response. The response header and response data are specified separately. Data may be empty for resposnes that do not have any payload, or when the header indicates an error.

func (*Response) Descriptor deprecated

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

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetData

func (x *Response) GetData() []byte

func (*Response) GetHeader

func (x *Response) GetHeader() []byte

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

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

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type TransportClient

type TransportClient interface {
	Stream(ctx context.Context, opts ...grpc.CallOption) (Transport_StreamClient, error)
}

TransportClient is the client API for Transport 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 NewTransportClient

func NewTransportClient(cc grpc.ClientConnInterface) TransportClient

type TransportServer

type TransportServer interface {
	Stream(Transport_StreamServer) error
	// contains filtered or unexported methods
}

TransportServer is the server API for Transport service. All implementations must embed UnimplementedTransportServer for forward compatibility

type Transport_StreamClient

type Transport_StreamClient interface {
	Send(*Response) error
	Recv() (*Request, error)
	grpc.ClientStream
}

type Transport_StreamServer

type Transport_StreamServer interface {
	Send(*Request) error
	Recv() (*Response, error)
	grpc.ServerStream
}

type UnimplementedTransportServer

type UnimplementedTransportServer struct {
}

UnimplementedTransportServer must be embedded to have forward compatible implementations.

func (UnimplementedTransportServer) Stream

type UnsafeTransportServer

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

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

Jump to

Keyboard shortcuts

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