|
@@ -49,7 +49,7 @@ func NewDiscoveryKeysAPI(tr *http.Transport, ep string, to time.Duration) (KeysA
|
|
|
return newHTTPKeysAPIWithPrefix(tr, ep, to, "")
|
|
return newHTTPKeysAPIWithPrefix(tr, ep, to, "")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func newHTTPKeysAPIWithPrefix(tr *http.Transport, ep string, to time.Duration, prefix string) (*HTTPKeysAPI, error) {
|
|
|
|
|
|
|
+func newHTTPKeysAPIWithPrefix(tr *http.Transport, ep string, to time.Duration, prefix string) (*httpKeysAPI, error) {
|
|
|
u, err := url.Parse(ep)
|
|
u, err := url.Parse(ep)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return nil, err
|
|
return nil, err
|
|
@@ -63,7 +63,7 @@ func newHTTPKeysAPIWithPrefix(tr *http.Transport, ep string, to time.Duration, p
|
|
|
timeout: to,
|
|
timeout: to,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- kAPI := HTTPKeysAPI{
|
|
|
|
|
|
|
+ kAPI := httpKeysAPI{
|
|
|
client: c,
|
|
client: c,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -100,11 +100,11 @@ func (n *Node) String() string {
|
|
|
return fmt.Sprintf("{Key: %s, CreatedIndex: %d, ModifiedIndex: %d}", n.Key, n.CreatedIndex, n.ModifiedIndex)
|
|
return fmt.Sprintf("{Key: %s, CreatedIndex: %d, ModifiedIndex: %d}", n.Key, n.CreatedIndex, n.ModifiedIndex)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-type HTTPKeysAPI struct {
|
|
|
|
|
|
|
+type httpKeysAPI struct {
|
|
|
client *httpClient
|
|
client *httpClient
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (k *HTTPKeysAPI) Create(key, val string, ttl time.Duration) (*Response, error) {
|
|
|
|
|
|
|
+func (k *httpKeysAPI) Create(key, val string, ttl time.Duration) (*Response, error) {
|
|
|
create := &createAction{
|
|
create := &createAction{
|
|
|
Key: key,
|
|
Key: key,
|
|
|
Value: val,
|
|
Value: val,
|
|
@@ -122,7 +122,7 @@ func (k *HTTPKeysAPI) Create(key, val string, ttl time.Duration) (*Response, err
|
|
|
return unmarshalHTTPResponse(httpresp.StatusCode, body)
|
|
return unmarshalHTTPResponse(httpresp.StatusCode, body)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (k *HTTPKeysAPI) Get(key string) (*Response, error) {
|
|
|
|
|
|
|
+func (k *httpKeysAPI) Get(key string) (*Response, error) {
|
|
|
get := &getAction{
|
|
get := &getAction{
|
|
|
Key: key,
|
|
Key: key,
|
|
|
Recursive: false,
|
|
Recursive: false,
|
|
@@ -136,7 +136,7 @@ func (k *HTTPKeysAPI) Get(key string) (*Response, error) {
|
|
|
return unmarshalHTTPResponse(httpresp.StatusCode, body)
|
|
return unmarshalHTTPResponse(httpresp.StatusCode, body)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (k *HTTPKeysAPI) Watch(key string, idx uint64) Watcher {
|
|
|
|
|
|
|
+func (k *httpKeysAPI) Watch(key string, idx uint64) Watcher {
|
|
|
return &httpWatcher{
|
|
return &httpWatcher{
|
|
|
client: k.client,
|
|
client: k.client,
|
|
|
nextWait: waitAction{
|
|
nextWait: waitAction{
|
|
@@ -147,7 +147,7 @@ func (k *HTTPKeysAPI) Watch(key string, idx uint64) Watcher {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (k *HTTPKeysAPI) RecursiveWatch(key string, idx uint64) Watcher {
|
|
|
|
|
|
|
+func (k *httpKeysAPI) RecursiveWatch(key string, idx uint64) Watcher {
|
|
|
return &httpWatcher{
|
|
return &httpWatcher{
|
|
|
client: k.client,
|
|
client: k.client,
|
|
|
nextWait: waitAction{
|
|
nextWait: waitAction{
|