change core.IpfsNode as first arg
check keylookup err to propagate validation errors from lower levels
License: MIT
Signed-off-by: Kerem Gocen <keremgocen@gmail.com>
Updated the `TestBitswapLedger*` tests and added assertions to check concrete
values for ledgers (rather than just checking that two peers' ledgers match).
The names for these tests were also changed from the previous commit, according
to 's/BytesSent/Ledger/'.
License: MIT
Signed-off-by: David Grisham <dgrisham@mines.edu>
Tests were added to ensure that the bug fix in commit 000fbd25 was correct.
The tests caught an error where a peer's ledger was not properly locked when
updating it in the `MessageSent()` function. The appropriate calls to lock the
ledger were made, and the tests successfully passed.
License: MIT
Signed-off-by: David Grisham <dgrisham@mines.edu>
When sending data to another user, the number of bytes sent to that user (saved
by the corresponding Bitswap ledger) was not updated (it was always 0). This
also meant that the debt ratio was also always 0.
The function that updates the `BytesSent` value in the ledger, `MessageSent()`,
was already implemented, however it was not called when the peer was sent data.
To fix this, a call to `MessageSent()` was made in the `taskWorker()` function,
which is where both the message in question and the Bitswap engine were
available to make the call. `MessageSent()` requires the peer's ID and
`BitSwapMessage` as its arguments, the latter of which had to be created by
making a new `BitSwapMessage`, then the block being sent was added to the new
message.
Note that, similar to the analagous call to `MessageReceived()`, records *all*
of the bytes sent to a particular user. At some point, both of these should be
updated to only record the numbers of *useful* bytes sent and received between
peers.
License: MIT
Signed-off-by: David Grisham <dgrisham@mines.edu>
Instead of resolving a node, we resolve a path. This resolved path
is then re-used for Cat and Ls. This way, a resolve operation is
only done once.
The error messages for a failed resolve is changed from `ipfs cat …`
to `ipfs resolve …` to better reflect the API calls. The test is
updated accordingly.
License: MIT
Signed-off-by: Remco Bloemen <remco@2π.com>
* Always use the fully resolved CID from api.ResolveNode
as the ETag (also for IPNS).
* Format the result as a valid "Strong Validator"
(double quotes around the encoded CID).
Fixes#3868
License: MIT
Signed-off-by: Remco Bloemen <remco@2π.com>