This repository was archived by the owner on Aug 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
bmt, param: Introduce SectionHasher interface, implement in bmt #2021
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
f47f9d0
bmt, param: Introduce SectionHasher interface, implement in bmt
nolash ee1ad2c
bmt: Cleanup
nolash 679b811
bmt, param: Improve comments
nolash 851cab0
Move writer interface til file
nolash 9f0f874
file: Move interface from param to file
nolash 7a6e8b2
bmt, file: Move asynchasher to file/hasher
nolash 57cf86d
bmt, file: Make AsyncHasher compile
nolash 859a48e
file, bmt: Add naive exports in bmt to provide for asynchasher move
nolash 8b59531
file: Add ctx and errFunc to async hasher constructor
nolash 1ada8d3
file: Enable sync hash.Hash usage through async hasher
nolash 0a3ec03
bmt: Merge Standalone asynchasher to bmt package for easier diff
nolash af6f1c9
bmt, file: Remove redundant SetLength method from interface
nolash 47b9667
bmt: Remove redundant return values in WriteIndexed
nolash adc45db
bmt: Add comments, use GetZeroHash in hasher.Sum
nolash 8221d1b
bmt: Fix races, remove sync hash run in async correctness test
nolash fda2831
bmt: Assign bmthash result in test for profiling w/o optimz
nolash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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,13 @@ | ||
| package bmt | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "testing" | ||
| ) | ||
|
|
||
| func BenchmarkBMTUsed(t *testing.B) { | ||
| size := 4096 | ||
| t.Run(fmt.Sprintf("%v_size_%v", "BMT", size), func(t *testing.B) { | ||
| benchmarkBMT(t, size) | ||
| }) | ||
| } |
This file contains hidden or 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 hidden or 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,16 @@ | ||
| package file | ||
|
|
||
| import ( | ||
| "context" | ||
| "hash" | ||
| ) | ||
|
|
||
| type SectionWriterFunc func(ctx context.Context) SectionWriter | ||
|
|
||
| type SectionWriter interface { | ||
| hash.Hash // Write,Sum,Reset,Size,BlockSize | ||
| SetWriter(hashFunc SectionWriterFunc) SectionWriter // chain another SectionWriter the current instance | ||
| SetSpan(length int) // set data span of chunk | ||
| SectionSize() int // section size of this SectionWriter | ||
| Branches() int // branch factor of this SectionWriter | ||
| } |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -151,7 +151,8 @@ func TestSha3ForCorrectness(t *testing.T) { | |
| rawSha3Output := rawSha3.Sum(nil) | ||
|
|
||
| sha3FromMakeFunc := MakeHashFunc(SHA3Hash)() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🌷 I know it's not part of this PR, but why not use constructor for Hasher instead of a func? If the func is needed maybe the builder can be extracted instead of this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pradovic The |
||
| sha3FromMakeFunc.ResetWithLength(input[:8]) | ||
| sha3FromMakeFunc.Reset() | ||
| sha3FromMakeFunc.SetSpanBytes(input[:8]) | ||
| sha3FromMakeFunc.Write(input[8:]) | ||
| sha3FromMakeFuncOutput := sha3FromMakeFunc.Sum(nil) | ||
|
|
||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why LittleEndian suddenly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't remember off the top of my head, but at least it's same as in
storage/types.go?