New Upstream Snapshot - golang-github-bluebreezecf-opentsdb-goclient
Ready changes
Summary
Merged new upstream version: 0.0~git20190921.0.7961383 (was: 0.0~git20160515.0.539764b).
Resulting package
Built on 2023-01-19T01:30 (took 3m12s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots golang-github-bluebreezecf-opentsdb-goclient-dev
Lintian Result
- golang-github-bluebreezecf-opentsdb-goclient-dev_0.0~git20190921.0.7961383-1~jan+nus2_all.deb
- golang-github-bluebreezecf-opentsdb-goclient_0.0~git20190921.0.7961383-1~jan+nus2.dsc
- golang-github-bluebreezecf-opentsdb-goclient_0.0~git20190921.0.7961383-1~jan+nus2_amd64.buildinfo
- golang-github-bluebreezecf-opentsdb-goclient_0.0~git20190921.0.7961383-1~jan+nus2_amd64.changes
Diff
diff --git a/client/client.go b/client/client.go
index 3ea8d2f..97c7df6 100755
--- a/client/client.go
+++ b/client/client.go
@@ -24,6 +24,7 @@
package client
import (
+ "context"
"encoding/json"
"errors"
"fmt"
@@ -427,10 +428,30 @@ func NewClient(opentsdbCfg config.OpenTSDBConfig) (Client, error) {
return &clientImpl, nil
}
+// ClientContext implements the Client interface and additionally provides a
+// way to return a client that is associated with the given context.
+type ClientContext interface {
+ // WithContext returns a Client that is associated with the given context.
+ // Use this to pass a context to underlying transport (e.g. to specify a
+ // deadline).
+ WithContext(ctx context.Context) Client
+ Client
+}
+
+func NewClientContext(opentsdbCfg config.OpenTSDBConfig) (Client, error) {
+ client, err := NewClient(opentsdbCfg)
+ if err != nil {
+ return nil, err
+ }
+ // We know this is actually clientImpl and implements this interface.
+ return client.(ClientContext), nil
+}
+
// The private implementation of Client interface.
type clientImpl struct {
tsdbEndpoint string
client *http.Client
+ ctx context.Context
opentsdbCfg config.OpenTSDBConfig
}
@@ -455,12 +476,24 @@ type Response interface {
String() string
}
+func (c *clientImpl) WithContext(ctx context.Context) Client {
+ return &clientImpl{
+ tsdbEndpoint: c.tsdbEndpoint,
+ client: c.client,
+ ctx: ctx,
+ opentsdbCfg: c.opentsdbCfg,
+ }
+}
+
// sendRequest dispatches the http request with the given method name, url and body contents.
// reqBodyCnt is "" means there is no contents in the request body.
// If the tsdb server responses properly, the error is nil and parsedResp is the parsed
// response with the specific type. Otherwise, the returned error is not nil.
func (c *clientImpl) sendRequest(method, url, reqBodyCnt string, parsedResp Response) error {
req, err := http.NewRequest(method, url, strings.NewReader(reqBodyCnt))
+ if c.ctx != nil {
+ req = req.WithContext(c.ctx)
+ }
if err != nil {
return errors.New(fmt.Sprintf("Failed to create request for %s %s: %v", method, url, err))
}
diff --git a/debian/changelog b/debian/changelog
index cd8c1c4..47eda3e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-golang-github-bluebreezecf-opentsdb-goclient (0.0~git20160515.0.539764b-2) UNRELEASED; urgency=medium
+golang-github-bluebreezecf-opentsdb-goclient (0.0~git20190921.0.7961383-1) UNRELEASED; urgency=medium
[ Alexandre Viau ]
* Point Vcs-* urls to salsa.debian.org.
@@ -6,7 +6,10 @@ golang-github-bluebreezecf-opentsdb-goclient (0.0~git20160515.0.539764b-2) UNREL
[ Jelmer Vernooij ]
* Use secure copyright file specification URI.
- -- Alexandre Viau <aviau@debian.org> Mon, 02 Apr 2018 14:57:48 -0400
+ [ Debian Janitor ]
+ * New upstream snapshot.
+
+ -- Alexandre Viau <aviau@debian.org> Thu, 19 Jan 2023 01:28:42 -0000
golang-github-bluebreezecf-opentsdb-goclient (0.0~git20160515.0.539764b-1) unstable; urgency=medium
Debdiff
File lists identical (after any substitutions)
No differences were encountered in the control files