service: minor cleanup of comments (#8314)

This commit is contained in:
Sam Kleinman
2022-04-12 17:11:21 -04:00
committed by GitHub
parent 571d26fbb0
commit 5d4d01b4e4

View File

@@ -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 }