rpc

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaximumQueueSize          = 1024
	MaximumRequestPacketSize  = 1024
	MaximumResponsePacketSize = 1024
	NumWorkers                = 1
)
View Source
const (
	MinimumRequestSize  = 22
	MinimumResponseSize = 21
)
View Source
const (
	Timeout = 5 * time.Second
)

Variables

View Source
var (
	DecodeErr = errors.New("unable to decode buffer")
)

Functions

func DecodeUUID

func DecodeUUID(buf []byte) (uuid.UUID, error)

Types

type Client

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

func NewClient

func NewClient(handle HandleFunc, logger logging.Logger) *Client

func (*Client) HandleConnection

func (c *Client) HandleConnection(conn io.ReadWriteCloser)

type HandleFunc

type HandleFunc func(*Request, *Response)

type InflightRequest

type InflightRequest struct {
	Request       *Request
	Response      *Response
	RequestBuffer *polyglot.Buffer
	// contains filtered or unexported fields
}

type ProcessRequest

type ProcessRequest struct {
	Request        Request
	Response       Response
	ResponseBuffer *polyglot.Buffer
}

type Request

type Request struct {
	UUID uuid.UUID
	Type uint32
	Data []byte
}

func (*Request) Decode

func (r *Request) Decode(buf []byte) error

func (*Request) Encode

func (r *Request) Encode(buf *polyglot.Buffer)

type Response

type Response struct {
	UUID  uuid.UUID
	Error error
	Data  []byte
}

func (*Response) Decode

func (r *Response) Decode(buf []byte) error

func (*Response) Encode

func (r *Response) Encode(buf *polyglot.Buffer)

type Server

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

func NewServer

func NewServer(ctx context.Context, logger logging.Logger) *Server

func (*Server) Do

func (s *Server) Do(ctx context.Context, request *Request, response *Response) (err error)

func (*Server) HandleConnection

func (s *Server) HandleConnection(conn io.ReadWriteCloser)

Jump to

Keyboard shortcuts

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