rpc

package
v0.1.8-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2019 License: GPL-3.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMethodArgType creates an error about an invalid type
	// sent as an argument to a RPC method
	ErrMethodArgType = func(expectedType string) error {
		return fmt.Errorf("invalid argument type: expecting " + expectedType)
	}
)

Functions

This section is empty.

Types

type Result

type Result struct {
	Error   string
	ErrCode int
	Status  int
	Data    map[string]interface{}
}

Result represent a response to a service method call

type Server

type Server struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Server represents a rpc server

func NewServer

func NewServer(db elldb.DB, addr string, cfg *config.EngineConfig, log logger.Logger) *Server

NewServer creates a new RPC server

func (*Server) APIs

func (s *Server) APIs() jsonrpc.APISet

APIs returns all API handlers

func (*Server) AddAPI

func (s *Server) AddAPI(apis ...jsonrpc.APISet)

AddAPI adds one or more API sets

func (*Server) GetAddr

func (s *Server) GetAddr() string

GetAddr gets the address

func (*Server) IsStarted

func (s *Server) IsStarted() bool

IsStarted returns the start state

func (*Server) Serve

func (s *Server) Serve()

Serve starts the server

func (*Server) Stop

func (s *Server) Stop()

Stop stops the server and frees resources

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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