mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-07 02:02:18 +00:00
0becb6dc01
* Add attestation p2p messages * first pass refactor * lint * viz fix * comment unused const for now * Add opentracing spans * PR feedback
47 lines
925 B
Go
47 lines
925 B
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
var log = logrus.WithField("prefix", "validator")
|
|
|
|
// ValidatorService represents a service to manage the validator client
|
|
// routine.
|
|
type ValidatorService struct {
|
|
ctx context.Context
|
|
cancel context.CancelFunc
|
|
validator Validator
|
|
}
|
|
|
|
// NewValidatorService creates a new validator service for the service
|
|
// registry.
|
|
func NewValidatorService(ctx context.Context) *ValidatorService {
|
|
ctx, cancel := context.WithCancel(ctx)
|
|
return &ValidatorService{
|
|
ctx: ctx,
|
|
cancel: cancel,
|
|
}
|
|
}
|
|
|
|
// Start the validator service. Launches the main go routine for the validator
|
|
// client.
|
|
func (v *ValidatorService) Start() {
|
|
go run(v.ctx, v.validator)
|
|
}
|
|
|
|
// Stop the validator service.
|
|
func (v *ValidatorService) Stop() error {
|
|
v.cancel()
|
|
return nil
|
|
}
|
|
|
|
// Status ...
|
|
//
|
|
// WIP - not done.
|
|
func (v *ValidatorService) Status() error {
|
|
return nil
|
|
}
|