mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 01:52:26 +08:00
epictest: add setup logging
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
|||||||
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
|
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
|
||||||
datastore "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
|
datastore "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
|
||||||
sync "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
|
sync "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
|
||||||
|
|
||||||
blockstore "github.com/jbenet/go-ipfs/blocks/blockstore"
|
blockstore "github.com/jbenet/go-ipfs/blocks/blockstore"
|
||||||
blockservice "github.com/jbenet/go-ipfs/blockservice"
|
blockservice "github.com/jbenet/go-ipfs/blockservice"
|
||||||
exchange "github.com/jbenet/go-ipfs/exchange"
|
exchange "github.com/jbenet/go-ipfs/exchange"
|
||||||
@ -22,8 +23,11 @@ import (
|
|||||||
util "github.com/jbenet/go-ipfs/util"
|
util "github.com/jbenet/go-ipfs/util"
|
||||||
"github.com/jbenet/go-ipfs/util/datastore2"
|
"github.com/jbenet/go-ipfs/util/datastore2"
|
||||||
delay "github.com/jbenet/go-ipfs/util/delay"
|
delay "github.com/jbenet/go-ipfs/util/delay"
|
||||||
|
eventlog "github.com/jbenet/go-ipfs/util/eventlog"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var log = eventlog.Logger("epictest")
|
||||||
|
|
||||||
// TODO merge with core.IpfsNode
|
// TODO merge with core.IpfsNode
|
||||||
type core struct {
|
type core struct {
|
||||||
repo Repo
|
repo Repo
|
||||||
@ -128,6 +132,8 @@ func MocknetTestRepo(p peer.ID, n net.Network, conf Config) RepoFactory {
|
|||||||
const alwaysSendToPeer = true
|
const alwaysSendToPeer = true
|
||||||
dsDelay := delay.Fixed(conf.BlockstoreLatency)
|
dsDelay := delay.Fixed(conf.BlockstoreLatency)
|
||||||
ds := sync.MutexWrap(datastore2.WithDelay(datastore.NewMapDatastore(), dsDelay))
|
ds := sync.MutexWrap(datastore2.WithDelay(datastore.NewMapDatastore(), dsDelay))
|
||||||
|
|
||||||
|
log.Debugf("MocknetTestRepo: %s %s %s", p, n.LocalPeer(), n)
|
||||||
dhtt := dht.NewDHT(ctx, p, n, ds)
|
dhtt := dht.NewDHT(ctx, p, n, ds)
|
||||||
bsn := bsnet.NewFromIpfsNetwork(n, dhtt)
|
bsn := bsnet.NewFromIpfsNetwork(n, dhtt)
|
||||||
bstore, err := blockstore.WriteCached(blockstore.NewBlockstore(ds), kWriteCacheElems)
|
bstore, err := blockstore.WriteCached(blockstore.NewBlockstore(ds), kWriteCacheElems)
|
||||||
|
Reference in New Issue
Block a user