Versions in this module Expand all Collapse all v0 v0.2.0 Jul 29, 2026 Changes in this version + const MaxPayloadSize + var DefaultPool = NewTieredPool(128, 512, 2048, 8192, 32768, 65536, 262144, 524288, 1048576, MaxPayloadSize) + var ErrClosed = errors.New("mrpc: connection has been closed") + var ErrMaxPayload = errors.New("mrpc: payload exceeds maximum size") + var ErrShutdown = errors.New("mrpc: client is shut down") + func PutFrame(payload []byte) + func ReadFrame(r io.Reader) ([]byte, error) + func RegisterHealth() *healthService + func SendRequest(w io.Writer, req *Request) error + func SendResponse(w io.Writer, resp *Response) error + func WriteFrame(w io.Writer, payload []byte) error + type Client struct + func NewClient(address string, port int) *Client + func NewClinet(address string, port int) *Client + func (c *Client) Call(method string, argv any, reply any) error + func (c *Client) Close() error + func (c *Client) Dial() error + type Codec interface + Decode func(data []byte, v any) error + Encode func(v any) ([]byte, error) + type HealthChecker struct + func NewHealthChecker(interval, timeout time.Duration) *HealthChecker + func (hc *HealthChecker) Start(client *Client, maxFailures int, onFailure func(error)) + func (hc *HealthChecker) Stop() + type HealthReply struct + Ok bool + type HealthRequest struct + type MsgCodec struct + func NewMsgCodec() *MsgCodec + func (mc *MsgCodec) Decode(data []byte, v any) error + func (mc *MsgCodec) Encode(v any) ([]byte, error) + type RPCMethod struct + ReplyType reflect.Type + ReqType reflect.Type + type Request struct + Argv []byte + Seq uint64 + ServiceMethod string + func NewRequest(method string, seq uint64, argv []byte) *Request + func ReceiveRequest(r io.Reader) (*Request, error) + func (re *Request) Decode(data []byte) error + func (re *Request) Encode() ([]byte, error) + type Response struct + Error string + Reply []byte + Seq uint64 + func NewResponse(seq uint64, reply []byte, err string) *Response + func ReceiveResponse(r io.Reader) (*Response, error) + func (rs *Response) Decode(data []byte) error + func (rs *Response) Encode() ([]byte, error) + type Server struct + func NewServer(lis net.Listener) *Server + func (s *Server) NewConn(con net.Conn, codec Codec) *connect + func (s *Server) Register(name string, target any) error + func (s *Server) Registery(name string, target any) error + func (s *Server) Run() + type TieredPool struct + func NewTieredPool(capacities ...int) *TieredPool + func (tp *TieredPool) Get(size int) []byte + func (tp *TieredPool) Put(buf []byte)