utils.go 590 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 9
	ds "gx/ipfs/QmVSase1JP7cq9QkPT46oNwdp9pT6kBkG3oqS14y3QcZjG/go-datastore"
	dssync "gx/ipfs/QmVSase1JP7cq9QkPT46oNwdp9pT6kBkG3oqS14y3QcZjG/go-datastore/sync"
10 11
)

12
func Mock() dag.DAGService {
13 14 15 16
	return dag.NewDAGService(Bserv())
}

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