Skip to content

Commit

Permalink
Use new go-datastore with contexts (#125)
Browse files Browse the repository at this point in the history
* Use new go-datastore with contexts
* Removed mostly unused utils/utils.go
* Replaced engine/dscache.go with enging/lrustore/lrustore.go
  • Loading branch information
gammazero authored Jan 7, 2022
1 parent 9c133b1 commit 37c38e2
Show file tree
Hide file tree
Showing 21 changed files with 1,078 additions and 660 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*~
index-provider
cmd/provider/provider
provider
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
BIN := index-provider
BIN_SUBDIR := cmd/provider

.PHONY: all build clean test

all: build
all: vet test build

build: $(BIN)
build:
cd $(BIN_SUBDIR) && go build

docker: Dockerfile clean
docker build . --force-rm -f Dockerfile -t indexer-reference-provider:$(shell git rev-parse --short HEAD)

$(BIN): vet test
cd cmd/provider && go build -o ../../$(@)
install:
cd $(BIN_SUBDIR) && go install

lint:
golangci-lint run
Expand Down
4 changes: 2 additions & 2 deletions cardatatransfer/cardatatransfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ func copySelectorOutputToBlockstore(t *testing.T, sourceBs bstore.Blockstore, ro
if !ok {
return nil, fmt.Errorf("unsupported link type")
}
block, err := sourceBs.Get(asCidLink.Cid)
block, err := sourceBs.Get(lctx.Ctx, asCidLink.Cid)
if err != nil {
return nil, err
}
err = bsOutput.Put(block)
err = bsOutput.Put(lctx.Ctx, block)
if err != nil {
return nil, err
}
Expand Down
18 changes: 9 additions & 9 deletions cmd/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ module github.com/filecoin-project/index-provider/cmd
go 1.16

require (
github.com/filecoin-project/go-data-transfer v1.11.4
github.com/filecoin-project/go-data-transfer v1.12.1
github.com/filecoin-project/index-provider v0.0.0-20211115210313-7957526f5b07
github.com/filecoin-project/storetheindex v0.2.0
github.com/ipfs/go-cid v0.1.0
github.com/ipfs/go-ds-leveldb v0.4.2
github.com/ipfs/go-graphsync v0.10.4
github.com/ipfs/go-ds-leveldb v0.5.0
github.com/ipfs/go-graphsync v0.11.5
github.com/ipfs/go-ipfs v0.10.0
github.com/ipfs/go-log/v2 v2.3.0
github.com/ipld/go-car/v2 v2.0.3-0.20210920144420-f35d88ce16ca
github.com/ipld/go-ipld-prime v0.14.0
github.com/libp2p/go-libp2p v0.15.0
github.com/ipfs/go-log/v2 v2.4.0
github.com/ipld/go-car/v2 v2.1.1
github.com/ipld/go-ipld-prime v0.14.3
github.com/libp2p/go-libp2p v0.17.0
github.com/mitchellh/go-homedir v1.1.0
github.com/multiformats/go-multiaddr v0.4.1
github.com/multiformats/go-multicodec v0.3.1-0.20210902112759-1539a079fd61
github.com/multiformats/go-multiaddr v0.5.0
github.com/multiformats/go-multicodec v0.4.0
github.com/multiformats/go-multihash v0.1.0
github.com/rogpeppe/go-internal v1.8.0
github.com/stretchr/testify v1.7.0
Expand Down
180 changes: 128 additions & 52 deletions cmd/go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmd/provider/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func daemonCommand(cctx *cli.Context) error {
if err != nil {
return fmt.Errorf("bad p2p address in config %s: %s", cfg.ProviderServer.ListenMultiaddr, err)
}
h, err := libp2p.New(ctx,
h, err := libp2p.New(
// Use the keypair generated during init
libp2p.Identity(privKey),
// Listen to p2p addr specified in config
Expand Down
4 changes: 2 additions & 2 deletions e2e_retrieve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ type testServer struct {
}

func newTestServer(t *testing.T, ctx context.Context) *testServer {
h, err := libp2p.New(ctx, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0"))
h, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0"))
require.NoError(t, err)
priv, _, err := test.RandTestKeyPair(crypto.Ed25519, 256)
require.NoError(t, err)
Expand Down Expand Up @@ -214,7 +214,7 @@ func newTestClient(t *testing.T, ctx context.Context) *testClient {
store := dssync.MutexWrap(datastore.NewMapDatastore())
blockStore := blockstore.NewBlockstore(store)
lsys := storeutil.LinkSystemForBlockstore(blockStore)
h, err := libp2p.New(ctx, libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0"))
h, err := libp2p.New(libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0"))
require.NoError(t, err)

dt := testutil.SetupDataTransferOnHost(t, h, store, lsys)
Expand Down
208 changes: 0 additions & 208 deletions engine/dscache.go

This file was deleted.

Loading

0 comments on commit 37c38e2

Please sign in to comment.