Explorar o código

add docker event feed

reid %!s(int64=2) %!d(string=hai) anos
pai
achega
40bcbd128b
Modificáronse 1 ficheiros con 21 adicións e 0 borrados
  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()
+	}
+}