maingoroutine

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package maingoroutine 简化[https://github.com/ethereum/go-ethereum]供当前项目使用

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGoroutineRunning = fmt.Errorf("main goroutine already running")
	ErrGoroutineClosed  = fmt.Errorf("main goroutine not started")
)
View Source
var (
	ErrHttpServerRunning = fmt.Errorf("http server already running")
)

Functions

This section is empty.

Types

type API

type API struct {
	Namespace string
	Service   interface{}
	Public    bool
}

type Config

type Config struct {
	Logger *zap.Logger

	EnableHTTP    bool
	HTTPHost      string
	HTTPPort      uint16
	EnableHTTPRPC bool
}

type Goroutine

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

func New

func New(config Config) (stack *Goroutine)

func (*Goroutine) AttachRPC

func (g *Goroutine) AttachRPC(ctx context.Context) *rpc.Client

func (*Goroutine) Close

func (g *Goroutine) Close() (errs []error)

func (*Goroutine) RegisterRPC

func (g *Goroutine) RegisterRPC(apis ...API) error

func (*Goroutine) RegisterService

func (g *Goroutine) RegisterService(service Service) error

func (*Goroutine) Start

func (g *Goroutine) Start() error

func (*Goroutine) Wait

func (g *Goroutine) Wait()

type Service

type Service interface {
	Start() error
	Stop() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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