service

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package service is a generated protocol buffer package.

It is generated from these files:

service/service.proto

It has these top-level messages:

NowRequest
NowResponse
SleepRequest
SleepResponse

Package service is a reverse proxy.

It translates gRPC into JSON-RPC 2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTimeServer

func RegisterTimeServer(s *grpc.Server, srv TimeServer)

Types

type NowRequest

type NowRequest struct {
	// Локация
	Location string `protobuf:"bytes,1,opt,name=location" json:"location,omitempty"`
}

Запрос текущего времени сервера

func (*NowRequest) Descriptor

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

func (*NowRequest) GetLocation

func (m *NowRequest) GetLocation() string

func (*NowRequest) ProtoMessage

func (*NowRequest) ProtoMessage()

func (*NowRequest) Reset

func (m *NowRequest) Reset()

func (*NowRequest) String

func (m *NowRequest) String() string

type NowResponse

type NowResponse struct {
	// Локация
	Location string `protobuf:"bytes,1,opt,name=location" json:"location,omitempty"`
	// Текущее время
	Now string `protobuf:"bytes,2,opt,name=now" json:"now,omitempty"`
}

Ответ с текущим временем сервера

func (*NowResponse) Descriptor

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

func (*NowResponse) GetLocation

func (m *NowResponse) GetLocation() string

func (*NowResponse) GetNow

func (m *NowResponse) GetNow() string

func (*NowResponse) ProtoMessage

func (*NowResponse) ProtoMessage()

func (*NowResponse) Reset

func (m *NowResponse) Reset()

func (*NowResponse) String

func (m *NowResponse) String() string

type SleepRequest

type SleepRequest struct {
	// Продолжительность сна
	Duration string `protobuf:"bytes,1,opt,name=duration" json:"duration,omitempty"`
}

Запрос

func (*SleepRequest) Descriptor

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

func (*SleepRequest) GetDuration

func (m *SleepRequest) GetDuration() string

func (*SleepRequest) ProtoMessage

func (*SleepRequest) ProtoMessage()

func (*SleepRequest) Reset

func (m *SleepRequest) Reset()

func (*SleepRequest) String

func (m *SleepRequest) String() string

type SleepResponse

type SleepResponse struct {
	// Результат сна
	Result string `protobuf:"bytes,1,opt,name=result" json:"result,omitempty"`
}

Ответ

func (*SleepResponse) Descriptor

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

func (*SleepResponse) GetResult

func (m *SleepResponse) GetResult() string

func (*SleepResponse) ProtoMessage

func (*SleepResponse) ProtoMessage()

func (*SleepResponse) Reset

func (m *SleepResponse) Reset()

func (*SleepResponse) String

func (m *SleepResponse) String() string

type TimeClient

type TimeClient interface {
	// Возвращает текущее время сервера в указанной локации
	Now(ctx context.Context, in *NowRequest, opts ...grpc.CallOption) (*NowResponse, error)
	// Засыпает на указанный промежуток времени
	Sleep(ctx context.Context, in *SleepRequest, opts ...grpc.CallOption) (*SleepResponse, error)
}

func NewTimeClient

func NewTimeClient(cc *grpc.ClientConn) TimeClient

type TimeServer

type TimeServer interface {
	// Возвращает текущее время сервера в указанной локации
	Now(context.Context, *NowRequest) (*NowResponse, error)
	// Засыпает на указанный промежуток времени
	Sleep(context.Context, *SleepRequest) (*SleepResponse, error)
}

type TimeService

type TimeService struct {
	Address       string
	Opts          []grpc.DialOption
	TagToString   func(jsonrpc.MethodTag) string
	TagFromString func(string) jsonrpc.MethodTag
}

func (*TimeService) Exec

func (s *TimeService) Exec(ctx context.Context, method string, params io.Reader) (proto.Message, error)

func (*TimeService) JsonrpcService

func (*TimeService) JsonrpcService()

func (*TimeService) Methods

func (s *TimeService) Methods() []string

Jump to

Keyboard shortcuts

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