@cryptotaxi247 / kubo / commits / cf43cdd5d

feat(bs/testutil) use write cache

License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

Brian Tiger Chow committed Dec 13, 2014 at 05:34 UTC cf43cdd5d8854d25081673f7cd908a8b40fbf342
1 file changed +6 -1
exchange/bitswap/testutils.go
+6 -1
@@ -74,7 +74,12 @@ func session(net tn.Network, rs mockrouting.Server, ps peer.Peerstore, id peer.I
74 htc := rs.Client(p)
75
76 bsdelay := delay.Fixed(0)
77 - bstore := blockstore.NewBlockstore(ds_sync.MutexWrap(datastore2.WithDelay(ds.NewMapDatastore(), bsdelay)))
77 + const kWriteCacheElems = 100
78 + bstore, err := blockstore.WriteCached(blockstore.NewBlockstore(ds_sync.MutexWrap(datastore2.WithDelay(ds.NewMapDatastore(), bsdelay))), kWriteCacheElems)
79 + if err != nil {
80 + // FIXME perhaps change signature and return error.
81 + panic(err.Error())
82 + }
83
84 const alwaysSendToPeer = true
85 ctx := context.TODO()