Commit Graph

50 Commits

Author SHA1 Message Date
Jeremiah Andrews cb08d28d40 Reverse iterators (#224)
with passing tests
2018-06-24 19:37:32 -07:00
Jae Kwon 21726a6853 Add ColoredBytes() and update DebugDB 2018-06-13 23:45:44 -07:00
Ethan Buchman f27c358a8a revert protobuf recompile 2018-05-21 17:37:53 -04:00
Ethan Buchman 468be0f8d6 mv remotedb, proto, grpcdb all under db/remotedb 2018-05-14 15:49:00 -04:00
Jae Kwon e328006bfe
Jae/fixprefixdb (#199)
* Fix PrefixDB Iterator
* PrefixDB Iterator/ReverseIterator fixes
* Bump version 0.8.2
* Update CHANGELOG.md about DebugDB
* Keep invalid source to be closed
* Use prefixBatch instead of memBatch
2018-04-21 04:25:45 -07:00
Thomas Corbière ee67e34519 Fix lint errors (#190)
* use increment and decrement operators.

* remove unnecessary else branches.

* fix receiver names.

* remove omittable code.

* fix dot imports.
2018-04-03 12:23:28 +02:00
Jae Kwon b0e0dc5de3
Implement DebugDB (#166) 2018-03-18 01:52:28 +01:00
Jae Kwon d289c9286e
Implement NewPrefixDB (#164)
* encodeByteSlice uses uvarint for length instead of varint
* Implemented NewPrefixDB
* Fix flowrate test (#165)
* Complete implementation and fix tests
* Add tests for MemBatch Write[Sync]
2018-03-15 09:43:23 -07:00
Ethan Buchman 1b5176003a DbBackend -> DBBackend 2018-02-02 22:31:17 -05:00
Adrian Brink cbc63518e5
Export DbBackendType in order to fix IAVL tests 2018-02-02 18:50:24 +01:00
Anton Kaliaev 9ccfe161ad
lowercase memDB type key 2018-02-02 14:08:05 +04:00
Jae Kwon f6dbe9ba05
Refactor string -> dbBackendType 2018-02-02 14:08:05 +04:00
Ethan Buchman 7fe3d5dac2 metalinter 2018-01-02 10:48:36 -05:00
Jae Kwon b31397aff5 Fix GoLevelDB Iterator which needs to copy a temp []byte 2017-12-28 18:30:56 -08:00
Jae Kwon ca56a274bd Nil bytes are OK for Get/Set etc
And s/Release/Close/g
2017-12-19 20:36:37 -08:00
Jae Kwon 4ce8448d7f
Nil keys are OK, deprecate BeginningKey/EndingKey (#101)
* Nil keys are OK, deprecate BeginningKey/EndingKey
2017-12-17 13:11:28 -08:00
Ethan Buchman 66b0e8fa2d fix c level db iterator 2017-12-15 15:58:23 -05:00
Emmanuel Odeke a7b20d4e46
db: Simplify exists check, fix IsKeyInDomain signature, Iterator Close
+ *FSDB.HasKey now uses common.FileExists to test for file existence
+ IsKeyInDomain takes key as a []byte slice instead of as a string
to avoid extraneous []byte<-->string conversions for start and end
+ Iterator.Close() instead of Iterator.Release()
+ withDB helper to encapsulate DB creation, deferred cleanups
so that for loops can use opened DBs and discard them ASAP

Addressing accepted changes from review with @jaekwon
2017-12-15 02:58:51 -07:00
Ethan Buchman a2f7898b6d db: fix c and go iterators 2017-12-13 22:28:37 -05:00
Ethan Buchman d4aeca8ce3 fixes from @melekes 2017-12-13 20:11:11 -05:00
Ethan Buchman 318982c0ba checkKeyCondition -> IsKeyInDomain 2017-12-13 01:34:00 -05:00
Jae Kwon 5636a02d03 Remove GetError() from Iterator 2017-12-12 19:19:26 -08:00
Ethan Buchman edf07760d6 db: fsdb iterator 2017-12-12 21:08:38 -05:00
Ethan Buchman bcacaf164b db: cleveldb iterator 2017-12-12 20:58:35 -05:00
Ethan Buchman 3e5dbef6a2 db: goleveldb iterator 2017-12-12 20:38:03 -05:00
Ethan Buchman 39e40ff5ce db: memdb iterator 2017-12-12 20:06:50 -05:00
Ethan Buchman bb115d4d61 cleanupDBDir 2017-12-12 19:28:52 -05:00
Ethan Buchman ba8c5045b5 db: fixes to fsdb and clevledb 2017-12-12 19:22:08 -05:00
Ethan Buchman c547caf04f db: some test cleanup 2017-12-12 19:08:22 -05:00
Ethan Buchman 5b7f90dfb2 db: test panic on nil key 2017-12-12 18:42:47 -05:00
Ethan Buchman 781f6c5d22 db: some comments in types.go 2017-12-12 18:04:05 -05:00
Jae Kwon 7f650cea86 Remove Prev from Iterator 2017-12-12 14:45:31 -08:00
Jae Kwon 0d03cd9e31 Make it compile 2017-12-12 14:00:03 -08:00
Jae Kwon 50a30aafc1 New canonical Iterator 2017-12-12 12:44:47 -08:00
Jae Kwon 17dc8a7449 SetDeleter/Batch separation 2017-12-03 21:44:48 -08:00
Jae Kwon 56e51bc113 CacheWrap() -> CacheDB() CacheDB 2017-11-11 17:37:30 -05:00
Jae Kwon 8481c49c82
CacheDB (#67)
* Add CacheDB & SimpleMap
* Generic memBatch; Fix cLevelDB tests
* CacheWrap() for CacheDB and MemDB
* Change Iterator to match LeviGo Iterator
* Fixes from review
* cacheWrapWriteMutex and some race fixes
* Use tmlibs/common
* NewCWWMutex is exposed.  DB can be CacheWrap'd
* Remove GetOK, not needed
* Fsdb (#72)
* Add FSDB
* Review fixes from Anton
* Review changes
* Fixes from review
2017-11-09 17:42:32 -05:00
Anton Kaliaev 0b22b27bbb
avoid infinite recursion by proxying to iterator
```
WARNING: staticcheck, gosimple and unused are all set, using megacheck instead
db/go_level_db.go:126:15⚠️ infinite recursive call (SA5007) (megacheck)
db/go_level_db.go:135:17⚠️ infinite recursive call (SA5007) (megacheck)
db/mem_db.go:106:2⚠️ redundant return statement (S1023) (megacheck)
```

https://circleci.com/gh/tendermint/tmlibs/220

Also remove unnecessary return statement
2017-10-17 11:01:46 +04:00
Anton Kaliaev cd2ad19db4 Merge pull request #57 from tendermint/feature/improve-db-interface
WIP: Improve db interface
2017-10-13 18:31:05 +04:00
Alexis Sellier 6b1e3bcee3 Add comments about copying 2017-10-13 13:03:43 +02:00
Ethan Buchman 7dd6b3d3f8 Merge pull request #53 from tendermint/metalinter
add metalinter to CI and address some lint warnings
2017-10-04 00:21:24 -04:00
Alexis Sellier e9e6ec3a2c Implement Key/Value on Iterator for GoLevelDB
This is needed because leveldb reuses the keys on each iteration.
In our wrapper, we copy the key/value so that it is safe to store.
2017-09-28 17:43:47 +02:00
Alexis Sellier 219d4e8427 Add IteratorPrefix method to Iterator 2017-09-28 17:35:01 +02:00
Alexis Sellier 296d223545 Add Release & Error methods to Iterator
We need this to properly support LevelDB backend, which needs
to be released if we don't want to leak memory.
2017-09-28 17:26:24 +02:00
Emmanuel Odeke 8be8127351
db: fix MemDB.Close
Fixes https://github.com/tendermint/tmlibs/issues/55

MemDB previously mistakenly set the actual DB pointer to nil
although that side effect is not visible to the outside world
since p is an identifier within the scope of just that function
call. However, @melekes and I had a discussion in which we
came to the conclusion that Close for an in-memory DB should
instead be a noop and not cause any data loss. See the
discussion on https://github.com/tendermint/tmlibs/pull/56.
2017-09-26 15:29:51 -06:00
Zach Ramsay 3c57c24921 linting: next round of fixes 2017-09-22 12:14:27 -04:00
Ethan Buchman 8f1dea89f5 db: fix memdb iterator 2017-08-25 16:35:37 -04:00
Ethan Buchman 2f8551d3b6 go-common -> tmlibs 2017-04-18 17:56:05 -04:00
Ethan Buchman 900be74e8f update import paths 2017-04-18 16:33:51 -04:00
Ethan Buchman fdbb10827d merge go-db 2017-04-18 16:33:35 -04:00