Skip to content

Commit

Permalink
Improve code readability by adding comments, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
fxamacker committed May 14, 2024
1 parent 81b6dcd commit 88fa22f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -1037,17 +1037,19 @@ func (s *PersistentSlabStorage) NondeterministicFastCommit(numWorkers int) error
modifiedSlabCount := 0
// Deleted slabs need to be removed from underlying storage.
deletedSlabCount := 0
for k, v := range s.deltas {
for id, slab := range s.deltas {
// Ignore slabs not owned by accounts
if k.address == AddressUndefined {
if id.address == AddressUndefined {
continue
}
if v == nil {
if slab == nil {
// Set deleted slab ID from the end of slabIDsWithOwner.
index := len(slabIDsWithOwner) - 1 - deletedSlabCount
slabIDsWithOwner[index] = k
slabIDsWithOwner[index] = id
deletedSlabCount++
} else {
slabIDsWithOwner[modifiedSlabCount] = k
// Set modified slab ID from the start of slabIDsWithOwner.
slabIDsWithOwner[modifiedSlabCount] = id
modifiedSlabCount++
}
}
Expand Down

0 comments on commit 88fa22f

Please sign in to comment.