Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
7bae7428
Commit
7bae7428
authored
10 years ago
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
privatize fields in ledger
parent
99db07c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
bitswap/ledger.go
bitswap/ledger.go
+14
-14
No files found.
bitswap/ledger.go
View file @
7bae7428
...
...
@@ -16,17 +16,17 @@ type Ledger struct {
// Accounting tracks bytes sent and recieved.
Accounting
debtRatio
//
F
irstExchnage is the time of the first data exchange.
F
irstExchange
time
.
Time
//
f
irstExchnage is the time of the first data exchange.
f
irstExchange
time
.
Time
//
L
astExchange is the time of the last data exchange.
L
astExchange
time
.
Time
//
l
astExchange is the time of the last data exchange.
l
astExchange
time
.
Time
//
N
umber of exchanges with this peer
E
xchangeCount
uint64
//
exchangeCount is the n
umber of exchanges with this peer
e
xchangeCount
uint64
//
W
antList is a (bounded, small) set of keys that Partner desires.
W
antList
KeySet
//
w
antList is a (bounded, small) set of keys that Partner desires.
w
antList
KeySet
Strategy
StrategyFunc
}
...
...
@@ -39,23 +39,23 @@ func (l *Ledger) ShouldSend() bool {
}
func
(
l
*
Ledger
)
SentBytes
(
n
int
)
{
l
.
E
xchangeCount
++
l
.
L
astExchange
=
time
.
Now
()
l
.
e
xchangeCount
++
l
.
l
astExchange
=
time
.
Now
()
l
.
Accounting
.
BytesSent
+=
uint64
(
n
)
}
func
(
l
*
Ledger
)
ReceivedBytes
(
n
int
)
{
l
.
E
xchangeCount
++
l
.
L
astExchange
=
time
.
Now
()
l
.
e
xchangeCount
++
l
.
l
astExchange
=
time
.
Now
()
l
.
Accounting
.
BytesRecv
+=
uint64
(
n
)
}
// TODO: this needs to be different. We need timeouts.
func
(
l
*
Ledger
)
Wants
(
k
u
.
Key
)
{
l
.
W
antList
[
k
]
=
struct
{}{}
l
.
w
antList
[
k
]
=
struct
{}{}
}
func
(
l
*
Ledger
)
WantListContains
(
k
u
.
Key
)
bool
{
_
,
ok
:=
l
.
W
antList
[
k
]
_
,
ok
:=
l
.
w
antList
[
k
]
return
ok
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment