utils.go 572 Bytes
Newer Older
1
package mdutils
2 3

import (
4 5 6 7 8 9
	ds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
	dssync "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
	"github.com/ipfs/go-ipfs/blocks/blockstore"
	bsrv "github.com/ipfs/go-ipfs/blockservice"
	"github.com/ipfs/go-ipfs/exchange/offline"
	dag "github.com/ipfs/go-ipfs/merkledag"
10 11
)

12
func Mock() dag.DAGService {
13
	bstore := blockstore.NewBlockstore(dssync.MutexWrap(ds.NewMapDatastore()))
14
	bserv := bsrv.New(bstore, offline.Exchange(bstore))
15
	return dag.NewDAGService(bserv)
16
}