|
|
@@ -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()
|
|
|
+ }
|
|
|
+}
|