Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

StartMonitorEvents is not idiomatic #72

Open
daaku opened this issue Feb 5, 2015 · 0 comments
Open

StartMonitorEvents is not idiomatic #72

daaku opened this issue Feb 5, 2015 · 0 comments

Comments

@daaku
Copy link
Contributor

daaku commented Feb 5, 2015

StartMonitorEvents takes a callback, and a channel, and untyped args. It spins up a new goroutine per call, but shares an atomic to allow StopAllMonitorEvents to work. The whole thing just seems very messy.

https://github.com/go-fsnotify/fsnotify may be a good source of inspiration here.

Would prefer an API along the lines of:

type Watcher struct {
  Error chan error
  Event chan *Event
}

func (w *Watcher) Close() error {
  ...
}

func (d *DockerClient) Watcher() (*Watcher, error) {
}

The Start/Stop can go away. Internally a single HTTP stream can be used for all the Watchers. Each Watcher can provide a Close so a global Stop/Close isn't necessary.

Thoughts?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant