File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ func (e *Event) Type(t string) *Event {
3434 return e
3535}
3636
37- // Type sets the event's retry: field
37+ // Retry sets the event's retry: field
3838func (e * Event ) Retry (t uint64 ) * Event {
3939 e .retry = t
4040 e .bufSet = false
@@ -49,7 +49,7 @@ func (e *Event) Data(dat string) *Event {
4949 return e
5050}
5151
52- // Adds data to the event without overwriting
52+ // AppendData adds data to the event without overwriting
5353func (e * Event ) AppendData (dat string ) * Event {
5454 e .WriteString (dat )
5555 return e
@@ -118,6 +118,8 @@ func (e *Event) Write(p []byte) (int, error) {
118118 return len (p ), nil
119119}
120120
121+ // WriteString adds string data to the event.
122+ // Equivilant to calling Write([]byte(string))
121123func (e * Event ) WriteString (p string ) {
122124 // split event on newlines
123125 split := strings .Split (p , "\n " )
Original file line number Diff line number Diff line change @@ -10,13 +10,13 @@ type EventFactory interface {
1010 New () * Event
1111}
1212
13- // EventIdFactory is an event factory that creates events with
13+ // EventIDFactory is an event factory that creates events with
1414// sequential ID fields.
1515// If NewFunc is set, the factory uses it to create events before setting
1616// their IDs
1717// If NewFunc is not set, NewFact will be used. If neither is set, a new
1818// event is created from scratch
19- type EventIdFactory struct {
19+ type EventIDFactory struct {
2020 NewFact EventFactory
2121 NewFunc func () * Event
2222 Next uint64
Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ import (
66 "sync"
77)
88
9+ // Stream abstracts several client connections together and allows
10+ // for event multiplexing and topics.
11+ // A stream also implements an http.Handler to easily register incoming
12+ // http requests as new clients.
913type Stream struct {
1014 clients list.List
1115 listLock sync.RWMutex
@@ -174,7 +178,7 @@ func (s *Stream) TopicHandler(topics []string) http.HandlerFunc {
174178 }
175179}
176180
177- // Register a function to be called when a client connects to this stream's
181+ // ClientConnectHook sets a function to be called when a client connects to this stream's
178182// HTTP handler.
179183// Only one handler may be registered. Further calls overwrite the previous.
180184func (s * Stream ) ClientConnectHook (fn func (* http.Request , * Client )) {
You can’t perform that action at this time.
0 commit comments