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 562f2fc commit 7b4efdb
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 @@ -986,17 +986,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 7b4efdb

Please sign in to comment.