@cryptotaxi247 / kubo / commits / 7cebb33e8

fix: remove dead code

Brian Tiger Chow committed Jan 10, 2015 at 20:19 UTC 7cebb33e814ef32b8d8d9f6830e57be9b03be6a9
1 file changed +2 -68
test/epictest/core.go
+2 -68
@@ -8,7 +8,6 @@ import (
8 blockstore "github.com/jbenet/go-ipfs/blocks/blockstore"
9 blockservice "github.com/jbenet/go-ipfs/blockservice"
10 core "github.com/jbenet/go-ipfs/core"
11 - exchange "github.com/jbenet/go-ipfs/exchange"
11 bitswap "github.com/jbenet/go-ipfs/exchange/bitswap"
12 bsnet "github.com/jbenet/go-ipfs/exchange/bitswap/network"
13 merkledag "github.com/jbenet/go-ipfs/merkledag"
@@ -23,74 +22,9 @@ import (
22
23 var log = eventlog.Logger("epictest")
24
26 -// TODO merge with core.IpfsNode
27 -type Core struct {
28 - *core.IpfsNode
29 -}
30 -
31 -func (c *Core) ID() peer.ID {
32 - return c.IpfsNode.Identity
33 -}
34 -
35 -func (c *Core) Bootstrap(ctx context.Context, p peer.PeerInfo) error {
36 - return c.IpfsNode.Bootstrap(ctx, []peer.PeerInfo{p})
37 -}
38 -
39 -func makeCore(ctx context.Context, rf RepoFactory) (*Core, error) {
40 - node, err := rf(ctx)
41 - if err != nil {
42 - return nil, err
43 - }
44 -
45 - // to make sure nothing is omitted, init each individual field and assign
46 - // all at once at the bottom.
47 - return &Core{
48 - IpfsNode: node,
49 - }, nil
50 -}
51 -
52 -type RepoFactory func(ctx context.Context) (*core.IpfsNode, error)
53 -
54 -type Repo interface {
55 - ID() peer.ID
56 - Blockstore() blockstore.Blockstore
57 - Exchange() exchange.Interface
58 -
59 - Bootstrap(ctx context.Context, peer peer.ID) error
60 -}
61 -
62 -type repo struct {
63 - // DHT, Exchange, Network,Datastore
64 - bitSwapNetwork bsnet.BitSwapNetwork
65 - blockstore blockstore.Blockstore
66 - exchange exchange.Interface
67 - datastore datastore.ThreadSafeDatastore
68 - host host.Host
69 - dht *dht.IpfsDHT
70 - id peer.ID
71 -}
72 -
73 -func (r *repo) ID() peer.ID {
74 - return r.id
75 -}
76 -
77 -func (c *repo) Bootstrap(ctx context.Context, p peer.ID) error {
78 - return c.dht.Connect(ctx, p)
79 -}
80 -
81 -func (r *repo) Datastore() datastore.ThreadSafeDatastore {
82 - return r.datastore
83 -}
84 -
85 -func (r *repo) Blockstore() blockstore.Blockstore {
86 - return r.blockstore
87 -}
88 -
89 -func (r *repo) Exchange() exchange.Interface {
90 - return r.exchange
91 -}
25 +type ConfigOption func(ctx context.Context) (*core.IpfsNode, error)
26
93 -func MocknetTestRepo(p peer.ID, h host.Host, conf testutil.LatencyConfig) RepoFactory {
27 +func MocknetTestRepo(p peer.ID, h host.Host, conf testutil.LatencyConfig) ConfigOption {
28 return func(ctx context.Context) (*core.IpfsNode, error) {
29 const kWriteCacheElems = 100
30 const alwaysSendToPeer = true