@cryptotaxi247 / kubo / commits / 9b06ad53b

added ledger file

Juan Batiz-Benet committed Aug 16, 2014 at 18:21 UTC 9b06ad53bdd86bed6cb36cf81e9d393fafe8f1c7
2 files changed +33 -25
bitswap/bitswap.go
-25
@@ -21,31 +21,6 @@ const PartnerWantListMax = 10
21 // access/lookups.
22 type KeySet map[u.Key]struct{}
23
24 -// Ledger stores the data exchange relationship between two peers.
25 -type Ledger struct {
26 -
27 - // Partner is the ID of the remote Peer.
28 - Partner peer.ID
29 -
30 - // BytesSent counts the number of bytes the local peer sent to Partner
31 - BytesSent uint64
32 -
33 - // BytesReceived counts the number of bytes local peer received from Partner
34 - BytesReceived uint64
35 -
36 - // FirstExchnage is the time of the first data exchange.
37 - FirstExchange *time.Time
38 -
39 - // LastExchange is the time of the last data exchange.
40 - LastExchange *time.Time
41 -
42 - // WantList is a (bounded, small) set of keys that Partner desires.
43 - WantList KeySet
44 -}
45 -
46 -// LedgerMap lists Ledgers by their Partner key.
47 -type LedgerMap map[u.Key]*Ledger
48 -
24 // BitSwap instances implement the bitswap protocol.
25 type BitSwap struct {
26 // peer is the identity of this (local) node.
bitswap/ledger.go new
+33
@@ -0,0 +1,33 @@
1 +package bitswap
2 +
3 +import (
4 + peer "github.com/jbenet/go-ipfs/peer"
5 + u "github.com/jbenet/go-ipfs/util"
6 +
7 + "time"
8 +)
9 +
10 +// Ledger stores the data exchange relationship between two peers.
11 +type Ledger struct {
12 +
13 + // Partner is the ID of the remote Peer.
14 + Partner peer.ID
15 +
16 + // BytesSent counts the number of bytes the local peer sent to Partner
17 + BytesSent uint64
18 +
19 + // BytesReceived counts the number of bytes local peer received from Partner
20 + BytesReceived uint64
21 +
22 + // FirstExchnage is the time of the first data exchange.
23 + FirstExchange *time.Time
24 +
25 + // LastExchange is the time of the last data exchange.
26 + LastExchange *time.Time
27 +
28 + // WantList is a (bounded, small) set of keys that Partner desires.
29 + WantList KeySet
30 +}
31 +
32 +// LedgerMap lists Ledgers by their Partner key.
33 +type LedgerMap map[u.Key]*Ledger