1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 19:32:24 +08:00

refactor(blockstore, blockservice) use Blockstore and offline.Exchange

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
This commit is contained in:
Brian Tiger Chow
2014-11-20 18:08:43 -08:00
committed by Jeromy
parent 04a8a6133c
commit d0304def6b
8 changed files with 65 additions and 44 deletions

View File

@ -4,7 +4,10 @@ import (
"testing"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dssync "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
"github.com/jbenet/go-ipfs/blocks/blockstore"
bs "github.com/jbenet/go-ipfs/blockservice"
"github.com/jbenet/go-ipfs/exchange/offline"
mdag "github.com/jbenet/go-ipfs/merkledag"
"github.com/jbenet/go-ipfs/util"
)
@ -19,13 +22,15 @@ func randNode() (*mdag.Node, util.Key) {
func TestPinnerBasic(t *testing.T) {
dstore := ds.NewMapDatastore()
bserv, err := bs.NewBlockService(dstore, nil)
bstore := blockstore.NewBlockstore(dssync.MutexWrap(dstore))
bserv, err := bs.New(bstore, offline.Exchange())
if err != nil {
t.Fatal(err)
}
dserv := mdag.NewDAGService(bserv)
// TODO does pinner need to share datastore with blockservice?
p := NewPinner(dstore, dserv)
a, ak := randNode()