소스 검색

Merge pull request #4895 from xiang90/client_doc

client: doc that client is thread-safe
Xiang Li 9 년 전
부모
커밋
bb8619f4f7
2개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      client/doc.go
  2. 3 0
      clientv3/doc.go

+ 2 - 0
client/doc.go

@@ -34,6 +34,8 @@ Create a Config and exchange it for a Client:
 		// handle error
 		// handle error
 	}
 	}
 
 
+Clients are safe for concurrent use by multiple goroutines.
+
 Create a KeysAPI using the Client, then use it to interact with etcd:
 Create a KeysAPI using the Client, then use it to interact with etcd:
 
 
 	kAPI := client.NewKeysAPI(c)
 	kAPI := client.NewKeysAPI(c)

+ 3 - 0
clientv3/doc.go

@@ -38,6 +38,9 @@
 //	}
 //	}
 //	// use the response
 //	// use the response
 //
 //
+// The Client has internal state (watchers and leases), so Clients should be reused instead of created as needed.
+// Clients are safe for concurrent use by multiple goroutines.
+//
 // etcd client returns 2 types of errors:
 // etcd client returns 2 types of errors:
 //
 //
 //	1. context error: canceled or deadline exceeded.
 //	1. context error: canceled or deadline exceeded.