diff --git a/Makefile b/Makefile index f1d341d..9b699f3 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ endif # Configuration for fetching the right binary OS ?= "linux" ARCH ?= "amd64" -VERSION ?= "v0.0.22" +VERSION ?= "v0.0.24" DOWNLOAD_URL := "https://github.com/codex-storage/codex-go-bindings/releases/download/$(VERSION)/codex-${OS}-${ARCH}.zip" fetch: diff --git a/communities/codex_client.go b/communities/codex_client.go index aa3f70e..63b6c38 100644 --- a/communities/codex_client.go +++ b/communities/codex_client.go @@ -51,7 +51,7 @@ func (c CodexClient) Destroy() error { // Upload uploads data from a reader to Codex and returns the CID func (c *CodexClient) Upload(data io.Reader, filename string) (string, error) { - return c.node.UploadReader(codex.UploadOptions{ + return c.node.UploadReader(context.Background(), codex.UploadOptions{ Filepath: filename, }, data) } @@ -76,20 +76,20 @@ func (c *CodexClient) RemoveCid(cid string) error { // DownloadWithContext downloads data from Codex by CID with cancellation support func (c *CodexClient) DownloadWithContext(ctx context.Context, cid string, output io.Writer) error { - return c.node.DownloadStream(cid, codex.DownloadStreamOptions{ + return c.node.DownloadStream(ctx, cid, codex.DownloadStreamOptions{ Writer: output, }) } func (c *CodexClient) LocalDownload(cid string, output io.Writer) error { - return c.node.DownloadStream(cid, codex.DownloadStreamOptions{ - Writer: output, - Local: true, - }) + return c.LocalDownloadWithContext(context.Background(), cid, output) } func (c *CodexClient) LocalDownloadWithContext(ctx context.Context, cid string, output io.Writer) error { - return c.LocalDownload(cid, output) + return c.node.DownloadStream(ctx, cid, codex.DownloadStreamOptions{ + Writer: output, + Local: true, + }) } func (c *CodexClient) FetchManifestWithContext(ctx context.Context, cid string) (CodexManifest, error) { diff --git a/communities/codex_client_test.go b/communities/codex_client_test.go index 0db7d01..2392bdf 100644 --- a/communities/codex_client_test.go +++ b/communities/codex_client_test.go @@ -185,8 +185,6 @@ func (suite *CodexClientTestSuite) TestLocalDownloadWithContext_Success() { } func (suite *CodexClientTestSuite) TestLocalDownloadWithContext_Cancellation() { - suite.T().Skip("Wait for cancellation support PR to be merged in codex-go-bindings") - len := 1024 * 1024 * 50 buf := bytes.NewBuffer(make([]byte, len)) cid := upload(*suite.client, suite.T(), buf) diff --git a/go.mod b/go.mod index 96fa688..c5146a4 100644 --- a/go.mod +++ b/go.mod @@ -3,16 +3,16 @@ module go-codex-client go 1.24.0 require ( - github.com/codex-storage/codex-go-bindings v0.0.22 + github.com/codex-storage/codex-go-bindings v0.0.24 github.com/stretchr/testify v1.11.1 go.uber.org/mock v0.6.0 go.uber.org/zap v1.27.0 - google.golang.org/protobuf v1.34.1 + google.golang.org/protobuf v1.36.10 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.uber.org/multierr v1.10.0 // indirect + go.uber.org/multierr v1.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index f414298..2b6a61d 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,14 @@ github.com/codex-storage/codex-go-bindings v0.0.22 h1:53nOqLzgfvR3KdghFAKDoREoW+n12ewvNf8Zf3Pdobc= github.com/codex-storage/codex-go-bindings v0.0.22/go.mod h1:hP/n9iDZqQP4MytkgUepl3yMMsZy5Jbk9lQbbbVJ51Q= +github.com/codex-storage/codex-go-bindings v0.0.23 h1:aMHttUQZELiG0ebSjC58HFHlkyIiCNMElvdTnt4+Y5s= +github.com/codex-storage/codex-go-bindings v0.0.23/go.mod h1:hP/n9iDZqQP4MytkgUepl3yMMsZy5Jbk9lQbbbVJ51Q= +github.com/codex-storage/codex-go-bindings v0.0.24 h1:uUlLiUf5zuec34AvtzpAr4BOCE71FuxqTMBholMR86M= +github.com/codex-storage/codex-go-bindings v0.0.24/go.mod h1:hP/n9iDZqQP4MytkgUepl3yMMsZy5Jbk9lQbbbVJ51Q= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= @@ -14,12 +19,16 @@ go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=