api: document goroutine safeness

This commit is contained in:
Michael Stapelberg 2016-08-01 00:11:57 +02:00 committed by GitHub
parent 28be15864e
commit 7b5f88727a
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}}
} }