lint fixes
Juan Batiz-Benet committed
Aug 16, 2014 at 18:17 UTC
9c4e6703e05a459d4f3f1fc9de5014e58a2d0da3
1 file changed
+13
-9
bitswap/bitswap.go
+13
-9
@@ -1,7 +1,9 @@
1
package bitswap
2
3
import (
4
+ blocks "github.com/jbenet/go-ipfs/blocks"
5
peer "github.com/jbenet/go-ipfs/peer"
6
+ swarm "github.com/jbenet/go-ipfs/swarm"
7
u "github.com/jbenet/go-ipfs/util"
8
9
ds "github.com/jbenet/datastore.go"
@@ -32,7 +34,7 @@ type Ledger struct {
34
BytesReceived uint64
35
36
// FirstExchnage is the time of the first data exchange.
35
- LastExchange *time.Time
37
+ FirstExchange *time.Time
38
39
// LastExchange is the time of the last data exchange.
40
LastExchange *time.Time
@@ -44,9 +46,10 @@ type Ledger struct {
46
// LedgerMap lists Ledgers by their Partner key.
47
type LedgerMap map[u.Key]*Ledger
48
49
+// BitSwap instances implement the bitswap protocol.
50
type BitSwap struct {
51
// peer is the identity of this (local) node.
49
- peer peer.Peer
52
+ peer *peer.Peer
53
54
// net holds the connections to all peers.
55
net swarm.Network
@@ -68,24 +71,25 @@ type BitSwap struct {
71
wantList KeySet
72
}
73
74
+// NewBitSwap creates a new BitSwap instance. It does not check its parameters.
75
func NewBitSwap(p *peer.Peer, net swarm.Network, d ds.Datastore) *BitSwap {
76
return &BitSwap{
77
peer: p,
78
net: net,
79
datastore: d,
76
- ledgers: &LedgerMap{},
77
- haveList: &KeySet{},
78
- wantList: &KeySet{},
80
+ partners: LedgerMap{},
81
+ wantList: KeySet{},
82
}
83
}
84
85
// GetBlock attempts to retrieve a particular block from peers, within timeout.
83
-func (s *BitSwap) GetBlock(k u.Key, timeout time.Time) (*Block, error) {
86
+func (s *BitSwap) GetBlock(k u.Key, timeout time.Time) (
87
+ *blocks.Block, error) {
88
return nil, errors.New("not implemented")
89
}
90
87
-// Announce the existance of a block to BitSwap, potentially sending it to
88
-// peers (Partners) whose WantLists include it.
89
-func (s *BitSwap) HaveBlock(k u.Key) (*Block, error) {
91
+// HaveBlock announces the existance of a block to BitSwap, potentially sending
92
+// it to peers (Partners) whose WantLists include it.
93
+func (s *BitSwap) HaveBlock(k u.Key) (*blocks.Block, error) {
94
return nil, errors.New("not implemented")
95
}