shared

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: GPL-3.0 Imports: 3 Imported by: 76

Documentation

Overview

Package shared includes useful utilities globally accessible in the Prysm monorepo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service interface {
	// Start spawns any goroutines required by the service.
	Start()
	// Stop terminates all goroutines belonging to the service,
	// blocking until they are all terminated.
	Stop() error
	// Status returns error if the service is not considered healthy.
	Status() error
}

Service is a struct that can be registered into a ServiceRegistry for easy dependency management.

type ServiceRegistry

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

ServiceRegistry provides a useful pattern for managing services. It allows for ease of dependency management and ensures services dependent on others use the same references in memory.

func NewServiceRegistry

func NewServiceRegistry() *ServiceRegistry

NewServiceRegistry starts a registry instance for convenience

func (*ServiceRegistry) FetchService

func (s *ServiceRegistry) FetchService(service interface{}) error

FetchService takes in a struct pointer and sets the value of that pointer to a service currently stored in the service registry. This ensures the input argument is set to the right pointer that refers to the originally registered service.

func (*ServiceRegistry) RegisterService

func (s *ServiceRegistry) RegisterService(service Service) error

RegisterService appends a service constructor function to the service registry.

func (*ServiceRegistry) StartAll

func (s *ServiceRegistry) StartAll()

StartAll initialized each service in order of registration.

func (*ServiceRegistry) Statuses

func (s *ServiceRegistry) Statuses() map[reflect.Type]error

Statuses returns a map of Service type -> error. The map will be populated with the results of each service.Status() method call.

func (*ServiceRegistry) StopAll

func (s *ServiceRegistry) StopAll()

StopAll ends every service in reverse order of registration, logging a panic if any of them fail to stop.

Directories

Path Synopsis
Package abool provides atomic Boolean type for cleaner code and better performance.
Package abool provides atomic Boolean type for cleaner code and better performance.
Package aggregation contains implementations of bitlist aggregation algorithms and heuristics.
Package aggregation contains implementations of bitlist aggregation algorithms and heuristics.
Package attestationutil contains useful helpers for converting attestations into indexed form.
Package attestationutil contains useful helpers for converting attestations into indexed form.
Package benchutil contains useful helpers for pregenerating filled data structures such as blocks/states for benchmarks.
Package benchutil contains useful helpers for pregenerating filled data structures such as blocks/states for benchmarks.
bls
Package bls implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme.
Package bls implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme.
blst
Package blst implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme.
Package blst implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme.
common
Package common provides the BLS interfaces that are implemented by the various BLS wrappers.
Package common provides the BLS interfaces that are implemented by the various BLS wrappers.
Package bytesutil defines helper methods for converting integers to byte slices.
Package bytesutil defines helper methods for converting integers to byte slices.
Package cmd defines the command line flags for the shared utlities.
Package cmd defines the command line flags for the shared utlities.
Package debug defines useful profiling utils that came originally with go-ethereum.
Package debug defines useful profiling utils that came originally with go-ethereum.
Package depositutil contains useful functions for dealing with Ethereum deposit inputs.
Package depositutil contains useful functions for dealing with Ethereum deposit inputs.
Package event contains an event feed implementation for process communication.
Package event contains an event feed implementation for process communication.
Package featureconfig defines which features are enabled for runtime in order to selectively enable certain features to maintain a stable runtime.
Package featureconfig defines which features are enabled for runtime in order to selectively enable certain features to maintain a stable runtime.
Package gateway defines a grpc-gateway server that serves HTTP-JSON traffic and acts a proxy between HTTP and gRPC.
Package gateway defines a grpc-gateway server that serves HTTP-JSON traffic and acts a proxy between HTTP and gRPC.
Package hashutil includes all hash-function related helpers for Prysm.
Package hashutil includes all hash-function related helpers for Prysm.
Package htrutils defines HashTreeRoot utility functions.
Package htrutils defines HashTreeRoot utility functions.
Package interop contains deterministic utilities for generating genesis states and keys.
Package interop contains deterministic utilities for generating genesis states and keys.
Package iputils contains useful functions for ip address formatting.
Package iputils contains useful functions for ip address formatting.
Package logutil creates a Multi writer instance that write all logs that are written to stdout.
Package logutil creates a Multi writer instance that write all logs that are written to stdout.
Package mathutil includes important helpers for Ethereum such as fast integer square roots.
Package mathutil includes important helpers for Ethereum such as fast integer square roots.
Package maxprocs automatically sets GOMAXPROCS to match the Linux container CPU quota, if any.
Package maxprocs automatically sets GOMAXPROCS to match the Linux container CPU quota, if any.
Package mclockutil is a wrapper for a monotonic clock source.
Package mclockutil is a wrapper for a monotonic clock source.
Package messagehandler contains useful helpers for recovering from panic conditions at runtime and logging their trace.
Package messagehandler contains useful helpers for recovering from panic conditions at runtime and logging their trace.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package p2putils contains useful helpers for Ethereum consensus fork-related functionality.
Package p2putils contains useful helpers for Ethereum consensus fork-related functionality.
Package pagination contains useful pagination-related helpers.
Package pagination contains useful pagination-related helpers.
Package params defines important constants that are essential to Prysm services.
Package params defines important constants that are essential to Prysm services.
Package prometheus defines a service which is used for metrics collection and health of a node in Prysm.
Package prometheus defines a service which is used for metrics collection and health of a node in Prysm.
Package queue provides Vault plugins with a Priority Queue.
Package queue provides Vault plugins with a Priority Queue.
Package rand defines methods of obtaining cryptographically secure random number generators.
Package rand defines methods of obtaining cryptographically secure random number generators.
Package runutil includes helpers for scheduling runnable, periodic functions.
Package runutil includes helpers for scheduling runnable, periodic functions.
Package sliceutil implements set operations for specified data type Currently types which are tested and supported are: []uint32 []int32 []string []float32 []uint64 []int64 []string []float64 Intersection, Union, Not , IsIn are the operations which are supported on slices
Package sliceutil implements set operations for specified data type Currently types which are tested and supported are: []uint32 []int32 []string []float32 []uint64 []int64 []string []float64 Intersection, Union, Not , IsIn are the operations which are supported on slices
Package slotutil includes ticker and timer-related functions for Ethereum consensus.
Package slotutil includes ticker and timer-related functions for Ethereum consensus.
testing
Package testing includes useful mocks for slot tickers in unit tests.
Package testing includes useful mocks for slot tickers in unit tests.
Package timeutils is a wrapper around the go standard time library.
Package timeutils is a wrapper around the go standard time library.
Package traceutil includes useful functions for opentracing annotations.
Package traceutil includes useful functions for opentracing annotations.
Package tracing sets up jaeger as an opentracing tool for services in Prysm.
Package tracing sets up jaeger as an opentracing tool for services in Prysm.
Package trieutil defines utilities for sparse merkle tries for Ethereum consensus.
Package trieutil defines utilities for sparse merkle tries for Ethereum consensus.
Package version executes and returns the version string for the currently running process.
Package version executes and returns the version string for the currently running process.

Jump to

Keyboard shortcuts

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