focus

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrShutdown = errors.New("connection is shut down")

Functions

This section is empty.

Types

type Call

type Call struct {
	Service string     // The name of the service to call.
	Method  string     // The name of the method to call.
	Args    any        // The argument to the function (*struct).
	Reply   any        // The reply from the function (*struct).
	Error   error      // After completion, the error status.
	Done    chan *Call // Receives *Call when Go is complete.
}

Call represents an active RPC.

type Client

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

Client rpc client based on net/tcp implementation

func NewClient

func NewClient(opts options.ClientOptions) *Client

NewClient Create a new rpc client

func (*Client) AsyncCall

func (c *Client) AsyncCall(service string, method string, args interface{}, reply interface{}) chan *Call

AsyncCall asynchronously calls the rpc function and returns a channel

func (*Client) Call

func (c *Client) Call(service string, method string, args interface{}, reply interface{}) error

Call synchronously calls the rpc function

func (*Client) Close

func (client *Client) Close()

func (*Client) Go

func (client *Client) Go(service string, method string, args any, reply any, done chan *Call) *Call

type Server

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

func NewServer

func NewServer(opts options.ServerOptions) *Server

func (*Server) Close

func (s *Server) Close()

func (*Server) Register

func (s *Server) Register(rcvr interface{}) error

Register register rpc function

func (*Server) RegisterName

func (s *Server) RegisterName(name string, rcvr interface{}) error

RegisterName register the rpc function with the specified name

func (*Server) Start

func (s *Server) Start()

type StatusType

type StatusType struct {
	Code    int
	Message string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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