Skip to content

Commit

Permalink
Update IAVL dependency for v0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
UnitylChaos committed Aug 15, 2018
1 parent 97ea51a commit b0b3e86
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
12 changes: 6 additions & 6 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

[[override]]
name = "github.com/tendermint/iavl"
version = "=v0.9.2"
version = "=v0.10.0"

[[override]]
name = "github.com/tendermint/tendermint"
Expand Down
16 changes: 8 additions & 8 deletions store/iavlstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const (

// load the iavl store
func LoadIAVLStore(db dbm.DB, id CommitID, pruning sdk.PruningStrategy) (CommitStore, error) {
tree := iavl.NewVersionedTree(db, defaultIAVLCacheSize)
tree := iavl.NewMutableTree(db, defaultIAVLCacheSize)
_, err := tree.LoadVersion(id.Version)
if err != nil {
return nil, err
Expand All @@ -40,7 +40,7 @@ var _ Queryable = (*iavlStore)(nil)
type iavlStore struct {

// The underlying tree.
tree *iavl.VersionedTree
tree *iavl.MutableTree

// How many old versions we hold onto.
// A value of 0 means keep no recent states.
Expand All @@ -56,7 +56,7 @@ type iavlStore struct {
}

// CONTRACT: tree should be fully loaded.
func newIAVLStore(tree *iavl.VersionedTree, numRecent int64, storeEvery int64) *iavlStore {
func newIAVLStore(tree *iavl.MutableTree, numRecent int64, storeEvery int64) *iavlStore {
st := &iavlStore{
tree: tree,
numRecent: numRecent,
Expand Down Expand Up @@ -167,16 +167,16 @@ func (st *iavlStore) Gas(meter GasMeter, config GasConfig) KVStore {

// Implements KVStore.
func (st *iavlStore) Iterator(start, end []byte) Iterator {
return newIAVLIterator(st.tree.Tree(), start, end, true)
return newIAVLIterator(st.tree.ImmutableTree, start, end, true)
}

// Implements KVStore.
func (st *iavlStore) ReverseIterator(start, end []byte) Iterator {
return newIAVLIterator(st.tree.Tree(), start, end, false)
return newIAVLIterator(st.tree.ImmutableTree, start, end, false)
}

// Handle gatest the latest height, if height is 0
func getHeight(tree *iavl.VersionedTree, req abci.RequestQuery) int64 {
func getHeight(tree *iavl.MutableTree, req abci.RequestQuery) int64 {
height := req.Height
if height == 0 {
latest := tree.Version64()
Expand Down Expand Up @@ -255,7 +255,7 @@ func (st *iavlStore) Query(req abci.RequestQuery) (res abci.ResponseQuery) {
// Implements Iterator.
type iavlIterator struct {
// Underlying store
tree *iavl.Tree
tree *iavl.ImmutableTree

// Domain
start, end []byte
Expand Down Expand Up @@ -286,7 +286,7 @@ var _ Iterator = (*iavlIterator)(nil)
// newIAVLIterator will create a new iavlIterator.
// CONTRACT: Caller must release the iavlIterator, as each one creates a new
// goroutine.
func newIAVLIterator(tree *iavl.Tree, start, end []byte, ascending bool) *iavlIterator {
func newIAVLIterator(tree *iavl.ImmutableTree, start, end []byte, ascending bool) *iavlIterator {
iter := &iavlIterator{
tree: tree,
start: cp(start),
Expand Down
12 changes: 6 additions & 6 deletions store/iavlstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ var (
)

// make a tree and save it
func newTree(t *testing.T, db dbm.DB) (*iavl.VersionedTree, CommitID) {
tree := iavl.NewVersionedTree(db, cacheSize)
func newTree(t *testing.T, db dbm.DB) (*iavl.MutableTree, CommitID) {
tree := iavl.NewMutableTree(db, cacheSize)
for k, v := range treeData {
tree.Set([]byte(k), []byte(v))
}
Expand Down Expand Up @@ -322,7 +322,7 @@ type pruneState struct {

func testPruning(t *testing.T, numRecent int64, storeEvery int64, states []pruneState) {
db := dbm.NewMemDB()
tree := iavl.NewVersionedTree(db, cacheSize)
tree := iavl.NewMutableTree(db, cacheSize)
iavlStore := newIAVLStore(tree, numRecent, storeEvery)
for step, state := range states {
for _, ver := range state.stored {
Expand All @@ -341,7 +341,7 @@ func testPruning(t *testing.T, numRecent int64, storeEvery int64, states []prune

func TestIAVLNoPrune(t *testing.T) {
db := dbm.NewMemDB()
tree := iavl.NewVersionedTree(db, cacheSize)
tree := iavl.NewMutableTree(db, cacheSize)
iavlStore := newIAVLStore(tree, numRecent, int64(1))
nextVersion(iavlStore)
for i := 1; i < 100; i++ {
Expand All @@ -356,7 +356,7 @@ func TestIAVLNoPrune(t *testing.T) {

func TestIAVLPruneEverything(t *testing.T) {
db := dbm.NewMemDB()
tree := iavl.NewVersionedTree(db, cacheSize)
tree := iavl.NewMutableTree(db, cacheSize)
iavlStore := newIAVLStore(tree, int64(0), int64(0))
nextVersion(iavlStore)
for i := 1; i < 100; i++ {
Expand All @@ -374,7 +374,7 @@ func TestIAVLPruneEverything(t *testing.T) {

func TestIAVLStoreQuery(t *testing.T) {
db := dbm.NewMemDB()
tree := iavl.NewVersionedTree(db, cacheSize)
tree := iavl.NewMutableTree(db, cacheSize)
iavlStore := newIAVLStore(tree, numRecent, storeEvery)

k1, v1 := []byte("key1"), []byte("val1")
Expand Down
2 changes: 1 addition & 1 deletion store/prefixstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func testPrefixStore(t *testing.T, baseStore KVStore, prefix []byte) {

func TestIAVLStorePrefix(t *testing.T) {
db := dbm.NewMemDB()
tree := iavl.NewVersionedTree(db, cacheSize)
tree := iavl.NewMutableTree(db, cacheSize)
iavlStore := newIAVLStore(tree, numRecent, storeEvery)

testPrefixStore(t, iavlStore, []byte("test"))
Expand Down

0 comments on commit b0b3e86

Please sign in to comment.