Skip to content

Commit

Permalink
feat: integrate graphsync-v0.9.0 (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmc committed Sep 3, 2021
1 parent 4ad136a commit 24eb74c
Show file tree
Hide file tree
Showing 24 changed files with 206 additions and 138 deletions.
11 changes: 4 additions & 7 deletions benchmarks/testinstance/testinstance.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ func Close(instances []Instance) error {
// Instance is a test instance of bitswap + dependencies for integration testing
type Instance struct {
Peer peer.ID
Loader ipld.Loader
Storer ipld.Storer
LinkSystem ipld.LinkSystem
BlockStore blockstore.Blockstore
Graphsync graphsync.GraphExchange
Manager datatransfer.Manager
Expand Down Expand Up @@ -164,9 +163,8 @@ func NewInstance(ctx context.Context, net tn.Network, tempDir string, diskBasedD
return Instance{}, err
}

loader := storeutil.LoaderForBlockstore(bstore)
storer := storeutil.StorerForBlockstore(bstore)
gs := gsimpl.New(ctx, gsNet, loader, storer, gsimpl.RejectAllRequestsByDefault())
linkSystem := storeutil.LinkSystemForBlockstore(bstore)
gs := gsimpl.New(ctx, gsNet, linkSystem, gsimpl.RejectAllRequestsByDefault())
transport := gstransport.NewTransport(p, gs)
dt, err := dtimpl.NewDataTransfer(namespace.Wrap(dstore, datastore.NewKey("/data-transfers/transfers")), os.TempDir(), dtNet, transport)
if err != nil {
Expand Down Expand Up @@ -198,8 +196,7 @@ func NewInstance(ctx context.Context, net tn.Network, tempDir string, diskBasedD
Peer: p,
Graphsync: gs,
Manager: dt,
Loader: loader,
Storer: storer,
LinkSystem: linkSystem,
BlockStore: bstore,
blockstoreDelay: bsdelay,
ds: dstore,
Expand Down
2 changes: 1 addition & 1 deletion channels/channel_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (c channelState) BaseCID() cid.Cid { return c.baseCid }
func (c channelState) Selector() ipld.Node {
builder := basicnode.Prototype.Any.NewBuilder()
reader := bytes.NewReader(c.selector.Raw)
err := dagcbor.Decoder(builder, reader)
err := dagcbor.Decode(builder, reader)
if err != nil {
log.Error(err)
}
Expand Down
4 changes: 2 additions & 2 deletions channels/channels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func TestMigrationsV0(t *testing.T) {

allSelector := builder.NewSelectorSpecBuilder(basicnode.Prototype.Any).Matcher().Node()
allSelectorBuf := new(bytes.Buffer)
err := dagcbor.Encoder(allSelector, allSelectorBuf)
err := dagcbor.Encode(allSelector, allSelectorBuf)
require.NoError(t, err)
allSelectorBytes := allSelectorBuf.Bytes()

Expand Down Expand Up @@ -556,7 +556,7 @@ func TestMigrationsV1(t *testing.T) {
receivedCids := make([][]cid.Cid, numChannels)
allSelector := builder.NewSelectorSpecBuilder(basicnode.Prototype.Any).Matcher().Node()
allSelectorBuf := new(bytes.Buffer)
err := dagcbor.Encoder(allSelector, allSelectorBuf)
err := dagcbor.Encode(allSelector, allSelectorBuf)
require.NoError(t, err)
allSelectorBytes := allSelectorBuf.Bytes()
selfPeer := testutil.GeneratePeers(1)[0]
Expand Down
13 changes: 10 additions & 3 deletions channels/internal/internalchannel_cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions channels/internal/migrations/v0/v0_cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion channels/internal/migrations/v1/v1_cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions encoding/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func Encode(value Encodable) ([]byte, error) {
}
if ipldEncodable, ok := value.(ipld.Node); ok {
buf := new(bytes.Buffer)
err := dagcbor.Encoder(ipldEncodable, buf)
err := dagcbor.Encode(ipldEncodable, buf)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -79,7 +79,7 @@ type ipldDecoder struct {
func (decoder *ipldDecoder) DecodeFromCbor(encoded []byte) (Encodable, error) {
builder := decoder.style.NewBuilder()
buf := bytes.NewReader(encoded)
err := dagcbor.Decoder(builder, buf)
err := dagcbor.Decode(builder, buf)
if err != nil {
return nil, err
}
Expand Down
20 changes: 11 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,33 @@ require (
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe
github.com/hannahhoward/cbor-gen-for v0.0.0-20200817222906-ea96cece81f1
github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e
github.com/ipfs/go-block-format v0.0.2
github.com/ipfs/go-block-format v0.0.3
github.com/ipfs/go-blockservice v0.1.3
github.com/ipfs/go-cid v0.0.7
github.com/ipfs/go-datastore v0.4.5
github.com/ipfs/go-ds-badger v0.2.3
github.com/ipfs/go-graphsync v0.6.8
github.com/ipfs/go-ds-badger v0.2.6
github.com/ipfs/go-graphsync v0.9.0
github.com/ipfs/go-ipfs-blockstore v1.0.1
github.com/ipfs/go-ipfs-blocksutil v0.0.1
github.com/ipfs/go-ipfs-chunker v0.0.5
github.com/ipfs/go-ipfs-delay v0.0.1
github.com/ipfs/go-ipfs-exchange-offline v0.0.1
github.com/ipfs/go-ipfs-files v0.0.8
github.com/ipfs/go-ipld-cbor v0.0.4
github.com/ipfs/go-ipld-cbor v0.0.5
github.com/ipfs/go-ipld-format v0.2.0
github.com/ipfs/go-log/v2 v2.1.1
github.com/ipfs/go-merkledag v0.3.2
github.com/ipfs/go-unixfs v0.2.4
github.com/ipld/go-ipld-prime v0.5.1-0.20201021195245-109253e8a018
github.com/ipld/go-ipld-prime v0.12.0
github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c
github.com/jpillora/backoff v1.0.0
github.com/libp2p/go-libp2p v0.12.0
github.com/libp2p/go-libp2p-core v0.7.0
github.com/libp2p/go-libp2p v0.13.0
github.com/libp2p/go-libp2p-core v0.8.5
github.com/libp2p/go-libp2p-record v0.1.1 // indirect
github.com/stretchr/testify v1.6.1
github.com/whyrusleeping/cbor-gen v0.0.0-20200826160007-0b9f6c5fb163
github.com/whyrusleeping/cbor-gen v0.0.0-20210219115102-f37d292932f2
go.uber.org/atomic v1.6.0
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
golang.org/x/tools v0.1.1-0.20210225150353-54dc8c5edb56 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
)
Loading

0 comments on commit 24eb74c

Please sign in to comment.