浏览代码

add docker event feed

reid 2 年之前
父节点
当前提交
40bcbd128b
共有 1 个文件被更改,包括 21 次插入0 次删除
  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()
+	}
+}