Do not export what is not needed to be exported
Olivier Bregeras
8 years ago
21 | 21 | } |
22 | 22 | |
23 | 23 | type client struct { |
24 | etcd.KeysAPI | |
25 | Ctx context.Context | |
24 | keysAPI etcd.KeysAPI | |
25 | ctx context.Context | |
26 | 26 | } |
27 | 27 | |
28 | 28 | type ClientOptions struct { |
105 | 105 | |
106 | 106 | // GetEntries implements the etcd Client interface. |
107 | 107 | func (c *client) GetEntries(key string) ([]string, error) { |
108 | resp, err := c.Get(c.Ctx, key, &etcd.GetOptions{Recursive: true}) | |
108 | resp, err := c.keysAPI.Get(c.ctx, key, &etcd.GetOptions{Recursive: true}) | |
109 | 109 | if err != nil { |
110 | 110 | return nil, err |
111 | 111 | } |
119 | 119 | |
120 | 120 | // WatchPrefix implements the etcd Client interface. |
121 | 121 | func (c *client) WatchPrefix(prefix string, responseChan chan *etcd.Response) { |
122 | watch := c.Watcher(prefix, &etcd.WatcherOptions{AfterIndex: 0, Recursive: true}) | |
122 | watch := c.keysAPI.Watcher(prefix, &etcd.WatcherOptions{AfterIndex: 0, Recursive: true}) | |
123 | 123 | for { |
124 | res, err := watch.Next(c.Ctx) | |
124 | res, err := watch.Next(c.ctx) | |
125 | 125 | if err != nil { |
126 | 126 | return |
127 | 127 | } |