rpc

package
v0.0.0-...-2ce89f0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Wrapper for RPC client

func NewClient

func NewClient(addr net.Addr) *Client

Construct new client object

func (*Client) Call

func (client *Client) Call(serviceMethod string, args any, reply any) error

Invoke RPC method

func (*Client) Connect

func (client *Client) Connect() error

Connect to RPC server. Blocking

Idempotent. Returns nil if already connected. Each call to this function must be followed by a corresponding disconnect

func (*Client) Disconnect

func (client *Client) Disconnect() error

Disconnect from RPC server.

Idempotent. Returns nil if already disconnected

type Server

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

Wrapper for RPC server

func NewServer

func NewServer(addr net.Addr) *Server

Construct new server object

func (*Server) Down

func (server *Server) Down() error

Shutdown RPC server. Blocks until all connections to the server are terminated. Successful call indicates that server can be started again

Idempotent. Returns nil if already stopped

func (*Server) Register

func (server *Server) Register(rcvr any) error

Register rcvr object as RPC receiver. Having multiple receivers of different types is allowed

func (*Server) Up

func (server *Server) Up() error

Begin to accept incoming RPS requests. Non-blocking

Idempotent. Returns nil if already running i.e. has not been stopped since the last startup. Each call to this function must be followed by a corresponding shutdown

Jump to

Keyboard shortcuts

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