Skip to content

Commit

Permalink
fix err msg (#1361)
Browse files Browse the repository at this point in the history
* fix err msg

* calc root hash once
  • Loading branch information
Hitenjain14 authored Jan 9, 2024
1 parent 553416a commit 8125003
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 9 deletions.
1 change: 0 additions & 1 deletion zboxcore/allocationchange/copyobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func (ch *CopyFileChange) ProcessChange(rootRef *fileref.Ref, fileIDMeta map[str
ch.processChildren(affectedRef, fileIDMeta)
dirRef.AddChild(ch.ObjectTree)

rootRef.CalculateHash()
return
}

Expand Down
1 change: 0 additions & 1 deletion zboxcore/allocationchange/createdir.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func (d *DirCreateChange) ProcessChange(rootRef *fileref.Ref, FileIDMeta map[str
}
}

rootRef.CalculateHash()
return
}

Expand Down
2 changes: 0 additions & 2 deletions zboxcore/allocationchange/deletefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func (ch *DeleteFileChange) ProcessChange(rootRef *fileref.Ref, _ map[string]str

if ch.ObjectTree.GetPath() == "/" {
rootRef.Children = nil
rootRef.CalculateHash()
return
}

Expand Down Expand Up @@ -48,7 +47,6 @@ func (ch *DeleteFileChange) ProcessChange(rootRef *fileref.Ref, _ map[string]str
for i, child := range dirRef.Children {
if child.GetName() == ch.ObjectTree.GetName() {
dirRef.RemoveChild(i)
rootRef.CalculateHash()
return
}
}
Expand Down
1 change: 0 additions & 1 deletion zboxcore/allocationchange/moveobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ func (ch *MoveFileChange) ProcessChange(rootRef *fileref.Ref, fileIDMeta map[str

dirRef.AddChild(ch.ObjectTree)

rootRef.CalculateHash()
return
}

Expand Down
1 change: 0 additions & 1 deletion zboxcore/allocationchange/newfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ func (ch *NewFileChange) ProcessChange(rootRef *fileref.Ref, fileIDMeta map[stri
fileIDMeta[ch.File.GetPath()] = ch.File.FileID

dirRef.AddChild(ch.File)
rootRef.CalculateHash()
return
}

Expand Down
1 change: 0 additions & 1 deletion zboxcore/allocationchange/renameobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func (ch *RenameFileChange) ProcessChange(rootRef *fileref.Ref, _ map[string]str
return
}
ch.processChildren(affectedRef)
rootRef.CalculateHash()
return
}

Expand Down
1 change: 0 additions & 1 deletion zboxcore/allocationchange/updatefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func (ch *UpdateFileChange) ProcessChange(rootRef *fileref.Ref, _ map[string]str
ch.NewFile.HashToBeComputed = true
ch.NewFile.FileID = ch.OldFile.FileID
dirRef.Children[idx] = ch.NewFile
rootRef.CalculateHash()
return
}

Expand Down
1 change: 1 addition & 0 deletions zboxcore/sdk/commitworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ func (commitreq *CommitRequest) processCommit() {
}
size += change.GetSize()
}
rootRef.CalculateHash()
err = commitreq.commitBlobber(rootRef, lR.LatestWM, size, fileIDMeta)
if err != nil {
commitreq.result = ErrorCommitResult(err.Error())
Expand Down
2 changes: 1 addition & 1 deletion zboxcore/sdk/downloadworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func (req *DownloadRequest) fillShards(shards [][][]byte, result *downloadBlock)
data = result.BlockChunks[i]
}
if i >= len(shards) || len(shards[i]) <= result.idx {
l.Logger.Error("Invalid shard index", result.idx, len(shards), len(shards[i]))
l.Logger.Error("Invalid shard index", result.idx, len(shards))
return errors.New("invalid_shard_index", fmt.Sprintf("Invalid shard index %d shard len: %d shard block len: %d", result.idx, len(shards), i))
}
shards[i][result.idx] = data
Expand Down

0 comments on commit 8125003

Please sign in to comment.