service

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GroupIDShards       = map[nodeconfig.ShardID]nodeconfig.GroupID{}
	GroupIDShardClients = map[nodeconfig.ShardID]nodeconfig.GroupID{}
)

GroupIDShards is a map of ShardGroupID ID key is the shard ID value is the corresponding group ID

Functions

This section is empty.

Types

type Manager

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

Manager stores all services for service manager.

func NewManager

func NewManager() *Manager

NewManager creates a new manager

func (*Manager) GetService

func (m *Manager) GetService(t Type) Service

GetService get the specified service

func (*Manager) GetServices

func (m *Manager) GetServices() []Service

GetServices returns all registered services.

func (*Manager) Register

func (m *Manager) Register(t Type, service Service)

Register registers new service to service store.

func (*Manager) StartServices

func (m *Manager) StartServices() (err error)

StartServices run all registered services. If one of the starting service returns an error, closing all started services.

func (*Manager) StopServices

func (m *Manager) StopServices() error

StopServices stops all services in the reverse order.

type NodeConfig

type NodeConfig struct {
	// The three groupID design, please refer to https://github.com/PositionExchange/posichain/blob/master/node/node.md#libp2p-integration
	Beacon       nodeconfig.GroupID                           // the beacon group ID
	ShardGroupID nodeconfig.GroupID                           // the group ID of the shard
	Client       nodeconfig.GroupID                           // the client group ID of the shard
	IsBeacon     bool                                         // whether this node is a beacon node or not
	ShardID      uint32                                       // shardID of this node
	Actions      map[nodeconfig.GroupID]nodeconfig.ActionType // actions on the groups
}

NodeConfig defines a structure of node configuration that can be used in services. This is to pass node configuration to services and prvent cyclic imports

type Service

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

Service is the collection of functions any service needs to implement.

type Type

type Type byte

Type is service type.

const (
	UnknownService Type = iota
	ClientSupport
	SupportExplorer
	Consensus
	BlockProposal
	NetworkInfo
	Pprof
	Prometheus
	Synchronize
	CrosslinkSending
)

Constants for Type.

func (Type) String

func (t Type) String() string

Directories

Path Synopsis
TODO: refactor this whole module to v0 and v1
TODO: refactor this whole module to v0 and v1
Package prometheus defines a service which is used for metrics collection and health of a node in Harmony.
Package prometheus defines a service which is used for metrics collection and health of a node in Harmony.

Jump to

Keyboard shortcuts

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