Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove github.com/ipfs/go-ipfs-blockstore dependency #430

Merged
merged 1 commit into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion v2/blockstore/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
// * blockstore.GetSize will always succeed, returning the multihash digest length of the given CID.
// * blockstore.Put and blockstore.PutMany will always succeed without performing any operation unless car.StoreIdentityCIDs is enabled.
//
// See: https://pkg.go.dev/github.com/ipfs/go-ipfs-blockstore#NewIdStore
// See: https://pkg.go.dev/github.com/ipfs/boxo/blockstore#NewIdStore
package blockstore
16 changes: 14 additions & 2 deletions v2/blockstore/readonly.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
blockstore "github.com/ipfs/go-ipfs-blockstore"
format "github.com/ipfs/go-ipld-format"
carv2 "github.com/ipld/go-car/v2"
"github.com/ipld/go-car/v2/index"
Expand All @@ -20,7 +19,20 @@ import (
"golang.org/x/exp/mmap"
)

var _ blockstore.Blockstore = (*ReadOnly)(nil)
// Blockstore is compatible with github.com/ipfs/go-ipfs-blockstore.Blockstore
// and github.com/ipfs/boxo/blockstore.Blockstore.
type Blockstore interface {
DeleteBlock(context.Context, cid.Cid) error
Has(context.Context, cid.Cid) (bool, error)
Get(context.Context, cid.Cid) (blocks.Block, error)
GetSize(context.Context, cid.Cid) (int, error)
Put(context.Context, blocks.Block) error
PutMany(context.Context, []blocks.Block) error
AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
HashOnRead(enabled bool)
}

var _ Blockstore = (*ReadOnly)(nil)

var (
errZeroLengthSection = fmt.Errorf("zero-length carv2 section not allowed by default; see WithZeroLengthSectionAsEOF option")
Expand Down
3 changes: 1 addition & 2 deletions v2/blockstore/readwrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
blockstore "github.com/ipfs/go-ipfs-blockstore"

carv2 "github.com/ipld/go-car/v2"
"github.com/ipld/go-car/v2/index"
Expand All @@ -17,7 +16,7 @@ import (
"github.com/ipld/go-car/v2/internal/store"
)

var _ blockstore.Blockstore = (*ReadWrite)(nil)
var _ Blockstore = (*ReadWrite)(nil)

var (
errFinalized = fmt.Errorf("cannot write in a carv2 blockstore after finalize")
Expand Down
2 changes: 1 addition & 1 deletion v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.19
require (
github.com/ipfs/go-block-format v0.1.2
github.com/ipfs/go-cid v0.4.1
github.com/ipfs/go-ipfs-blockstore v1.3.0
github.com/ipfs/go-ipld-cbor v0.0.6
github.com/ipfs/go-ipld-format v0.4.0
github.com/ipfs/go-merkledag v0.10.0
Expand Down Expand Up @@ -33,6 +32,7 @@ require (
github.com/ipfs/go-bitfield v1.1.0 // indirect
github.com/ipfs/go-blockservice v0.5.0 // indirect
github.com/ipfs/go-datastore v0.6.0 // indirect
github.com/ipfs/go-ipfs-blockstore v1.3.0 // indirect
github.com/ipfs/go-ipfs-chunker v0.0.5 // indirect
github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect
github.com/ipfs/go-ipfs-exchange-interface v0.2.0 // indirect
Expand Down