mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
discovery: init commit
This commit is contained in:
@@ -16,8 +16,8 @@ var (
|
||||
type Client interface {
|
||||
Create(key, value string, ttl time.Duration) (*Response, error)
|
||||
Get(key string) (*Response, error)
|
||||
Watch(key string) Watcher
|
||||
RecursiveWatch(key string) Watcher
|
||||
Watch(key string, idx uint64) Watcher
|
||||
RecursiveWatch(key string, idx uint64) Watcher
|
||||
}
|
||||
|
||||
type Watcher interface {
|
||||
@@ -30,7 +30,7 @@ type Response struct {
|
||||
PrevNode *Node `json:"prevNode"`
|
||||
}
|
||||
|
||||
type Nodes []Node
|
||||
type Nodes []*Node
|
||||
type Node struct {
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
|
||||
@@ -127,7 +127,7 @@ func (c *httpClient) do(ctx context.Context, act httpAction) (*http.Response, []
|
||||
return resp, body, err
|
||||
}
|
||||
|
||||
func (c *httpClient) Watch(key string, idx uint64) *httpWatcher {
|
||||
func (c *httpClient) Watch(key string, idx uint64) Watcher {
|
||||
return &httpWatcher{
|
||||
httpClient: *c,
|
||||
nextWait: waitAction{
|
||||
@@ -138,7 +138,7 @@ func (c *httpClient) Watch(key string, idx uint64) *httpWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *httpClient) RecursiveWatch(key string, idx uint64) *httpWatcher {
|
||||
func (c *httpClient) RecursiveWatch(key string, idx uint64) Watcher {
|
||||
return &httpWatcher{
|
||||
httpClient: *c,
|
||||
nextWait: waitAction{
|
||||
|
||||
Reference in New Issue
Block a user