rpc

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(mgr process.IManager, t reflect.Type) (bool, error)

func Spawn

func Spawn(mgr process.IManager, lgr logger.ILogger, ctx context.Context, cnf *Config) (*process.Process, error)

Types

type Client

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

func NewClient

func NewClient(cnf *Config, lgr logger.ILogger) *Client

func (*Client) Call

func (c *Client) Call(method string, args any, reply any) error

func (*Client) Close

func (c *Client) Close() error

func (*Client) Dial

func (c *Client) Dial() error

type Config

type Config struct {
	Proto string `json:"protocol"`
	Addr  string `json:"address"`
}

func NewConfig

func NewConfig(proto, addr string) *Config

func NewDefaultConfig

func NewDefaultConfig() *Config

type IManager

type IManager interface {
	SetContext(context.Context)
	SetLogger(logger.ILogger)
	Add(reflect.Type) bool
	Start()
	Shutdown()
}

type IRPCAble

type IRPCAble interface {
	RpcInfo(NoArgs, *Info) error
}

func NewRPCAble

func NewRPCAble(t reflect.Type) IRPCAble

type Info

type Info struct {
	Name    string
	Version int
}

func NewInfo

func NewInfo(name string, version int) *Info

func (*Info) String

func (i *Info) String() string

type Manager

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

func NewManager

func NewManager(cnf *Config, ctx context.Context, lgr logger.ILogger) *Manager

func (*Manager) Add

func (m *Manager) Add(t reflect.Type) bool

func (*Manager) SetContext

func (m *Manager) SetContext(parent context.Context)

func (*Manager) SetLogger

func (m *Manager) SetLogger(lgr logger.ILogger)

func (*Manager) Shutdown

func (m *Manager) Shutdown()

func (*Manager) Start

func (m *Manager) Start()

type ManagerProc

type ManagerProc struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewManagerProc

func NewManagerProc(lgr logger.ILogger, ctx context.Context, config *Config) *ManagerProc

func (*ManagerProc) Action

func (p *ManagerProc) Action(state **process.State)

type NoArgs

type NoArgs struct{}

Jump to

Keyboard shortcuts

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