prysm-pulse/sharding/interfaces.go
Raul Jordan 128f661ba5 sharding: update documentation to reflect new entry points
Former-commit-id: 44863031370aaa67d3d9b546be33a67fc277f153 [formerly 55b0b3525b42778b71010859abc391f28fafc00f]
Former-commit-id: cf0ee0753c7e9f1a8d53510fc091c685cac7e0e1
2018-05-22 11:33:46 -04:00

25 lines
828 B
Go

package sharding
import (
cli "gopkg.in/urfave/cli.v1"
)
// Service defines items that can be registered into a sharding node's serviceFuncs.
//
// life-cycle management is delegated to the sharding node. The service is allowed to
// initialize itself upon creation, but no goroutines should be spun up outside of the
// Start method.
type Service interface {
// Start is called after all services have been constructed and the networking
// layer was also initialized to spawn any goroutines required by the service.
Start() error
// Stop terminates all goroutines belonging to the service, blocking until they
// are all terminated.
Stop() error
}
// ServiceConstructor defines the callback passed in when registering a service
// to a sharding node.
type ServiceConstructor func(ctx *cli.Context) (Service, error)