Run of fresh-snapshots for golang-github-bluebreezecf-opentsdb-goclient

Merge these changes:

Summary

Merged new upstream version: 0.0~git20190921.0.7961383 (was: 0.0~git20160515.0.539764b).

Diff

Branch: main

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..282a421 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>  Sat, 28 May 2022 02:38:06 -0000
 
 golang-github-bluebreezecf-opentsdb-goclient (0.0~git20160515.0.539764b-1) unstable; urgency=medium
 

Branch: pristine-tar

diff --git a/golang-github-bluebreezecf-opentsdb-goclient_0.0~git20190921.0.7961383.orig.tar.gz.delta b/golang-github-bluebreezecf-opentsdb-goclient_0.0~git20190921.0.7961383.orig.tar.gz.delta
new file mode 100644
index 0000000..c759612
Binary files /dev/null and b/golang-github-bluebreezecf-opentsdb-goclient_0.0~git20190921.0.7961383.orig.tar.gz.delta differ
diff --git a/golang-github-bluebreezecf-opentsdb-goclient_0.0~git20190921.0.7961383.orig.tar.gz.id b/golang-github-bluebreezecf-opentsdb-goclient_0.0~git20190921.0.7961383.orig.tar.gz.id
new file mode 100644
index 0000000..55c7edb
--- /dev/null
+++ b/golang-github-bluebreezecf-opentsdb-goclient_0.0~git20190921.0.7961383.orig.tar.gz.id
@@ -0,0 +1 @@
+9370fc24e4f4a217c811c35ffe1161db7f6fbcb8

Branch: upstream

Tag: upstream/0.0_git20190921.0.7961383
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))
 	}

Publish Blockers

  • ☑ run was successful
  • ☑ package has not been removed from the archive
  • ☒ command changed from DEB_UPDATE_CHANGELOG=leave deb-new-upstream --snapshot --refresh-patches to DEB_UPDATE_CHANGELOG=auto deb-new-upstream --snapshot --refresh-patches
  • ☒ not yet reviewed, but review needed
  • ☑ 0 publish attempts so far.not currently attempting to back off
  • ☑ proposals not currently being rate-limited for maintainer pkg-go-maintainers@lists.alioth.debian.org
  • ☑ change set 3babb76b-14db-4b09-b153-e128121b5424 is ready

Resulting package

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

Full worker log Full build log