server

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServerStopped = errors.New("web3 gateway server not started")
	ErrServerRunning = errors.New("web3 gateway server already running")
)

Functions

func CheckTimeouts

func CheckTimeouts(timeouts *rpc.HTTPTimeouts)

CheckTimeouts ensures that timeout values are meaningful.

func RegisterApis

func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server, exposeAll bool) error

RegisterApis registers all of the APIs exposed by the services.

Types

type HealthCheck

type HealthCheck interface {
	// Health checks the health of the service.
	//
	// This method should return quickly and should avoid performing any blocking operations.
	Health() error
}

HealthCheck is the health checker interface.

type Server

type Server struct {
	Config *conf.Config
	Web3   *Web3Gateway
	DB     storage.Storage
}

func (*Server) Close

func (s *Server) Close() error

func (*Server) Start

func (s *Server) Start() error

func (*Server) Wait

func (s *Server) Wait()

type Web3Gateway

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

Web3Gateway is a container on which services can be registered.

func New

func New(ctx context.Context, conf *conf.GatewayConfig) (*Web3Gateway, error)

New creates a new web3 gateway.

func (*Web3Gateway) Close

func (srv *Web3Gateway) Close() error

Close stops the Web3Gateway Server and releases resources acquired in Web3Gateway Server constructor New.

func (*Web3Gateway) GetHTTPEndpoint

func (srv *Web3Gateway) GetHTTPEndpoint() (string, error)

GetHTTPEndpoint returns the address of HTTP endpoint.

func (*Web3Gateway) GetWSEndpoint

func (srv *Web3Gateway) GetWSEndpoint() (string, error)

GetWSEndpoint returns the address of Websocket endpoint.

func (*Web3Gateway) RegisterAPIs

func (srv *Web3Gateway) RegisterAPIs(apis []rpc.API)

RegisterAPIs registers the APIs a service provides on the server.

func (*Web3Gateway) RegisterHealthChecks

func (srv *Web3Gateway) RegisterHealthChecks(checks []HealthCheck)

RegisterHealthChecks registers the health checks for the /health endpoint.

func (*Web3Gateway) Start

func (srv *Web3Gateway) Start() error

Start Web3Gateway can only be started once.

func (*Web3Gateway) Wait

func (srv *Web3Gateway) Wait()

Wait blocks until the server is closed.

Jump to

Keyboard shortcuts

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