diff --git a/Gopkg.lock b/Gopkg.lock index de244c162c5d..4a33fffa961a 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -376,7 +376,7 @@ [[projects]] branch = "master" - digest = "1:b3cfb8d82b1601a846417c3f31c03a7961862cb2c98dcf0959c473843e6d9a2b" + digest = "1:f2ffd421680b0a3f7887501b3c6974bcf19217ecd301d0e2c9b681940ec363d5" name = "github.com/syndtr/goleveldb" packages = [ "leveldb", @@ -393,7 +393,7 @@ "leveldb/util", ] pruneopts = "UT" - revision = "c4c61651e9e37fa117f53c5a906d3b63090d8445" + revision = "ae2bd5eed72d46b28834ec3f60db3a3ebedd8dbd" [[projects]] branch = "master" @@ -416,12 +416,12 @@ version = "0.10.1" [[projects]] - digest = "1:d4a15d404afbf591e8be16fcda7f5ac87948d5c7531f9d909fd84cc730ab16e2" + digest = "1:e99ef92d64f2391efbbfb15310df635f96247532bbac2676ea43e466d706401d" name = "github.com/tendermint/iavl" packages = ["."] pruneopts = "UT" - revision = "35f66e53d9b01e83b30de68b931f54b2477a94c9" - version = "v0.9.2" + revision = "e5726c0066ccdd299a2ec9262f93c7896cdfcd87" + version = "v0.10.0" [[projects]] digest = "1:26146cdb2811ce481e72138439b9b1aa17a64d54364f96bb92f97a9ef8ba4f01" @@ -572,7 +572,7 @@ [[projects]] branch = "master" - digest = "1:077c1c599507b3b3e9156d17d36e1e61928ee9b53a5b420f10f28ebd4a0b275c" + digest = "1:601e63e7d4577f907118bec825902505291918859d223bce015539e79f1160e3" name = "google.golang.org/genproto" packages = ["googleapis/rpc/status"] pruneopts = "UT" diff --git a/Gopkg.toml b/Gopkg.toml index 0651fe1f5f5f..c01dfe094167 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -53,7 +53,7 @@ [[override]] name = "github.com/tendermint/iavl" - version = "=v0.9.2" + version = "=v0.10.0" [[override]] name = "github.com/tendermint/tendermint" diff --git a/store/iavlstore.go b/store/iavlstore.go index 6ab50dfc960d..656bbd3d258a 100644 --- a/store/iavlstore.go +++ b/store/iavlstore.go @@ -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 @@ -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. @@ -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, @@ -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() @@ -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 @@ -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), diff --git a/store/iavlstore_test.go b/store/iavlstore_test.go index d081b4576fde..3f6adb47fd87 100644 --- a/store/iavlstore_test.go +++ b/store/iavlstore_test.go @@ -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)) } @@ -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 { @@ -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++ { @@ -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++ { @@ -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") diff --git a/store/prefixstore_test.go b/store/prefixstore_test.go index ff37b27d4719..49bc68037a72 100644 --- a/store/prefixstore_test.go +++ b/store/prefixstore_test.go @@ -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"))