echo

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package echo shows a simple RPC service that can be served with rpcz.

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Echo

type Echo struct{}

Echo service replies back with the message it receives.

func New

func New() *Echo

New returns an instance of Echo.

func (*Echo) Echo

func (s *Echo) Echo(ctx context.Context, req *EchoRequest, resp *EchoResponse) error

Echo handles req and fills in resp.

type EchoRequest

type EchoRequest struct {
	Msg   string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
	Delay int64  `protobuf:"varint,2,opt,name=delay,proto3" json:"delay,omitempty"`
	// contains filtered or unexported fields
}

func (*EchoRequest) Descriptor deprecated

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

Deprecated: Use EchoRequest.ProtoReflect.Descriptor instead.

func (*EchoRequest) GetDelay

func (x *EchoRequest) GetDelay() int64

func (*EchoRequest) GetMsg

func (x *EchoRequest) GetMsg() string

func (*EchoRequest) ProtoMessage

func (*EchoRequest) ProtoMessage()

func (*EchoRequest) ProtoReflect

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

func (*EchoRequest) Reset

func (x *EchoRequest) Reset()

func (*EchoRequest) String

func (x *EchoRequest) String() string

type EchoResponse

type EchoResponse struct {
	Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
	// contains filtered or unexported fields
}

func (*EchoResponse) Descriptor deprecated

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

Deprecated: Use EchoResponse.ProtoReflect.Descriptor instead.

func (*EchoResponse) GetMsg

func (x *EchoResponse) GetMsg() string

func (*EchoResponse) ProtoMessage

func (*EchoResponse) ProtoMessage()

func (*EchoResponse) ProtoReflect

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

func (*EchoResponse) Reset

func (x *EchoResponse) Reset()

func (*EchoResponse) String

func (x *EchoResponse) String() string

type ExtendedEcho

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

ExtendedEcho service replies back with the message it receives.

It shows an example of service-side and caller-defined timeouts.

func NewExtendedEcho

func NewExtendedEcho(timeout time.Duration) *ExtendedEcho

NewExtendedEcho returns a new ExtendedEcho with the specified timeout.

func (*ExtendedEcho) Echo

func (s *ExtendedEcho) Echo(ctx context.Context, req *EchoRequest, resp *EchoResponse) error

Echo handles req and fills in resp.

The service may wait for req.Delay, if specified, but no longer than s.timeout.

Jump to

Keyboard shortcuts

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