Merge pull request #213 from stapelberg/patch-1

api: document goroutine safeness
This commit is contained in:
Fabian Reinartz 2016-08-02 00:22:46 -07:00 committed by GitHub
commit 52437c81da
1 changed files with 4 additions and 0 deletions

View File

@ -102,6 +102,8 @@ type Client interface {
} }
// New returns a new Client. // New returns a new Client.
//
// It is safe to use the returned Client from multiple goroutines.
func New(cfg Config) (Client, error) { func New(cfg Config) (Client, error) {
u, err := url.Parse(cfg.Address) u, err := url.Parse(cfg.Address)
if err != nil { if err != nil {
@ -280,6 +282,8 @@ type QueryAPI interface {
} }
// NewQueryAPI returns a new QueryAPI for the client. // NewQueryAPI returns a new QueryAPI for the client.
//
// It is safe to use the returned QueryAPI from multiple goroutines.
func NewQueryAPI(c Client) QueryAPI { func NewQueryAPI(c Client) QueryAPI {
return &httpQueryAPI{client: apiClient{c}} return &httpQueryAPI{client: apiClient{c}}
} }