Version: v1.9.2 Latest Latest

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 9 Imported by: 13




View Source
const ID = "rpc"

ID contains default service name.


This section is empty.


This section is empty.


type Config added in v1.1.0

type Config struct {
	// Indicates if RPC connection is enabled.
	Enable bool

	// Listen string
	Listen string

Config defines RPC service config.

func (*Config) Dialer added in v1.1.0

func (c *Config) Dialer() (net.Conn, error)

Dialer creates rpc socket Dialer.

func (*Config) Hydrate added in v1.1.0

func (c *Config) Hydrate(cfg service.Config) error

Hydrate must populate Config values using given Config source. Must return error if Config is not valid.

func (*Config) InitDefaults added in v1.2.2

func (c *Config) InitDefaults() error

InitDefaults allows to init blank config with pre-defined set of default values.

func (*Config) Listener added in v1.1.0

func (c *Config) Listener() (net.Listener, error)

Listener creates new rpc socket Listener.

func (*Config) Valid added in v1.1.0

func (c *Config) Valid() error

Valid returns nil if config is valid.

type Service

type Service struct {
	// contains filtered or unexported fields

Service is RPC service.

func (*Service) Client

func (s *Service) Client() (*rpc.Client, error)

Client creates new RPC client.

func (*Service) Init

func (s *Service) Init(cfg *Config, c service.Container, env env.Environment) (bool, error)

Init rpc service. Must return true if service is enabled.

func (*Service) Register

func (s *Service) Register(name string, svc interface{}) error

Register publishes in the server the set of methods of the receiver value that satisfy the following conditions:

- exported method of exported type
- two arguments, both of exported type
- the second argument is a pointer
- one return value, of type error

It returns an error if the receiver is not an exported type or has no suitable methods. It also logs the error using package log.

func (*Service) Serve

func (s *Service) Serve() error

Serve serves the service.

func (*Service) Stop

func (s *Service) Stop()

Stop stops the service.

Jump to

Keyboard shortcuts

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