Ver Fonte

add docker event feed

reid há 2 anos atrás
pai
commit
40bcbd128b
1 ficheiros alterados com 21 adições e 0 exclusões
  1. 21 0
      rectify/rectify.go

+ 21 - 0
rectify/rectify.go

@@ -0,0 +1,21 @@
+package rectify
+// this package is for watching the event bus and rectifying mismatches
+// between the desired and actual state
+
+import (
+	"fmt"
+	"goseg/broadcast"
+)
+
+func HandleDockerEvents() {
+	for {
+		event := <-EventBus
+		switch event.Type {
+		case "container_stopped":
+			logger.Info(fmt.Sprintf("Docker event: container stopped"))
+		default:
+			logger.Info(fmt.Sprintf("Docker event: %s",event.Type))
+		}
+		broadcast.BroadcastToClients()
+	}
+}