Unverified Commit 9eada816 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #31 from ipfs/chore/retract-and-revert

Retract and revert 1.0.0
parents 7463091a 2d1d4ce6
...@@ -4,7 +4,7 @@ os: ...@@ -4,7 +4,7 @@ os:
language: go language: go
go: go:
- 1.13.x - 1.16.x
env: env:
global: global:
......
module github.com/ipfs/go-ipfs-provider module github.com/ipfs/go-ipfs-provider
go 1.13 go 1.16
retract [v1.0.0, v1.0.1]
require ( require (
github.com/cenkalti/backoff v2.2.1+incompatible github.com/cenkalti/backoff v2.2.1+incompatible
github.com/ipfs/go-blockservice v0.1.4 github.com/ipfs/go-blockservice v0.1.2
github.com/ipfs/go-cid v0.0.7 github.com/ipfs/go-cid v0.0.3
github.com/ipfs/go-cidutil v0.0.2 github.com/ipfs/go-cidutil v0.0.2
github.com/ipfs/go-datastore v0.4.5 github.com/ipfs/go-datastore v0.1.0
github.com/ipfs/go-fetcher v1.1.0 github.com/ipfs/go-ipfs-blockstore v0.1.0
github.com/ipfs/go-ipfs-blockstore v0.1.4
github.com/ipfs/go-ipfs-blocksutil v0.0.1 github.com/ipfs/go-ipfs-blocksutil v0.0.1
github.com/ipfs/go-ipfs-exchange-offline v0.0.1 github.com/ipfs/go-ipfs-exchange-offline v0.0.1
github.com/ipfs/go-ipfs-routing v0.1.0 github.com/ipfs/go-ipfs-routing v0.1.0
github.com/ipfs/go-ipld-cbor v0.0.3 github.com/ipfs/go-ipld-cbor v0.0.3
github.com/ipfs/go-log v1.0.4 github.com/ipfs/go-ipld-format v0.0.2
github.com/ipfs/go-log v0.0.1
github.com/ipfs/go-merkledag v0.2.3
github.com/ipfs/go-verifcid v0.0.1 github.com/ipfs/go-verifcid v0.0.1
github.com/ipld/go-codec-dagpb v1.2.0 github.com/libp2p/go-libp2p-core v0.2.2
github.com/ipld/go-ipld-prime v0.9.0 github.com/libp2p/go-libp2p-testing v0.1.0
github.com/libp2p/go-libp2p-core v0.8.5 github.com/multiformats/go-multihash v0.0.8
github.com/libp2p/go-libp2p-testing v0.4.0
github.com/multiformats/go-multihash v0.0.15
) )
This diff is collapsed.
...@@ -9,11 +9,11 @@ import ( ...@@ -9,11 +9,11 @@ import (
"github.com/cenkalti/backoff" "github.com/cenkalti/backoff"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/ipfs/go-cidutil" "github.com/ipfs/go-cidutil"
"github.com/ipfs/go-fetcher"
blocks "github.com/ipfs/go-ipfs-blockstore" blocks "github.com/ipfs/go-ipfs-blockstore"
ipld "github.com/ipfs/go-ipld-format"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
"github.com/ipfs/go-merkledag"
"github.com/ipfs/go-verifcid" "github.com/ipfs/go-verifcid"
cidlink "github.com/ipld/go-ipld-prime/linking/cid"
"github.com/libp2p/go-libp2p-core/routing" "github.com/libp2p/go-libp2p-core/routing"
) )
...@@ -184,9 +184,9 @@ type Pinner interface { ...@@ -184,9 +184,9 @@ type Pinner interface {
} }
// NewPinnedProvider returns provider supplying pinned keys // NewPinnedProvider returns provider supplying pinned keys
func NewPinnedProvider(onlyRoots bool, pinning Pinner, fetchConfig fetcher.FetcherConfig) KeyChanFunc { func NewPinnedProvider(onlyRoots bool, pinning Pinner, dag ipld.DAGService) KeyChanFunc {
return func(ctx context.Context) (<-chan cid.Cid, error) { return func(ctx context.Context) (<-chan cid.Cid, error) {
set, err := pinSet(ctx, pinning, fetchConfig, onlyRoots) set, err := pinSet(ctx, pinning, dag, onlyRoots)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -208,7 +208,7 @@ func NewPinnedProvider(onlyRoots bool, pinning Pinner, fetchConfig fetcher.Fetch ...@@ -208,7 +208,7 @@ func NewPinnedProvider(onlyRoots bool, pinning Pinner, fetchConfig fetcher.Fetch
} }
} }
func pinSet(ctx context.Context, pinning Pinner, fetchConfig fetcher.FetcherConfig, onlyRoots bool) (*cidutil.StreamingSet, error) { func pinSet(ctx context.Context, pinning Pinner, dag ipld.DAGService, onlyRoots bool) (*cidutil.StreamingSet, error) {
set := cidutil.NewStreamingSet() set := cidutil.NewStreamingSet()
go func() { go func() {
...@@ -230,18 +230,11 @@ func pinSet(ctx context.Context, pinning Pinner, fetchConfig fetcher.FetcherConf ...@@ -230,18 +230,11 @@ func pinSet(ctx context.Context, pinning Pinner, fetchConfig fetcher.FetcherConf
logR.Errorf("reprovide indirect pins: %s", err) logR.Errorf("reprovide indirect pins: %s", err)
return return
} }
session := fetchConfig.NewSession(ctx)
for _, key := range rkeys { for _, key := range rkeys {
set.Visitor(ctx)(key) if onlyRoots {
if !onlyRoots { set.Visitor(ctx)(key)
err := fetcher.BlockAll(ctx, session, cidlink.Link{key}, func(res fetcher.FetchResult) error { } else {
clink, ok := res.LastBlockLink.(cidlink.Link) err := merkledag.Walk(ctx, merkledag.GetLinksWithDAG(dag), key, set.Visitor(ctx))
if ok {
set.Visitor(ctx)(clink.Cid)
}
return nil
})
if err != nil { if err != nil {
logR.Errorf("reprovide indirect pins: %s", err) logR.Errorf("reprovide indirect pins: %s", err)
return return
......
...@@ -9,12 +9,11 @@ import ( ...@@ -9,12 +9,11 @@ import (
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
ds "github.com/ipfs/go-datastore" ds "github.com/ipfs/go-datastore"
dssync "github.com/ipfs/go-datastore/sync" dssync "github.com/ipfs/go-datastore/sync"
"github.com/ipfs/go-fetcher"
"github.com/ipfs/go-ipfs-blockstore" "github.com/ipfs/go-ipfs-blockstore"
offline "github.com/ipfs/go-ipfs-exchange-offline" offline "github.com/ipfs/go-ipfs-exchange-offline"
mock "github.com/ipfs/go-ipfs-routing/mock" mock "github.com/ipfs/go-ipfs-routing/mock"
cbor "github.com/ipfs/go-ipld-cbor" cbor "github.com/ipfs/go-ipld-cbor"
_ "github.com/ipld/go-ipld-prime/codec/dagcbor" merkledag "github.com/ipfs/go-merkledag"
peer "github.com/libp2p/go-libp2p-core/peer" peer "github.com/libp2p/go-libp2p-core/peer"
testutil "github.com/libp2p/go-libp2p-testing/net" testutil "github.com/libp2p/go-libp2p-testing/net"
mh "github.com/multiformats/go-multihash" mh "github.com/multiformats/go-multihash"
...@@ -196,7 +195,7 @@ func TestReprovidePinned(t *testing.T) { ...@@ -196,7 +195,7 @@ func TestReprovidePinned(t *testing.T) {
nodes, bstore := setupDag(t) nodes, bstore := setupDag(t)
fetchConfig := fetcher.NewFetcherConfig(bsrv.New(bstore, offline.Exchange(bstore))) dag := merkledag.NewDAGService(bsrv.New(bstore, offline.Exchange(bstore)))
for i := 0; i < 2; i++ { for i := 0; i < 2; i++ {
clA, clB, idA, _ := setupRouting(t) clA, clB, idA, _ := setupRouting(t)
...@@ -216,7 +215,7 @@ func TestReprovidePinned(t *testing.T) { ...@@ -216,7 +215,7 @@ func TestReprovidePinned(t *testing.T) {
keyProvider := NewPinnedProvider(onlyRoots, &mockPinner{ keyProvider := NewPinnedProvider(onlyRoots, &mockPinner{
recursive: []cid.Cid{nodes[1]}, recursive: []cid.Cid{nodes[1]},
direct: []cid.Cid{nodes[3]}, direct: []cid.Cid{nodes[3]},
}, fetchConfig) }, dag)
reprov := NewReprovider(ctx, time.Hour, clA, keyProvider) reprov := NewReprovider(ctx, time.Hour, clA, keyProvider)
err := reprov.Reprovide() err := reprov.Reprovide()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment