rocksdb #29
|
@ -37,11 +37,7 @@ func PrepareResolveResult(
|
|||
return nil, err
|
||||
}
|
||||
|
||||
var txCounts []interface{}
|
||||
txCounts = db.TxCounts.GetSlice()
|
||||
txCounts = txCounts[:db.TxCounts.Len()]
|
||||
height := BisectRight(txCounts, txNum)
|
||||
createdHeight := BisectRight(txCounts, rootTxNum)
|
||||
height, createdHeight := db.TxCounts.TxCountsBisectRight(txNum, rootTxNum, BisectRight)
|
||||
lastTakeoverHeight := controllingClaim.Height
|
||||
|
||||
expirationHeight := GetExpirationHeight(height)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
package db_stack
|
||||
|
||||
import "sync"
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
import (
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
"sync"
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
)
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
|
||||
type SliceBackedStack struct {
|
||||
slice []interface{}
|
||||
|
@ -77,3 +79,18 @@ func (s *SliceBackedStack) GetSlice() []interface{} {
|
|||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
// This is not thread safe so I won't bother with locking
|
||||
return s.slice
|
||||
}
|
||||
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
// This function is dangerous because it assumes underlying types
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
func (s *SliceBackedStack) TxCountsBisectRight(
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
txNum, rootTxNum uint32,
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
bisectFunc func([]interface{}, uint32) uint32,
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
) (uint32, uint32) {
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
s.mut.RLock()
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
defer s.mut.RUnlock()
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
txCounts := s.slice[:s.Len()]
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
height := bisectFunc(txCounts, txNum)
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
createdHeight := bisectFunc(txCounts, rootTxNum)
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
return height, createdHeight
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
}
|
||||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
||||
|
|
|||
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
every call of this uses the same bisect function. does it make sense to pass it in? every call of this uses the same bisect function. does it make sense to pass it in?
agreed, changed. agreed, changed.
this is already a subpackage of this is already a subpackage of `db`. it should be called `stack`, not `db_stack`
assuming this package is named assuming this package is named `stack`, this should just be `SliceBacked`. no need to put stack in the name again
|
every call of this uses the same bisect function. does it make sense to pass it in?