From 9cc71008dc28ea8618d3c946db7dc2f013147d17 Mon Sep 17 00:00:00 2001 From: Paul Hewlett Date: Mon, 25 Sep 2023 15:48:26 +0100 Subject: [PATCH] fixup! fixup! fixup! fixup! fixup! fixup! Generic listener management --- startup/service.go | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 startup/service.go diff --git a/startup/service.go b/startup/service.go deleted file mode 100644 index 796f410..0000000 --- a/startup/service.go +++ /dev/null @@ -1,40 +0,0 @@ -package startup - -type ServiceProvider interface { - Open() error - Close() -} - -// Service consists of a named ServiceProviders and a bunch of listeners. -type Service struct { - name string - log Logger - service ServiceProvider - listeners Listeners -} - -func NewService(log Logger, name string, service ServiceProvider, listeners Listeners) Service { - s := Service{ - name: name, - service: service, - listeners: listeners, - } - s.log = log.WithIndex("service", s.String()) - return s -} - -func (s *Service) String() string { - return s.name -} - -func (s *Service) Open() error { - return s.service.Open() -} - -func (s *Service) Close() { - s.service.Close() -} - -func (s *Service) Listen() error { - return s.listeners.Listen() -}