This repository has been 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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bmt: Introduce SectionWriter, implement hash.Hash in bmt (#2021)
- Loading branch information
Showing
9 changed files
with
388 additions
and
140 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,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 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
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 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.