1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 19:44:01 +08:00

chekc that size input to newHamtShard is a power of two

License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
This commit is contained in:
Jeromy
2016-11-22 12:31:10 -08:00
committed by Jeromy
parent 8d4791c9bb
commit 62bb7c966d
4 changed files with 59 additions and 20 deletions

View File

@ -85,7 +85,12 @@ func (d *Directory) AddChild(ctx context.Context, name string, nd node.Node) err
}
func (d *Directory) switchToSharding(ctx context.Context) error {
d.shard = hamt.NewHamtShard(d.dserv, DefaultShardWidth)
s, err := hamt.NewHamtShard(d.dserv, DefaultShardWidth)
if err != nil {
return err
}
d.shard = s
for _, lnk := range d.dirnode.Links() {
cnd, err := d.dserv.Get(ctx, lnk.Cid)
if err != nil {