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

import (
4 5 6 7
	"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"
8

Steven Allen's avatar
Steven Allen committed
9 10
	ds "gx/ipfs/QmPpegoMqhAEqjncrzArm7KVWAkCm78rqL2DPuNjhPrshg/go-datastore"
	dssync "gx/ipfs/QmPpegoMqhAEqjncrzArm7KVWAkCm78rqL2DPuNjhPrshg/go-datastore/sync"
11
	node "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format"
12 13
)

14
func Mock() node.DAGService {
15 16 17 18
	return dag.NewDAGService(Bserv())
}

func Bserv() bsrv.BlockService {
19
	bstore := blockstore.NewBlockstore(dssync.MutexWrap(ds.NewMapDatastore()))
20
	return bsrv.New(bstore, offline.Exchange(bstore))
21
}