Browse Source

client: introduce httpActionDo interface

Brian Waldon 11 years ago
parent
commit
323fb1ec85
3 changed files with 7 additions and 3 deletions
  1. 4 0
      client/http.go
  2. 2 2
      client/keys.go
  3. 1 1
      client/members.go

+ 4 - 0
client/http.go

@@ -42,6 +42,10 @@ type httpAction interface {
 	httpRequest(url.URL) *http.Request
 }
 
+type httpActionDo interface {
+	do(context.Context, httpAction) (int, []byte, error)
+}
+
 type roundTripResponse struct {
 	resp *http.Response
 	err  error

+ 2 - 2
client/keys.go

@@ -100,7 +100,7 @@ func (n *Node) String() string {
 }
 
 type httpKeysAPI struct {
-	client  *httpClient
+	client  httpActionDo
 	prefix  string
 	timeout time.Duration
 }
@@ -168,7 +168,7 @@ func (k *httpKeysAPI) RecursiveWatch(key string, idx uint64) Watcher {
 }
 
 type httpWatcher struct {
-	client   *httpClient
+	client   httpActionDo
 	nextWait waitAction
 }
 

+ 1 - 1
client/members.go

@@ -60,7 +60,7 @@ type MembersAPI interface {
 }
 
 type httpMembersAPI struct {
-	client  *httpClient
+	client  httpActionDo
 	timeout time.Duration
 }