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 {
34
34
return e
35
35
}
36
36
37
- // Type sets the event's retry: field
37
+ // Retry sets the event's retry: field
38
38
func (e * Event ) Retry (t uint64 ) * Event {
39
39
e .retry = t
40
40
e .bufSet = false
@@ -49,7 +49,7 @@ func (e *Event) Data(dat string) *Event {
49
49
return e
50
50
}
51
51
52
- // Adds data to the event without overwriting
52
+ // AppendData adds data to the event without overwriting
53
53
func (e * Event ) AppendData (dat string ) * Event {
54
54
e .WriteString (dat )
55
55
return e
@@ -118,6 +118,8 @@ func (e *Event) Write(p []byte) (int, error) {
118
118
return len (p ), nil
119
119
}
120
120
121
+ // WriteString adds string data to the event.
122
+ // Equivilant to calling Write([]byte(string))
121
123
func (e * Event ) WriteString (p string ) {
122
124
// split event on newlines
123
125
split := strings .Split (p , "\n " )
Original file line number Diff line number Diff line change @@ -10,13 +10,13 @@ type EventFactory interface {
10
10
New () * Event
11
11
}
12
12
13
- // EventIdFactory is an event factory that creates events with
13
+ // EventIDFactory is an event factory that creates events with
14
14
// sequential ID fields.
15
15
// If NewFunc is set, the factory uses it to create events before setting
16
16
// their IDs
17
17
// If NewFunc is not set, NewFact will be used. If neither is set, a new
18
18
// event is created from scratch
19
- type EventIdFactory struct {
19
+ type EventIDFactory struct {
20
20
NewFact EventFactory
21
21
NewFunc func () * Event
22
22
Next uint64
Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ import (
6
6
"sync"
7
7
)
8
8
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.
9
13
type Stream struct {
10
14
clients list.List
11
15
listLock sync.RWMutex
@@ -174,7 +178,7 @@ func (s *Stream) TopicHandler(topics []string) http.HandlerFunc {
174
178
}
175
179
}
176
180
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
178
182
// HTTP handler.
179
183
// Only one handler may be registered. Further calls overwrite the previous.
180
184
func (s * Stream ) ClientConnectHook (fn func (* http.Request , * Client )) {
You can’t perform that action at this time.
0 commit comments