ledger and a util function on peerID
Jeromy Johnson committed
Jul 24, 2014 at 12:53 UTC
2ec1701494d710b9a63ba78979ca29b51eca61dd
2 files changed
+19
-2
bitswap/bitswap.go
+12
-2
@@ -2,13 +2,23 @@ package bitswap
2
3
import (
4
"github.com/jbenet/go-ipfs/blocks"
5
- "github.com/jbenet/go-multihash"
5
+ mh "github.com/jbenet/go-multihash"
6
+
7
+ "time"
8
)
9
10
// aliases
11
12
type Ledger struct {
11
- // todo
13
+ Owner mh.Multihash
14
+
15
+ Partner mh.Multihash
16
+
17
+ BytesSent uint64
18
+
19
+ BytesRecv uint64
20
+
21
+ Timestamp *time.Time
22
}
23
24
type BitSwap struct {
peer/peer.go
+7
@@ -4,11 +4,18 @@ import (
4
u "github.com/jbenet/go-ipfs/util"
5
ma "github.com/jbenet/go-multiaddr"
6
mh "github.com/jbenet/go-multihash"
7
+
8
+ "bytes"
9
)
10
11
// ID is a byte slice representing the identity of a peer.
12
type ID mh.Multihash
13
14
+// Utililty function for comparing two peer ID's
15
+func (id *ID) Equal(other *ID) bool {
16
+ return bytes.Equal(*id, *other)
17
+}
18
+
19
// Map maps Key (string) : *Peer (slices are not comparable).
20
type Map map[u.Key]*Peer
21