mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-07 10:12:19 +00:00
a363175bbc
Former-commit-id: af2dcc65c4c3891a67d4dcf06946537a94901a0a [formerly fe1c017c119100b522a5edcf674f11a8edab9eca] Former-commit-id: e4dbbeb226d9ead45c244717f56deae2edd29bf1
21 lines
770 B
Go
21 lines
770 B
Go
package sharding
|
|
|
|
// 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() (Service, error)
|