Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: import go-bitswap #6

Closed
wants to merge 1,203 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1203 commits
Select commit Hold shift + click to select a range
b642182
refactor: avoid unnecessary go-routine
dirkmc Mar 6, 2020
776393d
fix: races in tests
dirkmc Mar 6, 2020
8abc859
Merge pull request ipfs/go-bitswap#279 from ipfs/fix/races
Stebalien Mar 6, 2020
243f479
fix: overly aggressive session peer removal
dirkmc Mar 5, 2020
c52daf6
Disable flaky benchmark
dirkmc Mar 5, 2020
7fd48bf
fix: block receive shouldn't affect DONT_HAVE count for other peers
dirkmc Mar 6, 2020
c688ba7
refactor: avoid unnecessary go-routine
dirkmc Mar 6, 2020
d3c4e8b
Merge branch 'fix/prune-dont-have' of https://github.com/ipfs/go-bits…
dirkmc Mar 6, 2020
3ef1918
fix: flaky test
dirkmc Mar 6, 2020
d167027
test: fix another flaky test
dirkmc Mar 6, 2020
d806628
fix: flaky test
dirkmc Mar 6, 2020
6adf990
Merge pull request ipfs/go-bitswap#276 from ipfs/fix/prune-dont-have
Stebalien Mar 6, 2020
f6538f4
feat: timeout when peer doesnt respond to want-block
dirkmc Mar 10, 2020
e774269
docs: fix find peers log level
dirkmc Mar 10, 2020
4ffaa40
fix: flaky provider query manager (#286)
dirkmc Mar 10, 2020
b2333dd
fix: flaky engine peer tagging test (#287)
dirkmc Mar 10, 2020
b5ed0eb
Merge pull request ipfs/go-bitswap#284 from ipfs/feat/dont-have-new-p…
Stebalien Mar 10, 2020
e572f87
fix: re-export testinstance/testnet
Stebalien Mar 11, 2020
18bfacd
Merge pull request ipfs/go-bitswap#289 from ipfs/fix/re-export-testing
Stebalien Mar 11, 2020
6d63e5c
fix: flaky TestDontHaveTimeoutMgrTimeout
dirkmc Mar 11, 2020
49475c9
Merge pull request ipfs/go-bitswap#293 from ipfs/fix/flaky-test-TestD…
Stebalien Mar 11, 2020
675f7d6
fix: order of session broadcast wants
dirkmc Mar 11, 2020
dee6ecb
refactor: improve sessionWants perf
dirkmc Mar 12, 2020
f752040
fix: flaky TestRateLimitingRequests
dirkmc Mar 12, 2020
b8f528a
Merge pull request ipfs/go-bitswap#296 from ipfs/fix/test-TestRateLim…
Stebalien Mar 12, 2020
e82ff75
fix: engine test TestTaggingUseful (#297)
dirkmc Mar 12, 2020
196698f
Merge pull request ipfs/go-bitswap#291 from ipfs/fix/session-broadcas…
Stebalien Mar 12, 2020
1953a51
refactor: clean up logs
dirkmc Mar 13, 2020
daa60b1
refactor: adjust log levels
dirkmc Mar 16, 2020
1a0d621
Merge pull request ipfs/go-bitswap#299 from ipfs/refactor/log-cleanup
Stebalien Mar 16, 2020
5b22e71
feat: expose the full wantlist through GetWantlist
Stebalien Mar 14, 2020
71a4256
Merge pull request ipfs/go-bitswap#300 from ipfs/feat/full-wantlist
Stebalien Mar 16, 2020
b04d12d
feat: remove the context from the donthavetimeoutmanager (#303)
Stebalien Mar 17, 2020
99cb8fa
fix: 64bit align stats (#305)
Stebalien Mar 17, 2020
1fd7bd7
feat: micro-optimize priority (#304)
Stebalien Mar 17, 2020
91bfa84
feat: add a custom CID type
Stebalien Mar 18, 2020
ab2f012
Merge pull request ipfs/go-bitswap#308 from ipfs/feat/custom-cid-type
Stebalien Mar 19, 2020
8de88f9
test(message): test custom CID type (#309)
Stebalien Mar 19, 2020
3d61280
perf: add message queue benchmark
dirkmc Mar 18, 2020
9e2ddc9
perf: improve extractOutgoingMessage() performance
dirkmc Mar 18, 2020
ae45ed2
fix: race in tests
dirkmc Mar 19, 2020
79064fb
refactor: reuse message queue message for perf
dirkmc Mar 19, 2020
1a4cd05
fix: virtual net race
dirkmc Mar 19, 2020
9528702
refactor: small changes to message queue
dirkmc Mar 19, 2020
042da11
Merge pull request ipfs/go-bitswap#307 from ipfs/perf/message-queue
Stebalien Mar 19, 2020
9b7a4e0
fix: wait for sessionWantSender to shutdown before completing session…
dirkmc Mar 24, 2020
d44df4d
fix: flaky TestDontHaveTimeoutMgrTimeout (#320)
dirkmc Mar 24, 2020
7bc480c
fix: flaky TestSendDontHave (#321)
dirkmc Mar 24, 2020
eba8407
fix: flaky TestSendsWantBlockToOnePeerOnly (#323)
dirkmc Mar 24, 2020
d49bbd2
refactor: simplify sessionWantSender shutdown
dirkmc Mar 24, 2020
22154ff
refactor: use internal context in sessionWantSender
dirkmc Mar 24, 2020
69f785f
Merge pull request ipfs/go-bitswap#317 from ipfs/fix/sesswantmgr-shut…
Stebalien Mar 24, 2020
d3b72b4
chore: make pwm internals private (#315)
Stebalien Mar 24, 2020
06ec901
fix: log unexpected condition in peerWantManager.prepareSendWants()
dirkmc Mar 24, 2020
592fd81
Merge pull request ipfs/go-bitswap#325 from ipfs/fix/pmgr-log
Stebalien Mar 24, 2020
cc36c77
fix: race in SessionInterestManager (#324)
dirkmc Mar 24, 2020
ad5127a
chore: address todo in engine.go
Stebalien Mar 26, 2020
780ca21
fix: avoid copying messages multiple times on send
Stebalien Mar 26, 2020
df9c14b
feat: normalize message logging
Stebalien Mar 26, 2020
8c5a342
Merge pull request ipfs/go-bitswap#326 from ipfs/feat/faster-send-blocks
Stebalien Mar 26, 2020
2703909
fix: ensure wantlist gauge gets decremented on disconnect
dirkmc Apr 3, 2020
ca7a6c3
Merge pull request ipfs/go-bitswap#332 from ipfs/fix/wantlist-gauge
Stebalien Apr 3, 2020
9f84f93
Add separate how bitswap works doc (#294)
dirkmc Apr 7, 2020
da9aad9
fix: path to architecture diagram (#338)
dirkmc Apr 7, 2020
4345843
fix: start score worker along with other engine workers (#344)
Stebalien Apr 10, 2020
fd8891b
fix: in message queue only send cancel if want was sent
dirkmc Apr 10, 2020
73134b7
Merge pull request ipfs/go-bitswap#345 from ipfs/fix/cancel-leak
Stebalien Apr 11, 2020
3bee022
feat: prioritize more important wants
Stebalien Apr 11, 2020
808731b
Merge pull request ipfs/go-bitswap#346 from ipfs/feat/prioritize-wants
Stebalien Apr 11, 2020
22cca92
fix: avoid allocating cids (#348)
Stebalien Apr 13, 2020
51301c0
refactor: simplify messageQueue onSent
dirkmc Apr 13, 2020
b5f3c4f
refactor: save some vars
dirkmc Apr 13, 2020
9e6faf7
refactor: remove unnecessary func param
dirkmc Apr 13, 2020
c7d4c48
fix: only mark sent wants as sent
dirkmc Apr 13, 2020
4d48e5a
Merge pull request ipfs/go-bitswap#349 from ipfs/refactor/simplify-mq…
Stebalien Apr 13, 2020
4fffefd
feat: optimize message sending (#350)
Stebalien Apr 14, 2020
f155add
refactor: move connection management into networking layer
dirkmc Apr 15, 2020
68141ca
fix: stop sender when message queue shut down
dirkmc Apr 15, 2020
b1a67f7
fix: tests
dirkmc Apr 15, 2020
253abb3
fix: don't hang on to disconnected peer refs
dirkmc Apr 16, 2020
4e3697f
fix: shutdown message queue when there's a send error
dirkmc Apr 16, 2020
9fe62d4
refactor: extract Connection Event Manager to own file and add tests
dirkmc Apr 16, 2020
2b61125
test: add more testing for ipfs_impl
dirkmc Apr 16, 2020
26155b5
feat: dont retry if connect error is multistream.ErrNotSupported
dirkmc Apr 17, 2020
0819d40
fix: copy opts in ipfs_impl
dirkmc Apr 17, 2020
3f521fe
fix: remove extraneous map writes in connectionEventManager
dirkmc Apr 17, 2020
486085f
fix: perf improvement for connectEventManager
dirkmc Apr 17, 2020
a67c55a
fix: simplify message queue shutdown
dirkmc Apr 17, 2020
5242e59
fix: avoid goroutine when receiving an error (#353)
Stebalien Apr 17, 2020
24a6ad8
fix: use explicit connected bool for streamMessageSender
dirkmc Apr 17, 2020
90dca27
fix: ipfs_impl error handling
dirkmc Apr 17, 2020
386f87d
fix: mark wants sent when they are added to a message to be sent
dirkmc Apr 17, 2020
df3881e
feat: optimize entry sorting in MessageQueue
dirkmc Apr 17, 2020
d938866
Merge pull request ipfs/go-bitswap#351 from ipfs/refactor/conn-mgmt
Stebalien Apr 18, 2020
a78c35f
Merge pull request ipfs/go-bitswap#356 from ipfs/feat/opt-mq-sort
Stebalien Apr 20, 2020
9fdb2ae
fix: minimize time holding wantlist lock (#361)
Stebalien Apr 21, 2020
53302ba
fix: ensure we shutdown the message queue asap (#362)
Stebalien Apr 21, 2020
b05e6c3
refactor: add reverse index to peerWantManager to speed up cancels (#…
dirkmc Apr 21, 2020
d0a7ee1
feat: move broadcast wantlist into the peermanager (#365)
Stebalien Apr 22, 2020
0928737
fix: avoid calling ctx.SetDeadline() every time we send a message
dirkmc Apr 22, 2020
f7f0ba8
Merge pull request ipfs/go-bitswap#369 from ipfs/fix/over-allocated-ctx
Stebalien Apr 22, 2020
76385ac
fix: change timing for DONT_HAVE timeouts to be more conservative
dirkmc Apr 22, 2020
e9a7c1d
Merge pull request ipfs/go-bitswap#371 from ipfs/fix/dont-have-timing
Stebalien Apr 23, 2020
c696091
refactor: remove unused code
dirkmc Apr 23, 2020
1f23c17
Merge pull request ipfs/go-bitswap#373 from ipfs/refactor/unref-old-code
Stebalien Apr 23, 2020
23ccc16
refactor: remove WantManager
dirkmc Apr 23, 2020
d7ee8c3
fix: race in session test
dirkmc Apr 23, 2020
6257c9b
fix: send CANCELs when session context is cancelled
dirkmc Apr 23, 2020
36e5795
Merge pull request ipfs/go-bitswap#375 from ipfs/refactor/sess-ctx-ca…
Stebalien Apr 23, 2020
1c5a65d
Merge pull request ipfs/go-bitswap#374 from ipfs/refactor/unref-want-mgr
Stebalien Apr 23, 2020
95b79de
Add standard issue template
hsanjuan Apr 27, 2020
2b03ff9
feat: calculate message latency
dirkmc Apr 29, 2020
0f81d00
fix: simplify latency timing
dirkmc Apr 30, 2020
9fa9dfe
fix: only record latency for first response per want
dirkmc Apr 30, 2020
41ccd67
fix: discard outliers in latency calculation
dirkmc Apr 30, 2020
5a00b20
docs: MessageQueue docs
dirkmc May 1, 2020
5f93e56
fix: use one less go-routine per session (#377)
dirkmc May 1, 2020
ce5ee2e
test: fix flaky test TestSessionBetweenPeers
dirkmc May 1, 2020
18d7db1
Merge pull request ipfs/go-bitswap#386 from ipfs/feat/msg-latency
Stebalien May 2, 2020
2ffeb67
fix: return wants from engine.WantlistForPeer()
dirkmc May 7, 2020
244fcc5
Merge pull request ipfs/go-bitswap#390 from ipfs/fix/engine-wantlist
Stebalien May 7, 2020
3120b78
perf: improve peer manager performance
dirkmc May 19, 2020
ffbf588
perf: improve cancel wants perf
dirkmc May 20, 2020
6d118d2
feat: simplify broadcast cancel logic (#399)
Stebalien May 21, 2020
9b97f98
Merge pull request ipfs/go-bitswap#395 from ipfs/perf/peer-want-mgr
Stebalien May 21, 2020
d64c0a8
Total wants gauge (#402)
dirkmc Jun 2, 2020
ace323a
fix: ensure sessions register with PeerManager
dirkmc Jun 3, 2020
4d280c3
Merge pull request ipfs/go-bitswap#405 from ipfs/fix/register-session
Stebalien Jun 3, 2020
362527a
feat: protect connection for session peers that are first to send block
dirkmc Jun 3, 2020
64fd392
fix: ensure conns are unprotected on shutdown
dirkmc Jun 3, 2020
2a401dc
fix: race in tests
dirkmc Jun 3, 2020
46e2489
fix: ensure unique tag for session connection protection
dirkmc Jun 3, 2020
33bbd95
Merge pull request ipfs/go-bitswap#406 from ipfs/feat/protect-conns
Stebalien Jun 3, 2020
799b44d
fix: only track useful received data in the ledger (#411)
Stebalien Jun 8, 2020
0fed64c
fix: avoid taking accessing the peerQueues without taking the lock
Stebalien Jun 10, 2020
c63616f
fix: want gauge calculation
dirkmc Jun 10, 2020
353e693
fix: PeerManager signalAvailabiity() race
dirkmc Jun 10, 2020
902d40c
refactor: simplify PeerWantManager pending want counts
dirkmc Jun 10, 2020
c0688e3
fix: log error for unexpected reverse index mismatch
dirkmc Jun 10, 2020
353b687
Merge pull request ipfs/go-bitswap#417 from ipfs/fix/peermgr-race
Stebalien Jun 10, 2020
f5eb75f
Merge pull request ipfs/go-bitswap#416 from ipfs/fix/want-gauge
Stebalien Jun 10, 2020
9895f62
fix: don't say we're sending a full wantlist unless we are (#429)
Stebalien Aug 19, 2020
a82ecc5
Added `WithScoreLedger` Bitswap option (#430)
wolneykien Sep 3, 2020
3312463
refactor: remove extraneous ledger field init (#437)
dirkmc Sep 3, 2020
2873fb0
Fix: Increment stats.MessagesSent in msgToStream() function (#441)
wolneykien Sep 10, 2020
d02d3d1
Add WireTap interface (#444)
tzdybal Sep 24, 2020
7a51725
fix: guard access to the mock wiretap with a lock
Stebalien Nov 10, 2020
cac9c96
Merge pull request ipfs/go-bitswap#446 from ipfs/fix/wt-race
Stebalien Nov 10, 2020
f8a7ad6
fix: update to go 1.15 lint warnings
Stebalien Sep 2, 2020
07d6183
feat: update for go-libp2p-core 0.7.0 interface changes
Stebalien Oct 27, 2020
69ebfd7
Merge pull request ipfs/go-bitswap#445 from ipfs/feat/rw-close
Stebalien Nov 12, 2020
7b035ef
fix: remove unnecessary (and leaked) ticker
Stebalien Nov 13, 2020
fffc8a9
fix: set the score ledger on start
Stebalien Nov 13, 2020
bfae0a1
Merge pull request ipfs/go-bitswap#447 from ipfs/fix/panic-and-leak
Stebalien Nov 13, 2020
f3ceb05
feat: configurable engine blockstore worker count (#449)
dirkmc Nov 18, 2020
1072e22
fix a startup race by creating the blockstoremanager process on init
Stebalien Feb 26, 2021
fa7d8c4
Merge pull request ipfs/go-bitswap#465 from ipfs/fix/startup-race
Stebalien Feb 26, 2021
4e9c468
ignore transient connections
vyzo Apr 1, 2021
b2be805
Merge pull request ipfs/go-bitswap#470 from ipfs/fix/transient-conns
vyzo Apr 1, 2021
d80f2da
fix staticcheck
Apr 15, 2021
4e6b944
Merge pull request ipfs/go-bitswap#474 from coryschwartz/feat/fix-sta…
Stebalien Apr 21, 2021
fa1acb3
fix(network): impl: add timeout in newStreamToPeer call
schomatis Apr 22, 2021
6845d78
Merge pull request ipfs/go-bitswap#477 from ipfs/schomatis/impl/newSt…
Stebalien Apr 23, 2021
2bc6262
fix: fix alignment of stats struct in virtual network
Stebalien Apr 30, 2021
7505ee6
Merge pull request ipfs/go-bitswap#478 from ipfs/fix/alignment
Stebalien Apr 30, 2021
deeb528
test: deflake large-message test
Stebalien Apr 30, 2021
f0ab615
test: deflake donthave timeout test
Stebalien Apr 30, 2021
46a5bc0
Merge pull request ipfs/go-bitswap#479 from ipfs/fix/deflake-large-me…
Stebalien Apr 30, 2021
b41b1a8
test: deflake engine test
Stebalien Apr 30, 2021
9f04984
Merge pull request ipfs/go-bitswap#480 from ipfs/fix/deflake-tag-test
Stebalien Apr 30, 2021
2002754
run gofmt -s
web3-bot Jun 13, 2021
182655d
Merge pull request ipfs/go-bitswap#485 from ipfs/web3-bot/sync
Stebalien Jun 24, 2021
9cc220e
fix(decision): fix test flakiness through mock clock (#494)
hannahhoward Jun 4, 2021
6a1faf1
fix(network): fix TestNetworkCounters
hannahhoward Jun 3, 2021
cda7896
fix(bitswap): add send don't have timeout option
hannahhoward Jun 2, 2021
21dba94
refactor(bitswap): rename simulateDontHaves option
hannahhoward Jun 3, 2021
e31ef76
fix(messagequeue): fix flaky TestDontHaveMgr tests
hannahhoward Jun 3, 2021
01a421b
refactor(messagequeue): rename ambigous channel
hannahhoward Jun 5, 2021
8c0f33f
Merge pull request ipfs/go-bitswap#495 from ipfs/fix/fix-dont-have-ma…
Stebalien Jun 24, 2021
0cfedf7
fix(messagequeue): fix flaky MessageQueue tests
hannahhoward Jun 5, 2021
311faa9
fix: Nil dereference while using SetSendDontHaves
Jorropo May 30, 2021
548cba7
docs: better engineSetSendDontHaves description
Jorropo Jun 16, 2021
85e13bf
Merge pull request ipfs/go-bitswap#497 from ipfs/fix/message-queue-tests
Stebalien Jun 24, 2021
0d51592
fix: hold the task worker lock when starting task workers
Stebalien Jun 24, 2021
137e485
Merge pull request ipfs/go-bitswap#488 from Jorropo/fix/nildereferanc…
Stebalien Jun 24, 2021
c0a7b99
Merge pull request ipfs/go-bitswap#504 from ipfs/fix/task-worker-coun…
Stebalien Jun 24, 2021
5c71e7f
remove unused haves parameter on Engine.ReceiveFrom
marten-seemann May 12, 2021
c6ad619
introduce a ledger that stores which peers are waiting for a Cid
marten-seemann May 12, 2021
72240da
chore: go fmt
Stebalien Jun 24, 2021
693642f
fix: cleanup ledger on mismatch
Stebalien Jun 24, 2021
724d44e
Merge pull request ipfs/go-bitswap#486 from ipfs/optimize-receive-from
Stebalien Jun 24, 2021
2702914
chore: update deps
Stebalien May 12, 2021
f7d9a01
Merge pull request ipfs/go-bitswap#484 from ipfs/chore/update-libp2p
Stebalien Jun 24, 2021
25a56be
fix(decision): fix a datarace on disconnect
Stebalien Jun 24, 2021
45a938b
Merge pull request ipfs/go-bitswap#508 from ipfs/fix/disconnect-data-…
Stebalien Jun 24, 2021
9c86eac
fix: make blockstore cancel test less timing dependent
Stebalien Jun 24, 2021
b44e910
Merge pull request ipfs/go-bitswap#507 from ipfs/test/blockstore-test…
Stebalien Jun 24, 2021
11687bc
fix: fix a map access race condition in the want index
Stebalien Jul 30, 2021
719129a
Merge pull request ipfs/go-bitswap#523 from ipfs/fix/race
Stebalien Jul 30, 2021
72cce0c
More stats, knobs and tunings (#514)
petar Aug 18, 2021
783f5e1
fix: reduce log verbosity
Stebalien Aug 31, 2021
f5ff53e
fix: fix race on "responsive" check
Stebalien Sep 2, 2021
0a126fb
feat: cache the materialized wantlist
Stebalien Sep 7, 2021
5b8bd84
Merge pull request ipfs/go-bitswap#528 from ipfs/fix/responsive-check…
Stebalien Sep 15, 2021
aa6d37f
fix: rename wiretap to tracer
Stebalien Sep 15, 2021
9204ce7
Merge pull request ipfs/go-bitswap#531 from ipfs/chore/rename-wiretap
Stebalien Sep 15, 2021
64ea7b2
test(providerquerymanager): fix timings
hannahhoward Oct 8, 2021
94e34de
enable custom task prioritization logic
synzhu Oct 12, 2021
394c169
add peer to TaskInfo
synzhu Oct 12, 2021
ab1e64b
move task comparator wrapper to separate function
synzhu Oct 12, 2021
0f5bcd9
fix undeclared name error
synzhu Oct 13, 2021
4e1cacd
Merge pull request ipfs/go-bitswap#534 from ipfs/fix/flaky-test-rate-…
Stebalien Oct 14, 2021
d9e440a
fix: reduce receive contention
Stebalien Oct 21, 2021
e4d4c11
Merge pull request ipfs/go-bitswap#536 from ipfs/fix/receive-contention
Stebalien Oct 26, 2021
d5a3b5a
test: make sure the cache is cleared when changing the wantlist
Stebalien Oct 26, 2021
502b36a
Merge pull request ipfs/go-bitswap#530 from ipfs/feat/cache-wantlist
Stebalien Oct 26, 2021
1e7e480
Add TaskComparator test
synzhu Oct 27, 2021
112e3d4
Add type aliases for TaskInfo and TaskComparator
synzhu Oct 27, 2021
8dd844f
Merge pull request ipfs/go-bitswap#535 from smnzhu/master
Stebalien Oct 28, 2021
406a86d
fix: optimize handling for peers with lots of tasks
Stebalien Oct 26, 2021
044aac5
Merge pull request ipfs/go-bitswap#537 from ipfs/feat/optimize-has-ne…
Stebalien Oct 28, 2021
e18b97c
feat: plumb through contexts (#539)
guseggert Nov 10, 2021
430ca56
Change incorrect function name in README (#541)
susarlanikhilesh Nov 17, 2021
11a5cc0
configurable target message size
whyrusleeping Dec 14, 2021
cdbf0a7
Merge pull request ipfs/go-bitswap#546 from ipfs/feat/allow-config-me…
Stebalien Dec 14, 2021
050b783
feat: add peer block filter option (#549)
laurentsenta Mar 17, 2022
aeeac06
Use ipld.ErrNotFound
hsanjuan Apr 7, 2020
aa68610
fix initialisation example in README (#552)
marten-seemann Apr 22, 2022
817239b
feat: coalesce and queue connection event handling (#565)
Stebalien Jun 13, 2022
2fa11e5
feat: add basic tracing (#562)
guseggert Jun 14, 2022
dbc09b8
Remove dependency on travis package from go-libp2p-testing
MarcoPolo Jul 1, 2022
9adafe6
Merge pull request ipfs/go-bitswap#569 from ipfs/marco/rm-travis-dep
MarcoPolo Jul 5, 2022
7c7f1a8
chore: Update .github/workflows/stale.yml [skip ci]
web-flow Jul 21, 2022
3ccffd3
feat: don't add blocks to the datastore
MichaelMure Jul 8, 2022
a9ef4b5
chore: bump deps & cleanup dont add
Jorropo Jul 28, 2022
1d7300b
Merge pull request ipfs/go-bitswap#571 from MichaelMure/no-block-add
Jorropo Jul 28, 2022
dea23a1
chore: remove goprocess from blockstoremanager
guseggert Aug 5, 2022
d15b5f1
refactor: split client and server and all sideeffects that this incurs
Jorropo Jun 20, 2022
0406bfb
refactor: remove the need of generics
Jorropo Aug 5, 2022
9fe61ba
test: remove TestTracer
Jorropo Aug 6, 2022
d334702
refactor: remove metrics object and other review changes
Jorropo Aug 11, 2022
a4c5b71
fix: plumb through ctor contexts to preserve metrics scopes
guseggert Aug 13, 2022
da8f90c
fix: message queue test races on Windows
guseggert Aug 13, 2022
11dc5a6
Merge pull request ipfs/go-bitswap#570 from Jorropo/split
guseggert Aug 13, 2022
1c02252
chore: update go-libp2p v0.22.0
Jorropo Aug 29, 2022
1417d8b
chore: fix incorrect log message when a bad option is passed
Jorropo Sep 8, 2022
38d044c
fix: incorrect type in the WithTracer polyfill option
Jorropo Sep 8, 2022
a72a7f4
fix: create a copy of the protocol slice in network.processSettings
Jorropo Sep 13, 2022
90e7746
Merge commits from ipfs/go-bitswap/master
guseggert Dec 2, 2022
d42c44b
chore: import go-bitswap
guseggert Dec 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions bitswap/.github/ISSUE_TEMPLATE/open_an_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Open an issue
about: Only for actionable issues relevant to this repository.
title: ''
labels: need/triage
assignees: ''

---
<!--
Hello! To ensure this issue is correctly addressed as soon as possible by the IPFS team, please try to make sure:

- This issue is relevant to this repository's topic or codebase.

- A clear description is provided. It should includes as much relevant information as possible and clear scope for the issue to be actionable.

FOR GENERAL DISCUSSION, HELP OR QUESTIONS, please see the options at https://ipfs.io/help or head directly to https://discuss.ipfs.io.

(you can delete this section after reading)
-->
148 changes: 148 additions & 0 deletions bitswap/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
go-bitswap
==================

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
[![Matrix](https://img.shields.io/badge/matrix-%23ipfs%3Amatrix.org-blue.svg?style=flat-square)](https://matrix.to/#/#ipfs:matrix.org)
[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![Discord](https://img.shields.io/discord/475789330380488707?color=blueviolet&label=discord&style=flat-square)](https://discord.gg/24fmuwR)
[![Coverage Status](https://codecov.io/gh/ipfs/go-bitswap/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-bitswap/branch/master)
[![Build Status](https://circleci.com/gh/ipfs/go-bitswap.svg?style=svg)](https://circleci.com/gh/ipfs/go-bitswap)

> An implementation of the bitswap protocol in go!

## Lead Maintainer

[Dirk McCormick](https://github.com/dirkmc)

## Table of Contents

- [Background](#background)
- [Install](#install)
- [Usage](#usage)
- [Implementation](#implementation)
- [Contribute](#contribute)
- [License](#license)


## Background

Bitswap is the data trading module for ipfs. It manages requesting and sending
blocks to and from other peers in the network. Bitswap has two main jobs:
- to acquire blocks requested by the client from the network
- to judiciously send blocks in its possession to other peers who want them

Bitswap is a message based protocol, as opposed to request-response. All messages
contain wantlists or blocks.

A node sends a wantlist to tell peers which blocks it wants. When a node receives
a wantlist it should check which blocks it has from the wantlist, and consider
sending the matching blocks to the requestor.

When a node receives blocks that it asked for, the node should send out a
notification called a 'Cancel' to tell its peers that the node no longer
wants those blocks.

`go-bitswap` provides an implementation of the Bitswap protocol in go.

[Learn more about how Bitswap works](./docs/how-bitswap-works.md)

## Install

`go-bitswap` requires Go >= 1.11 and can be installed using Go modules

## Usage

### Initializing a Bitswap Exchange

```golang
import (
"context"
bitswap "github.com/ipfs/go-bitswap"
bsnet "github.com/ipfs/go-bitswap/network"
blockstore "github.com/ipfs/go-ipfs-blockstore"
"github.com/libp2p/go-libp2p-core/routing"
"github.com/libp2p/go-libp2p-core/host"
)

var ctx context.Context
var host host.Host
var router routing.ContentRouting
var bstore blockstore.Blockstore

network := bsnet.NewFromIpfsHost(host, router)
exchange := bitswap.New(ctx, network, bstore)
```

Parameter Notes:

1. `ctx` is just the parent context for all of Bitswap
2. `network` is a network abstraction provided to Bitswap on top of libp2p & content routing.
3. `bstore` is an IPFS blockstore

### Get A Block Synchronously

```golang
var c cid.Cid
var ctx context.Context
var exchange bitswap.Bitswap

block, err := exchange.GetBlock(ctx, c)
```

Parameter Notes:

1. `ctx` is the context for this request, which can be cancelled to cancel the request
2. `c` is the content ID of the block you're requesting

### Get Several Blocks Asynchronously

```golang
var cids []cid.Cid
var ctx context.Context
var exchange bitswap.Bitswap

blockChannel, err := exchange.GetBlocks(ctx, cids)
```

Parameter Notes:

1. `ctx` is the context for this request, which can be cancelled to cancel the request
2. `cids` is a slice of content IDs for the blocks you're requesting

### Get Related Blocks Faster With Sessions

In IPFS, content blocks are often connected to each other through a MerkleDAG. If you know ahead of time that block requests are related, Bitswap can make several optimizations internally in how it requests those blocks in order to get them faster. Bitswap provides a mechanism called a Bitswap Session to manage a series of block requests as part of a single higher level operation. You should initialize a Bitswap Session any time you intend to make a series of block requests that are related -- and whose responses are likely to come from the same peers.

```golang
var ctx context.Context
var cids []cids.cid
var exchange bitswap.Bitswap

session := exchange.NewSession(ctx)
blocksChannel, err := session.GetBlocks(ctx, cids)
// later
var relatedCids []cids.cid
relatedBlocksChannel, err := session.GetBlocks(ctx, relatedCids)
```

Note that `NewSession` returns an interface with `GetBlock` and `GetBlocks` methods that have the same signature as the overall Bitswap exchange.

### Tell bitswap a new block was added to the local datastore

```golang
var blk blocks.Block
var exchange bitswap.Bitswap

err := exchange.HasBlock(blk)
```

## Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.

## License

MIT © Juan Batiz-Benet
Loading