Skip to content

Commit

Permalink
Fix method names
Browse files Browse the repository at this point in the history
  • Loading branch information
aalda committed Feb 25, 2019
1 parent 6a8838b commit 7916680
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
26 changes: 13 additions & 13 deletions balloon/hyper/insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,19 @@ func pruneToInsert(index []byte, value []byte, cacheHeightLimit uint16, batches
// at the end of a batch tree
if iBatch > 0 && pos.Height%4 == 0 {
traverse(pos, leaves, nil, 0, ops)
ops.Push(updatebatchNode(pos, iBatch, batch))
ops.Push(updateBatchNode(pos, iBatch, batch))
return
}

// on an internal node with more than one leaf

rightPos := pos.Right()
leftleaves, rightleaves := leaves.Split(rightPos.Index)
leftLeaves, rightLeaves := leaves.Split(rightPos.Index)

traverseThroughCache(pos.Left(), leftleaves, batch, 2*iBatch+1, ops)
traverseThroughCache(rightPos, rightleaves, batch, 2*iBatch+2, ops)
traverseThroughCache(pos.Left(), leftLeaves, batch, 2*iBatch+1, ops)
traverseThroughCache(rightPos, rightLeaves, batch, 2*iBatch+2, ops)

ops.PushAll(innerHash(pos), updatebatchNode(pos, iBatch, batch))
ops.PushAll(innerHash(pos), updateBatchNode(pos, iBatch, batch))
if iBatch == 0 { // it's the root of the batch tree
ops.Push(putInCache(pos, batch))
}
Expand Down Expand Up @@ -132,7 +132,7 @@ func pruneToInsert(index []byte, value []byte, cacheHeightLimit uint16, batches
leafHash(pos, leaves[0].Value),
updateBatchShortcut(pos, 0, newBatch, leaves[0].Index, leaves[0].Value),
mutateBatch(pos, newBatch),
updatebatchNode(pos, iBatch, batch),
updateBatchNode(pos, iBatch, batch),
)
return
}
Expand All @@ -142,13 +142,13 @@ func pruneToInsert(index []byte, value []byte, cacheHeightLimit uint16, batches
if len(leaves) > 1 {
// with more than one leaf to insert -> it's impossible to be a shortcut leaf
traverse(pos, leaves, nil, 0, ops)
ops.Push(updatebatchNode(pos, iBatch, batch))
ops.Push(updateBatchNode(pos, iBatch, batch))
return
}
// with only one leaf to insert -> continue traversing
if batch.HasElementAt(iBatch) {
traverse(pos, leaves, nil, 0, ops)
ops.Push(updatebatchNode(pos, iBatch, batch))
ops.Push(updateBatchNode(pos, iBatch, batch))
return
}
// nil value (no previous node stored) so create a new shortcut batch
Expand All @@ -157,7 +157,7 @@ func pruneToInsert(index []byte, value []byte, cacheHeightLimit uint16, batches
leafHash(pos, leaves[0].Value),
updateBatchShortcut(pos, 0, newBatch, leaves[0].Index, leaves[0].Value),
mutateBatch(pos, newBatch),
updatebatchNode(pos, iBatch, batch),
updateBatchNode(pos, iBatch, batch),
)
return
}
Expand Down Expand Up @@ -192,12 +192,12 @@ func pruneToInsert(index []byte, value []byte, cacheHeightLimit uint16, batches

// on an internal node with more than one leaf
rightPos := pos.Right()
leftleaves, rightleaves := leaves.Split(rightPos.Index)
leftLeaves, rightLeaves := leaves.Split(rightPos.Index)

traverseAfterCache(pos.Left(), leftleaves, batch, 2*iBatch+1, ops)
traverseAfterCache(rightPos, rightleaves, batch, 2*iBatch+2, ops)
traverseAfterCache(pos.Left(), leftLeaves, batch, 2*iBatch+1, ops)
traverseAfterCache(rightPos, rightLeaves, batch, 2*iBatch+2, ops)

ops.PushAll(innerHash(pos), updatebatchNode(pos, iBatch, batch))
ops.PushAll(innerHash(pos), updateBatchNode(pos, iBatch, batch))
if iBatch == 0 { // at root node -> mutate batch
ops.Push(mutateBatch(pos, batch))
}
Expand Down
2 changes: 1 addition & 1 deletion balloon/hyper/operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func innerHash(pos position) *operation {
}
}

func updatebatchNode(pos position, idx int8, batch *batchNode) *operation {
func updateBatchNode(pos position, idx int8, batch *batchNode) *operation {
return &operation{
Code: updateBatchNodeCode,
Pos: pos,
Expand Down
6 changes: 3 additions & 3 deletions balloon/hyper/rebuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func pruneToRebuild(index, serializedBatch []byte, cacheHeightLimit uint16, batc
// we don't need to check the length of the leaves because we
// always have to descend to the cache height limit
if pos.Height == cacheHeightLimit {
ops.PushAll(useHash(pos, persistedBatch.GetElementAt(0)), updatebatchNode(pos, iBatch, batch))
ops.PushAll(useHash(pos, persistedBatch.GetElementAt(0)), updateBatchNode(pos, iBatch, batch))
return
}

Expand All @@ -51,7 +51,7 @@ func pruneToRebuild(index, serializedBatch []byte, cacheHeightLimit uint16, batc
// at the end of a batch tree
if iBatch > 0 && pos.Height%4 == 0 {
traverse(pos, nil, 0, ops)
ops.Push(updatebatchNode(pos, iBatch, batch))
ops.Push(updateBatchNode(pos, iBatch, batch))
return
}

Expand All @@ -65,7 +65,7 @@ func pruneToRebuild(index, serializedBatch []byte, cacheHeightLimit uint16, batc
traverse(rightPos, batch, 2*iBatch+2, ops)
}

ops.PushAll(innerHash(pos), updatebatchNode(pos, iBatch, batch))
ops.PushAll(innerHash(pos), updateBatchNode(pos, iBatch, batch))
if iBatch == 0 { // it's the root of the batch tree
ops.Push(putInCache(pos, batch))
}
Expand Down

0 comments on commit 7916680

Please sign in to comment.