wire

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: 5 Imported by: 0

README

Wire

This is an internal package that defines the communication protocol for rpcz.

The definitions can be generated by running:

protoc -I=./ --go_out=./ --go_opt=paths=source_relative ./wire.proto

Request

A request is represented by the Request type. Its fileds have the following characteristics:

Name Type Meaning
kind int32 Holds the encoding of a request.
id uint64 Specifies the unique id of a request, set by the client.
service string The target service the client is requesting.
method string The method on the service the client is calling.
data bytes Protbuf-encoded* arguments of the request.

This is used to encode any type of arguments. Both client and server encoders take care of properly dealing with this. It's a simplified version of the official method for encoding a value of any type using Protobuf. We just don't send the type information since it's already known by the server from the methods' signatures.

Response

A response is represented similarly to Request with one extra field for an error:

Name Type Meaning
kind int32 Holds the encoding of a request.
id uint64 Specifies the unique id of a request, set by the client.
service string The target service the client is requesting.
method string The method on the service the client is calling.
error string Holds the error returned by the method.
data bytes Protbuf-encoded* arguments of the request.

See the explanation above for the Request type.

Invalid Request

The InvalidRequest type is used as a body on a response that has resulted into an error.

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type InvalidRequest

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

func (*InvalidRequest) Descriptor deprecated

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

Deprecated: Use InvalidRequest.ProtoReflect.Descriptor instead.

func (*InvalidRequest) ProtoMessage

func (*InvalidRequest) ProtoMessage()

func (*InvalidRequest) ProtoReflect

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

func (*InvalidRequest) Reset

func (x *InvalidRequest) Reset()

func (*InvalidRequest) String

func (x *InvalidRequest) String() string

type Request

type Request struct {
	Kind    int32  `protobuf:"varint,1,opt,name=kind,proto3" json:"kind,omitempty"`
	Id      uint64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
	Service string `protobuf:"bytes,3,opt,name=service,proto3" json:"service,omitempty"`
	Method  string `protobuf:"bytes,4,opt,name=method,proto3" json:"method,omitempty"`
	Data    []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

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) GetId

func (x *Request) GetId() uint64

func (*Request) GetKind

func (x *Request) GetKind() int32

func (*Request) GetMethod

func (x *Request) GetMethod() string

func (*Request) GetService

func (x *Request) GetService() string

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 {
	Kind    int32  `protobuf:"varint,1,opt,name=kind,proto3" json:"kind,omitempty"`
	Id      uint64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
	Service string `protobuf:"bytes,3,opt,name=service,proto3" json:"service,omitempty"`
	Method  string `protobuf:"bytes,4,opt,name=method,proto3" json:"method,omitempty"`
	Error   string `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"`
	Data    []byte `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

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) GetError

func (x *Response) GetError() string

func (*Response) GetId

func (x *Response) GetId() uint64

func (*Response) GetKind

func (x *Response) GetKind() int32

func (*Response) GetMethod

func (x *Response) GetMethod() string

func (*Response) GetService

func (x *Response) GetService() string

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

Jump to

Keyboard shortcuts

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