Skip to content

Commit

Permalink
proider: fix coreunix tests
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
  • Loading branch information
magik6k committed Oct 25, 2017
1 parent ea684a8 commit f57e691
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/commands/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ You can now refer to the added file in a gateway, like so:
bserv := blockservice.New(addblockstore, exch)
dserv := dag.NewDAGService(bserv)

fileAdder, err := coreunix.NewAdder(req.Context(), n.Pinning, n.Blockstore, dserv)
fileAdder, err := coreunix.NewAdder(req.Context(), n.Pinning, n.Blockstore, dserv, n.Providers)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
Expand Down
9 changes: 5 additions & 4 deletions core/coreunix/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ type AddedObject struct {
Size string `json:",omitempty"`
}

func NewAdder(ctx context.Context, p pin.Pinner, bs bstore.GCBlockstore, ds dag.DAGService) (*Adder, error) {
func NewAdder(ctx context.Context, p pin.Pinner, bs bstore.GCBlockstore, ds dag.DAGService, pr providers.Interface) (*Adder, error) {
return &Adder{
ctx: ctx,
pinning: p,
blockstore: bs,
dagService: ds,
provide: pr,
Progress: false,
Hidden: true,
Pin: true,
Expand Down Expand Up @@ -314,7 +315,7 @@ func Add(n *core.IpfsNode, r io.Reader) (string, error) {
func AddWithContext(ctx context.Context, n *core.IpfsNode, r io.Reader) (string, error) {
defer n.Blockstore.PinLock().Unlock()

fileAdder, err := NewAdder(n.Context(), n.Pinning, n.Blockstore, n.DAG)
fileAdder, err := NewAdder(n.Context(), n.Pinning, n.Blockstore, n.DAG, n.Providers)
if err != nil {
return "", err
}
Expand Down Expand Up @@ -342,7 +343,7 @@ func AddR(n *core.IpfsNode, root string) (key string, err error) {
}
defer f.Close()

fileAdder, err := NewAdder(n.Context(), n.Pinning, n.Blockstore, n.DAG)
fileAdder, err := NewAdder(n.Context(), n.Pinning, n.Blockstore, n.DAG, n.Providers)
if err != nil {
return "", err
}
Expand All @@ -366,7 +367,7 @@ func AddR(n *core.IpfsNode, root string) (key string, err error) {
// the directory, and and error if any.
func AddWrapped(n *core.IpfsNode, r io.Reader, filename string) (string, node.Node, error) {
file := files.NewReaderFile(filename, filename, ioutil.NopCloser(r), nil)
fileAdder, err := NewAdder(n.Context(), n.Pinning, n.Blockstore, n.DAG)
fileAdder, err := NewAdder(n.Context(), n.Pinning, n.Blockstore, n.DAG, n.Providers)
if err != nil {
return "", nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions core/coreunix/add_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestAddGCLive(t *testing.T) {
}

out := make(chan interface{})
adder, err := NewAdder(context.Background(), node.Pinning, node.Blockstore, node.DAG)
adder, err := NewAdder(context.Background(), node.Pinning, node.Blockstore, node.DAG, node.Providers)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -171,7 +171,7 @@ func testAddWPosInfo(t *testing.T, rawLeaves bool) {
bs := &testBlockstore{GCBlockstore: node.Blockstore, expectedPath: "/tmp/foo.txt", t: t}
bserv := blockservice.New(bs, node.Exchange)
dserv := dag.NewDAGService(bserv)
adder, err := NewAdder(context.Background(), node.Pinning, bs, dserv)
adder, err := NewAdder(context.Background(), node.Pinning, bs, dserv, node.Providers)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit f57e691

Please sign in to comment.