Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

feat: plumb through context changes #55

Merged
merged 2 commits into from
Nov 22, 2021
Merged

feat: plumb through context changes #55

merged 2 commits into from
Nov 22, 2021

Conversation

guseggert
Copy link
Contributor

No description provided.

@@ -133,7 +134,7 @@ func list(fs *Filestore, verify bool, key mh.Multihash) *ListRes {

func listAll(fs *Filestore, verify bool) (func() *ListRes, error) {
q := dsq.Query{}
qr, err := fs.fm.ds.Query(q)
qr, err := fs.fm.ds.Query(context.Background(), q)
if err != nil {
return nil, err
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either the lambda returned below or ListAll() should take a context. Probably ok to leave it like this for now.

@guseggert
Copy link
Contributor Author

This is wrong b/c I didn't realize that go-ipfs consumes go-filestore@v0.0.3 whereas this is building on the breaking changes introduced in v1.0.0, so I need to backport this.

@guseggert guseggert closed this Nov 10, 2021
@aschmahmann aschmahmann reopened this Nov 19, 2021
@aschmahmann
Copy link

We still need to have a v1 version of this for use in places like lotus

Copy link

@aschmahmann aschmahmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't quite ready, it should match #55

@guseggert guseggert changed the title feat: add contexts on datastore methods feat: plumb through context changes Nov 19, 2021
@github-actions
Copy link

Suggested version: v1.1.0
Comparing to: v1.0.0 (diff)

Changes in go.mod file(s):

diff --git a/go.mod b/go.mod
index 096a5f1..5ee071b 100644
--- a/go.mod
+++ b/go.mod
@@ -1,16 +1,16 @@
 module github.com/ipfs/go-filestore
 
-go 1.12
+go 1.16
 
 require (
-	github.com/gogo/protobuf v1.3.1
-	github.com/ipfs/go-block-format v0.0.2
-	github.com/ipfs/go-cid v0.0.5
-	github.com/ipfs/go-datastore v0.4.4
-	github.com/ipfs/go-ipfs-blockstore v1.0.0
-	github.com/ipfs/go-ipfs-ds-help v1.0.0
+	github.com/gogo/protobuf v1.3.2
+	github.com/ipfs/go-block-format v0.0.3
+	github.com/ipfs/go-cid v0.0.7
+	github.com/ipfs/go-datastore v0.5.0
+	github.com/ipfs/go-ipfs-blockstore v1.1.1
+	github.com/ipfs/go-ipfs-ds-help v1.1.0
 	github.com/ipfs/go-ipfs-posinfo v0.0.1
-	github.com/ipfs/go-log v1.0.2
-	github.com/ipfs/go-merkledag v0.3.1
-	github.com/multiformats/go-multihash v0.0.13
+	github.com/ipfs/go-log v1.0.5
+	github.com/ipfs/go-merkledag v0.5.1
+	github.com/multiformats/go-multihash v0.0.15
 )

gorelease says:

# github.com/ipfs/go-filestore
## incompatible changes
(*FileManager).DeleteBlock: changed from func(github.com/ipfs/go-cid.Cid) error to func(context.Context, github.com/ipfs/go-cid.Cid) error
(*FileManager).Get: changed from func(github.com/ipfs/go-cid.Cid) (github.com/ipfs/go-block-format.Block, error) to func(context.Context, github.com/ipfs/go-cid.Cid) (github.com/ipfs/go-block-format.Block, error)
(*FileManager).GetSize: changed from func(github.com/ipfs/go-cid.Cid) (int, error) to func(context.Context, github.com/ipfs/go-cid.Cid) (int, error)
(*FileManager).Has: changed from func(github.com/ipfs/go-cid.Cid) (bool, error) to func(context.Context, github.com/ipfs/go-cid.Cid) (bool, error)
(*FileManager).Put: changed from func(*github.com/ipfs/go-ipfs-posinfo.FilestoreNode) error to func(context.Context, *github.com/ipfs/go-ipfs-posinfo.FilestoreNode) error
(*FileManager).PutMany: changed from func([]*github.com/ipfs/go-ipfs-posinfo.FilestoreNode) error to func(context.Context, []*github.com/ipfs/go-ipfs-posinfo.FilestoreNode) error
(*Filestore).DeleteBlock: changed from func(github.com/ipfs/go-cid.Cid) error to func(context.Context, github.com/ipfs/go-cid.Cid) error
(*Filestore).Get: changed from func(github.com/ipfs/go-cid.Cid) (github.com/ipfs/go-block-format.Block, error) to func(context.Context, github.com/ipfs/go-cid.Cid) (github.com/ipfs/go-block-format.Block, error)
(*Filestore).GetSize: changed from func(github.com/ipfs/go-cid.Cid) (int, error) to func(context.Context, github.com/ipfs/go-cid.Cid) (int, error)
(*Filestore).Has: changed from func(github.com/ipfs/go-cid.Cid) (bool, error) to func(context.Context, github.com/ipfs/go-cid.Cid) (bool, error)
(*Filestore).Put: changed from func(github.com/ipfs/go-block-format.Block) error to func(context.Context, github.com/ipfs/go-block-format.Block) error
(*Filestore).PutMany: changed from func([]github.com/ipfs/go-block-format.Block) error to func(context.Context, []github.com/ipfs/go-block-format.Block) error
List: changed from func(*Filestore, github.com/ipfs/go-cid.Cid) *ListRes to func(context.Context, *Filestore, github.com/ipfs/go-cid.Cid) *ListRes
ListAll: changed from func(*Filestore, bool) (func() *ListRes, error) to func(context.Context, *Filestore, bool) (func(context.Context) *ListRes, error)
Verify: changed from func(*Filestore, github.com/ipfs/go-cid.Cid) *ListRes to func(context.Context, *Filestore, github.com/ipfs/go-cid.Cid) *ListRes
VerifyAll: changed from func(*Filestore, bool) (func() *ListRes, error) to func(context.Context, *Filestore, bool) (func(context.Context) *ListRes, error)

# summary
Cannot suggest a release version.
Incompatible changes were detected.

gocompat says:

"github.com/ipfs/go-filestore".FileManager.DeleteBlock MethodSignatureChanged
"github.com/ipfs/go-filestore".FileManager.Get MethodSignatureChanged
"github.com/ipfs/go-filestore".FileManager.GetSize MethodSignatureChanged
"github.com/ipfs/go-filestore".FileManager.Has MethodSignatureChanged
"github.com/ipfs/go-filestore".FileManager.Put MethodSignatureChanged
"github.com/ipfs/go-filestore".FileManager.PutMany MethodSignatureChanged
"github.com/ipfs/go-filestore".Filestore.DeleteBlock MethodSignatureChanged
"github.com/ipfs/go-filestore".Filestore.Get MethodSignatureChanged
"github.com/ipfs/go-filestore".Filestore.GetSize MethodSignatureChanged
"github.com/ipfs/go-filestore".Filestore.Has MethodSignatureChanged
"github.com/ipfs/go-filestore".Filestore.Put MethodSignatureChanged
"github.com/ipfs/go-filestore".Filestore.PutMany MethodSignatureChanged
"github.com/ipfs/go-filestore".VerifyAll SignatureChanged
"github.com/ipfs/go-filestore".ListAll SignatureChanged
"github.com/ipfs/go-filestore".Verify SignatureChanged
"github.com/ipfs/go-filestore".List SignatureChanged

@marten-seemann
Copy link
Member

This should be a v2, as the API was changed.

@aschmahmann
Copy link

@marten-seemann we're not bumping these to v2 as right now there is a good deal of complexity around the v0 and v1 (both in use) of this repo and they need to be swappable (i.e. I need to be able to drop in v1 as a v0 replacement).

This choice is independent of, but related to, the decision to not release go-datastore as a v2 despite the breaking change with contexts. So we're knowingly doing the wrong thing.

@aschmahmann aschmahmann merged commit af11941 into master Nov 22, 2021
@aschmahmann aschmahmann deleted the feat/context branch November 22, 2021 20:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants