rpc

package
v0.0.0-...-5961e9c Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientCodec

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

ClientCodec is codec for goridge connection.

func NewClientCodec

func NewClientCodec(rwc io.ReadWriteCloser) *ClientCodec

NewClientCodec initiates new server rpc codec over socket connection.

func (*ClientCodec) Close

func (c *ClientCodec) Close() error

Close closes the client connection.

func (*ClientCodec) ReadResponseBody

func (c *ClientCodec) ReadResponseBody(out interface{}) error

ReadResponseBody response from the connection.

func (*ClientCodec) ReadResponseHeader

func (c *ClientCodec) ReadResponseHeader(r *rpc.Response) error

ReadResponseHeader reads response from the connection.

func (*ClientCodec) WriteRequest

func (c *ClientCodec) WriteRequest(r *rpc.Request, body interface{}) error

WriteRequest writes request to the connection. Sequential.

type Codec

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

Codec represent net/rpc bridge over Goridge socket transfer.

func NewCodec

func NewCodec(rwc io.ReadWriteCloser) *Codec

NewCodec initiates new server rpc codec over socket connection.

func NewCodecWithTransfer

func NewCodecWithTransfer(transfer frame.Transfer) *Codec

NewCodecWithRelay initiates new server rpc codec with a transfer of choice.

func (*Codec) Close

func (c *Codec) Close() error

Close underlying socket.

func (*Codec) ReadRequestBody

func (c *Codec) ReadRequestBody(out interface{}) error

ReadRequestBody fetches prefixed body data and automatically unmarshal it as json. RawBody flag will populate []byte lice argument for rpc method.

func (*Codec) ReadRequestHeader

func (c *Codec) ReadRequestHeader(r *rpc.Request) error

ReadRequestHeader receives frame with options options should have 2 values [0] - integer, sequence ID [1] - integer, offset for method name For example: 15Test.Payload SEQ_ID: 15 METHOD_LEN: 12 and we take 12 bytes from the payload as method name

func (*Codec) WriteResponse

func (c *Codec) WriteResponse(r *rpc.Response, body interface{}) error

WriteResponse marshals response, byte slice or error to remote party.

Jump to

Keyboard shortcuts

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