Commit f4bab574 authored by tavit ohanian's avatar tavit ohanian

refactor after forking multiformats

parent e2ca9248
...@@ -9,12 +9,12 @@ import ( ...@@ -9,12 +9,12 @@ import (
"io" "io"
"sync" "sync"
blocks "github.com/ipfs/go-block-format" blocks "gitlab.dms3.io/dms3/go-block-format"
cid "github.com/ipfs/go-cid" cid "gitlab.dms3.io/dms3/go-cid"
blockstore "github.com/ipfs/go-ipfs-blockstore" blockstore "gitlab.dms3.io/dms3/go-dms3-blockstore"
exchange "github.com/ipfs/go-ipfs-exchange-interface" exchange "gitlab.dms3.io/dms3/go-dms3-exchange-interface"
logging "github.com/ipfs/go-log" logging "gitlab.dms3.io/dms3/go-log"
"github.com/ipfs/go-verifcid" "gitlab.dms3.io/dms3/go-verifcid"
) )
var log = logging.Logger("blockservice") var log = logging.Logger("blockservice")
...@@ -147,7 +147,7 @@ func (s *blockService) AddBlock(o blocks.Block) error { ...@@ -147,7 +147,7 @@ func (s *blockService) AddBlock(o blocks.Block) error {
return err return err
} }
log.Event(context.TODO(), "BlockService.BlockAdded", c) log.Debugf("BlockService.BlockAdded %s", c)
if s.exchange != nil { if s.exchange != nil {
if err := s.exchange.HasBlock(o); err != nil { if err := s.exchange.HasBlock(o); err != nil {
...@@ -193,7 +193,7 @@ func (s *blockService) AddBlocks(bs []blocks.Block) error { ...@@ -193,7 +193,7 @@ func (s *blockService) AddBlocks(bs []blocks.Block) error {
if s.exchange != nil { if s.exchange != nil {
for _, o := range toput { for _, o := range toput {
log.Event(context.TODO(), "BlockService.BlockAdded", o.Cid()) log.Debugf("BlockService.BlockAdded %s", o.Cid())
if err := s.exchange.HasBlock(o); err != nil { if err := s.exchange.HasBlock(o); err != nil {
log.Errorf("HasBlock: %s", err.Error()) log.Errorf("HasBlock: %s", err.Error())
} }
...@@ -243,7 +243,7 @@ func getBlock(ctx context.Context, c cid.Cid, bs blockstore.Blockstore, fget fun ...@@ -243,7 +243,7 @@ func getBlock(ctx context.Context, c cid.Cid, bs blockstore.Blockstore, fget fun
} }
return nil, err return nil, err
} }
log.Event(ctx, "BlockService.BlockFetched", c) log.Debugf("BlockService.BlockFetched %s", c)
return blk, nil return blk, nil
} }
...@@ -320,7 +320,7 @@ func getBlocks(ctx context.Context, ks []cid.Cid, bs blockstore.Blockstore, fget ...@@ -320,7 +320,7 @@ func getBlocks(ctx context.Context, ks []cid.Cid, bs blockstore.Blockstore, fget
} }
for b := range rblocks { for b := range rblocks {
log.Event(ctx, "BlockService.BlockFetched", b.Cid()) log.Debugf("BlockService.BlockFetched %s", b.Cid())
select { select {
case out <- b: case out <- b:
case <-ctx.Done(): case <-ctx.Done():
...@@ -335,7 +335,7 @@ func getBlocks(ctx context.Context, ks []cid.Cid, bs blockstore.Blockstore, fget ...@@ -335,7 +335,7 @@ func getBlocks(ctx context.Context, ks []cid.Cid, bs blockstore.Blockstore, fget
func (s *blockService) DeleteBlock(c cid.Cid) error { func (s *blockService) DeleteBlock(c cid.Cid) error {
err := s.blockstore.DeleteBlock(c) err := s.blockstore.DeleteBlock(c)
if err == nil { if err == nil {
log.Event(context.TODO(), "BlockService.BlockDeleted", c) log.Debugf("BlockService.BlockDeleted %s", c)
} }
return err return err
} }
......
...@@ -4,13 +4,13 @@ import ( ...@@ -4,13 +4,13 @@ import (
"context" "context"
"testing" "testing"
blocks "github.com/ipfs/go-block-format" blocks "gitlab.dms3.io/dms3/go-block-format"
ds "github.com/ipfs/go-datastore" ds "gitlab.dms3.io/dms3/go-datastore"
dssync "github.com/ipfs/go-datastore/sync" dssync "gitlab.dms3.io/dms3/go-datastore/sync"
blockstore "github.com/ipfs/go-ipfs-blockstore" blockstore "gitlab.dms3.io/dms3/go-dms3-blockstore"
butil "github.com/ipfs/go-ipfs-blocksutil" butil "gitlab.dms3.io/dms3/go-dms3-blocksutil"
exchange "github.com/ipfs/go-ipfs-exchange-interface" exchange "gitlab.dms3.io/dms3/go-dms3-exchange-interface"
offline "github.com/ipfs/go-ipfs-exchange-offline" offline "gitlab.dms3.io/dms3/go-dms3-exchange-offline"
) )
func TestWriteThroughWorks(t *testing.T) { func TestWriteThroughWorks(t *testing.T) {
......
This diff is collapsed.
...@@ -7,15 +7,15 @@ import ( ...@@ -7,15 +7,15 @@ import (
"testing" "testing"
"time" "time"
. "github.com/ipfs/go-blockservice" . "gitlab.dms3.io/dms3/go-blockservice"
blocks "github.com/ipfs/go-block-format" blocks "gitlab.dms3.io/dms3/go-block-format"
cid "github.com/ipfs/go-cid" cid "gitlab.dms3.io/dms3/go-cid"
ds "github.com/ipfs/go-datastore" ds "gitlab.dms3.io/dms3/go-datastore"
dssync "github.com/ipfs/go-datastore/sync" dssync "gitlab.dms3.io/dms3/go-datastore/sync"
blockstore "github.com/ipfs/go-ipfs-blockstore" blockstore "gitlab.dms3.io/dms3/go-dms3-blockstore"
offline "github.com/ipfs/go-ipfs-exchange-offline" offline "gitlab.dms3.io/dms3/go-dms3-exchange-offline"
u "github.com/ipfs/go-ipfs-util" u "gitlab.dms3.io/dms3/go-dms3-util"
) )
func newObject(data []byte) blocks.Block { func newObject(data []byte) blocks.Block {
......
package bstest package bstest
import ( import (
. "github.com/ipfs/go-blockservice" . "gitlab.dms3.io/dms3/go-blockservice"
testinstance "github.com/ipfs/go-bitswap/testinstance" testinstance "gitlab.dms3.io/dms3/go-bitswap/testinstance"
tn "github.com/ipfs/go-bitswap/testnet" tn "gitlab.dms3.io/dms3/go-bitswap/testnet"
delay "github.com/ipfs/go-ipfs-delay" delay "gitlab.dms3.io/dms3/go-dms3-delay"
mockrouting "github.com/ipfs/go-ipfs-routing/mock" mockrouting "gitlab.dms3.io/dms3/go-dms3-routing/mock"
) )
// Mocks returns |n| connected mock Blockservices // Mocks returns |n| connected mock Blockservices
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment