Browse Source

`Event` is way too generic noon

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 4 years ago
parent
commit
06b033db6c
3 changed files with 5 additions and 8 deletions
  1. 3 6
      api/compose/api.go
  2. 1 1
      cli/cmd/compose/up.go
  3. 1 1
      local/compose/start.go

+ 3 - 6
api/compose/api.go

@@ -68,7 +68,7 @@ type StartOptions struct {
 	// Attach will attach to container and pipe stdout/stderr to LogConsumer
 	Attach LogConsumer
 	// Listener will get notified on container events
-	Listener Listener
+	Listener chan ContainerExited
 }
 
 // UpOptions group options of the Up API
@@ -188,11 +188,8 @@ type LogConsumer interface {
 	Status(service, container, message string)
 }
 
-// Listener get notified on container Events
-type Listener chan Event
-
-// Event let us know a Container exited
-type Event struct {
+// ContainerExited let us know a Container exited
+type ContainerExited struct {
 	Service string
 	Status  int
 }

+ 1 - 1
cli/cmd/compose/up.go

@@ -151,7 +151,7 @@ func runCreateStart(ctx context.Context, opts upOptions, services []string) erro
 	}
 
 	ctx, cancel := context.WithCancel(ctx)
-	listener := make(chan compose.Event)
+	listener := make(chan compose.ContainerExited)
 	go func() {
 		var aborting bool
 		for {

+ 1 - 1
local/compose/start.go

@@ -64,7 +64,7 @@ func (s *composeService) Start(ctx context.Context, project *types.Project, opti
 				service := c.Labels[serviceLabel]
 				options.Attach.Status(service, getCanonicalContainerName(c), fmt.Sprintf("exited with code %d", status.StatusCode))
 				if options.Listener != nil {
-					options.Listener <- compose.Event{
+					options.Listener <- compose.ContainerExited{
 						Service: service,
 						Status:  int(status.StatusCode),
 					}