rectify.go 449 B

123456789101112131415161718192021
  1. package rectify
  2. // this package is for watching the event bus and rectifying mismatches
  3. // between the desired and actual state
  4. import (
  5. "fmt"
  6. "goseg/broadcast"
  7. )
  8. func HandleDockerEvents() {
  9. for {
  10. event := <-EventBus
  11. switch event.Type {
  12. case "container_stopped":
  13. logger.Info(fmt.Sprintf("Docker event: container stopped"))
  14. default:
  15. logger.Info(fmt.Sprintf("Docker event: %s",event.Type))
  16. }
  17. broadcast.BroadcastToClients()
  18. }
  19. }