Skip to content

Support for events #71

Closed
wants to merge 9 commits into from

2 participants

@jhulten
jhulten commented Feb 20, 2014

RE #66

Please review. Happy to change.

@jhulten jhulten referenced this pull request Feb 20, 2014
Closed

client: Implement Events() #66

Jeffrey Hulten added some commits Feb 19, 2014
@fsouza fsouza commented on the diff Feb 20, 2014
@@ -0,0 +1,234 @@
+package docker
@fsouza
Owner
fsouza added a note Feb 20, 2014

Please add the copyright header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@fsouza fsouza commented on an outdated diff Feb 20, 2014
+ "bufio"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io"
+ "math"
+ "net"
+ "net/http"
+ "net/http/httputil"
+ "sync"
+ "time"
+)
+
+type APIEvents struct {
+ Status string
+ Id string
@fsouza
Owner
fsouza added a note Feb 20, 2014

ID

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@fsouza fsouza commented on an outdated diff Feb 20, 2014
+ Time uint32
+}
+
+type EventMonitoringState struct {
+ sync.RWMutex
+ enabled bool
+ lastSeen uint32
+ C chan *APIEvents
+ errC chan error
+ listeners []chan *APIEvents
+}
+
+var eventMonitor EventMonitoringState
+var ErrNoListeners = errors.New("No listeners to send event to...")
+
+func (c *Client) AddEventListener(listener *chan *APIEvents) error {
@fsouza
Owner
fsouza added a note Feb 20, 2014

Why are you using a pointer to a channel instead of just a channel?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jhulten
jhulten commented Feb 20, 2014

Updated. Will proceed on tests.

@jhulten
jhulten commented Feb 21, 2014

Something is not working right. Will work on this more tomorrow, but would appreciate feedback on my tests.

Jeffrey Hulten tests complete. 13f4e23
@jhulten
jhulten commented Feb 21, 2014

Waiting on travisci results, but it passes here.

/cc @fsouza

@jhulten
jhulten commented Feb 21, 2014

Closing and resubmitting after flatting

@jhulten jhulten closed this Feb 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.