-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathtest_helper.go
More file actions
32 lines (24 loc) · 851 Bytes
/
test_helper.go
File metadata and controls
32 lines (24 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package destination
import (
"context"
common "github.com/runconduit/conduit/controller/gen/common"
)
// implements the updateListener interface
type collectUpdateListener struct {
added []common.TcpAddress
removed []common.TcpAddress
context context.Context
}
func (c *collectUpdateListener) Update(add []common.TcpAddress, remove []common.TcpAddress) {
c.added = append(c.added, add...)
c.removed = append(c.removed, remove...)
}
func (c *collectUpdateListener) Done() <-chan struct{} {
return c.context.Done()
}
func (c *collectUpdateListener) NoEndpoints(exists bool) {}
func (c *collectUpdateListener) SetServiceId(id *serviceId) {}
func newCollectUpdateListener() (*collectUpdateListener, context.CancelFunc) {
ctx, cancelFn := context.WithCancel(context.Background())
return &collectUpdateListener{context: ctx}, cancelFn
}