rpc

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ID = "rpc"

ID contains default service name.

Variables

This section is empty.

Functions

This section is empty.

Types

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 service.Config, reg service.Container) (enabled bool, err error)

Init must return configure service and return true if service hasStatus enabled. Must return error in case of misconfiguration. Services must not be used without proper configuration pushed first.

func (*Service) Register

func (s *Service) Register(name string, rcvr 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