rpc

package
v3.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 13 Imported by: 12

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 any) 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 any) 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 relay.

func NewCodec

func NewCodec(rwc io.ReadWriteCloser) *Codec

NewCodec initiates new server rpc codec over socket connection.

func NewCodecWithRelay

func NewCodecWithRelay(relay relay.Relay) *Codec

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

func (*Codec) Close

func (c *Codec) Close() error

Close underlying socket.

func (*Codec) ReadRequestBody

func (c *Codec) ReadRequestBody(out any) 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 any) 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