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

feat: do not read size of blocks for want-have requests #672

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

gammazero
Copy link
Contributor

@gammazero gammazero commented Sep 13, 2024

When the replace-have-with-want-blocks is disabled, the block sizes for blocks corresponding to have-want requests are not read and instead the blockstore is checked only to see if the block is present.

The replace-have-with-want-blocks feature can be disabled using the new WithReplaceHasWithBlockMaxSize(n) option which can be used with bitswap.New. It sets the maximum size of a block in bytes up to which we will replace a want-have with a want-block. Setting a size of 0 disables want-have replacement and means that block sizes are not read for want-have requests.

This is a prototype fix for issue #657

Copy link

codecov bot commented Sep 13, 2024

Codecov Report

Attention: Patch coverage is 74.19355% with 24 lines in your changes missing coverage. Please review.

Project coverage is 60.13%. Comparing base (171b0b7) to head (ff77293).

Files with missing lines Patch % Lines
...swap/server/internal/decision/blockstoremanager.go 64.51% 8 Missing and 3 partials ⚠️
bitswap/server/server.go 0.00% 7 Missing ⚠️
bitswap/server/internal/decision/engine.go 92.45% 3 Missing and 1 partial ⚠️
bitswap/options.go 0.00% 2 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #672      +/-   ##
==========================================
- Coverage   60.18%   60.13%   -0.06%     
==========================================
  Files         241      241              
  Lines       30707    30772      +65     
==========================================
+ Hits        18482    18504      +22     
- Misses      10574    10608      +34     
- Partials     1651     1660       +9     
Files with missing lines Coverage Δ
bitswap/options.go 36.36% <0.00%> (-1.74%) ⬇️
bitswap/server/internal/decision/engine.go 91.45% <92.45%> (-0.33%) ⬇️
bitswap/server/server.go 63.35% <0.00%> (-1.29%) ⬇️
...swap/server/internal/decision/blockstoremanager.go 85.33% <64.51%> (-5.43%) ⬇️

... and 12 files with indirect coverage changes

@gammazero
Copy link
Contributor Author

See configuration in kubo: ipfs/kubo#10512

@gammazero gammazero changed the title feat: no not read size of blocks for want-have requests feat: do not read size of blocks for want-have requests Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant