diff --git a/libs/service/service.go b/libs/service/service.go index 6221c7d92..3ce08e7da 100644 --- a/libs/service/service.go +++ b/libs/service/service.go @@ -12,11 +12,8 @@ var ( // errAlreadyStopped is returned when somebody tries to stop an already // stopped service (without resetting it). errAlreadyStopped = errors.New("already stopped") -) -var ( _ Service = (*BaseService)(nil) - _ Service = (*NopService)(nil) ) // Service defines a service that can be started, stopped, and reset. @@ -75,8 +72,7 @@ Typical usage: } func (fs *FooService) OnStop() { - // close/destroy private fields - // stop subroutines, etc. + // close/destroy private fields and releases resources } */ type BaseService struct { @@ -90,12 +86,6 @@ type BaseService struct { impl Implementation } -type NopService struct{} - -func (NopService) Start(_ context.Context) error { return nil } -func (NopService) IsRunning() bool { return true } -func (NopService) Wait() {} - // NewBaseService creates a new BaseService. func NewBaseService(logger log.Logger, name string, impl Implementation) *BaseService { return &BaseService{ @@ -206,5 +196,5 @@ func (bs *BaseService) getWait() <-chan struct{} { // Wait blocks until the service is stopped. func (bs *BaseService) Wait() { <-bs.getWait() } -// String implements Service by returning a string representation of the service. +// String provides a human-friendly representation of the service. func (bs *BaseService) String() string { return bs.name }