1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-01 10:49:24 +08:00

2736 Commits

Author SHA1 Message Date
acc714823b rename to peerRequestQueue
this opens up the possibility of having multiple queues. And for all
outgoing messages to be managed by the decision engine

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:45 -08:00
1d23e94f16 rm empty file
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:45 -08:00
5bd0b95462 rename to strategy.LedgerManager to decision.Engine
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:44 -08:00
bef622222d refactor: wantlist splits into WL and ThreadSafe WL
bitswap keeps the threadsafe version. observing the ledger shows that it
doesn't need it anymore (ledgermanager is protected and safe).

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:44 -08:00
d069ae11f4 refactor: put mutex next to the things it protects
If we put the lock next to the fields it protects, it can sometimes make
it easier to reason about threadsafety.

In this case, it reveals that the task queue (not threadsafe) isn't protected by the
mutex, yet shared between the worker and callers.

@whyrusleeping

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:44 -08:00
962a9477cc refactor: remove ledgerMap type
it's only used in two places, but i think we've been using maps on IPFS
types so much now that the specificity is no longer necessary

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:44 -08:00
39d71931a8 mv comment
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:44 -08:00
7fdbae1306 refactor: separate responsibilties
Before, priority carried two pieces of information.

One: priority as defined by remote peer
Two: whether task is trashed

This assumes the protocol is defined for natural numbers instead of
integers. That may not always be the case. Better to leave that
assumption outside so this package isn't coupled to the whims of the
protocol.

The protocol may be changed to allow any integer value to be used.
Hopefully by that time, new responsibilties weren't added to the
Priority variable.

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:44 -08:00
fedcebf67a refactor: re-use wantlist.Entry type wherever it makes sense
it seems to make sense since, in each place, the Key and Priority
represent the same information

b/c you know the saying...

"It is better to have 100 functions operate on one data structure than
10 functions on 10 data structures."

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:44 -08:00
1d715956f5 doc: add comment to Envelope
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:44 -08:00
e11f099c42 privatize Task
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:44 -08:00
181ff4eab1 tq.Cancel -> tq.Remove
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:43 -08:00
198aa1959a it's not a queue yet but it's okay to name it as such
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:43 -08:00
7280aac83f perf: avoid lots of communication by signaling once at end of method
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:43 -08:00
cc2a7312a2 add comment to fix race
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:43 -08:00
b41fef2fff refactor: remove peerKey type
we've been using maps with peers long enough now that this probably is
no longer necessary

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:43 -08:00
286723d888 unexport task and taskList
the less bitswap has to know about, the easier it'll be for readers.
(This now returns Messages.)

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:43 -08:00
93fde86d18 refactor: taskKey := p.Key() + block.Key()
for clarity and to avoid errors, define a function

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:43 -08:00
460967839e doc: comment
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:43 -08:00
10e970c0cf refactor: context first in argument list
(merely by convention)

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:43 -08:00
f66d94aaf1 fix: move the check into the function.
function should be a no-op when passed an empty slice

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:42 -08:00
8c05c444a5 refactor: avoid loop reuse
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:42 -08:00
2ea8ed81ac refactor: change Tasks to Outbox
notice that moving the blockstore fetch into the manager removes the
weird error handling case.

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:42 -08:00
a495a014af style constify variables
good to const until it's required for them to be variable.

TODO pass them in as configuration options
2014-12-17 23:44:42 -08:00
8bef1dce80 fix: move to callsite so public callers don't experience the internal timeout rule
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:42 -08:00
5603b2e0a4 style: line wrapping
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:42 -08:00
c0a18d9c08 fix(test): nil Blockstore
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:42 -08:00
69dd260236 refactor peerSet 2014-12-17 23:44:42 -08:00
f533678724 avoid attaching context to object when it's not necessary.
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:42 -08:00
f028c44fd2 name findOrCreate
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:41 -08:00
1bced710b1 queue-like naming
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:41 -08:00
29ef238fa3 remove dead code
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:41 -08:00
86c438b6e1 refactor() message API
performing CR in the form of a PR. Let me know what you think.

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:41 -08:00
6389bfda6b some cleanup before CR 2014-12-17 23:44:41 -08:00
2240272d85 change Provide RPC to not wait for an ACK, improves performance of 'Add' operations 2014-12-17 23:44:41 -08:00
90a30961de renaming and removing empty strategy file 2014-12-17 23:44:41 -08:00
029e305f19 tasklist queue for bitswap tasks 2014-12-17 23:44:41 -08:00
cfbe92bc8b rewrite sendWantlistToProviders 2014-12-17 23:44:40 -08:00
946d2a96f2 add locks to wantlist to avoid race condition 2014-12-17 23:44:40 -08:00
59f0ffb8c6 remove noisy statement
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:40 -08:00
da68475bcf fix go version
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-12-17 23:44:40 -08:00
50aa37fec4 blockstore.ErrNotFound, and proper wantlist sorting 2014-12-17 23:44:40 -08:00
e7bba82dcb add priorities to GetBlocks requests, and add waitgroup to sendWantListTo 2014-12-17 23:44:40 -08:00
3778eedff0 dont spawn so many goroutines when rebroadcasting wantlist 2014-12-17 23:44:40 -08:00
57e7dd7b8b extracted ledgerset from strategy, cleaned up a few comments from the PR 2014-12-17 23:44:40 -08:00
5b6a5e807f implement bitswap roundWorker
make vendor
2014-12-17 23:44:39 -08:00
12b296ee1a create wantlist object 2014-12-17 23:44:39 -08:00
c4a935c3e3 go complains about lack of buildable file 2014-12-17 23:44:39 -08:00
911b54e526 Merge pull request #443 from jbenet/ionet-conn
net-io
2014-12-17 23:32:35 -08:00
4da261001f mocknet printer for printing 2014-12-17 23:25:41 -08:00