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

Add builder for unixfs dags #12

Merged
merged 20 commits into from
Oct 18, 2021
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
better name
  • Loading branch information
willscott committed Oct 13, 2021
commit ee45835f1076aa21d3f47da7a111c9cb1ad64caf
8 changes: 4 additions & 4 deletions data/builder/dirshard.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ func BuildUnixFSShardedDirectory(size int, hasher uint64, entries []dagpb.PBLink
if err != nil {
return nil, err
}
he := make([]hamtLink, 0, len(entries))
hamtEntries := make([]hamtLink, 0, len(entries))
for _, e := range entries {
name := e.Name.Must().String()
sum := h.Sum([]byte(name))
he = append(he, hamtLink{
hamtEntries = append(hamtEntries, hamtLink{
sum,
e,
})
Expand All @@ -60,8 +60,8 @@ func BuildUnixFSShardedDirectory(size int, hasher uint64, entries []dagpb.PBLink
children: make(map[int]entry),
}

for _, e := range he {
sharder.add(e)
for _, entry := range hamtEntries {
sharder.add(entry)
}

return sharder.serialize(ls)
Expand Down