-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not send first blocks extension (#230)
* feat(responseassembler): add response skipping * feat(responsemanager): process do not send first blocks define extension and add processing to response manager * test(impl): add integration test add test demonstrating do not send first blocks flow * Update donotsendfirstblocks/donotsendfirstblocks.go Co-authored-by: Will <[email protected]> * Update impl/graphsync_test.go Co-authored-by: Will <[email protected]> Co-authored-by: Will <[email protected]>
- Loading branch information
1 parent
ce3951d
commit 57df640
Showing
10 changed files
with
246 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package donotsendfirstblocks | ||
|
||
import ( | ||
basicnode "github.com/ipld/go-ipld-prime/node/basic" | ||
|
||
"github.com/ipfs/go-graphsync/ipldutil" | ||
) | ||
|
||
// EncodeDoNotSendFirstBlocks returns encoded cbor data for the given number | ||
// of blocks to skip | ||
func EncodeDoNotSendFirstBlocks(skipBlockCount int64) ([]byte, error) { | ||
nd := basicnode.NewInt(skipBlockCount) | ||
return ipldutil.EncodeNode(nd) | ||
} | ||
|
||
// DecodeDoNotSendFirstBlocks returns the number of blocks to skip | ||
func DecodeDoNotSendFirstBlocks(data []byte) (int64, error) { | ||
nd, err := ipldutil.DecodeNode(data) | ||
if err != nil { | ||
return 0, err | ||
} | ||
return nd.AsInt() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.