prysm-pulse/validator/client/service.go
Preston Van Loon 0becb6dc01 Simplified validator workflow - first pass (#1362)
* Add attestation p2p messages

* first pass refactor

* lint

* viz fix

* comment unused const for now

* Add opentracing spans

* PR feedback
2019-01-23 10:52:39 +08:00

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
}