Documentation ¶
Index ¶
- func New[S any](opts ...Option[S]) *S
- type BaseService
- func (s *BaseService) AvailabilityStore(ctx context.Context) core.AvailabilityStore
- func (s *BaseService) BeaconCfg() *params.BeaconChainConfig
- func (s *BaseService) BeaconState(ctx context.Context) state.BeaconState
- func (s *BaseService) BuilderCfg() *builderconfig.Config
- func (s *BaseService) Logger() log.Logger
- func (s *BaseService) Name() string
- func (s *BaseService) SetStatus(err error)
- func (s BaseService) ShallowCopy(name string) BaseService
- func (s *BaseService) Start(context.Context)
- func (s *BaseService) Status() error
- func (s *BaseService) WaitForHealthy(context.Context)
- type Basic
- type BeaconStorageBackend
- type Option
- type Registry
- func (s *Registry) FetchService(service interface{}) error
- func (s *Registry) RegisterService(service Basic) error
- func (s *Registry) StartAll(ctx context.Context)
- func (s *Registry) Statuses(services ...string) map[string]error
- func (s *Registry) WaitForHealthy(ctx context.Context, services ...string)
- type RegistryOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseService ¶
type BaseService struct {
// contains filtered or unexported fields
}
BaseService is a base service that provides common functionality for all services.
func NewBaseService ¶
func NewBaseService( cfg *config.Config, bsp BeaconStorageBackend, logger log.Logger, ) *BaseService
NewBaseService creates a new BaseService and applies the provided options.
func (*BaseService) AvailabilityStore ¶
func (s *BaseService) AvailabilityStore( ctx context.Context, ) core.AvailabilityStore
AvailabilityStore returns the availability store from the BaseService.
func (*BaseService) BeaconCfg ¶
func (s *BaseService) BeaconCfg() *params.BeaconChainConfig
BeaconCfg returns the configuration settings of the beacon node from the BaseService.
func (*BaseService) BeaconState ¶
func (s *BaseService) BeaconState(ctx context.Context) state.BeaconState
BeaconState returns the beacon state from the BaseService.
func (*BaseService) BuilderCfg ¶
func (s *BaseService) BuilderCfg() *builderconfig.Config
BuilderCfg returns the configuration settings of the builder from the BaseService.
func (*BaseService) Logger ¶
func (s *BaseService) Logger() log.Logger
Logger returns the logger instance of the BaseService. It is used for logging messages in a structured manner.
func (*BaseService) Name ¶
func (s *BaseService) Name() string
Name returns the name of the BaseService.
func (*BaseService) SetStatus ¶
func (s *BaseService) SetStatus(err error)
SetStatus sets the status error of the BaseService.
func (BaseService) ShallowCopy ¶
func (s BaseService) ShallowCopy(name string) BaseService
ShallowCopy copies the base service and replaces it's name.
func (*BaseService) Start ¶
func (s *BaseService) Start(context.Context)
Start is an intentional no-op for the BaseService.
func (*BaseService) Status ¶
func (s *BaseService) Status() error
Status is an intentional no-op for the BaseService.
func (*BaseService) WaitForHealthy ¶
func (s *BaseService) WaitForHealthy(context.Context)
WaitForHealthy is an intentional no-op for the BaseService.
type Basic ¶
type Basic interface { // Start spawns any goroutines required by the service. Start(ctx context.Context) // Name returns the name of the service. Name() string // Status returns error if the service is not considered healthy. Status() error // WaitForHealthy blocks until the service is healthy. WaitForHealthy(ctx context.Context) }
Basic is the minimal interface for a service.
type BeaconStorageBackend ¶
type BeaconStorageBackend interface { AvailabilityStore(ctx context.Context) core.AvailabilityStore BeaconState(ctx context.Context) state.BeaconState }
BeaconStorageBackend is an interface that provides the beacon state to the runtime.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry 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 NewRegistry ¶
func NewRegistry(opts ...RegistryOption) *Registry
NewRegistry starts a registry instance for convenience.
func (*Registry) FetchService ¶
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 (*Registry) RegisterService ¶
RegisterService appends a service constructor function to the service registry.
type RegistryOption ¶
RegistryOption is a functional option for the Registry.
func WithLogger ¶
func WithLogger(logger log.Logger) RegistryOption
WithLogger is an option to set the logger for the Registry.
func WithService ¶
func WithService(svc Basic) RegistryOption
WithService is an Option that registers a service with the Registry.