Commit Graph

27 Commits

Author SHA1 Message Date
Jacek Sieka 17eb247702
expose memtable flush (#72)
* expose memtable flush

This can be used to avoid log replays on startup, for example

* Add flush to RocksDbReadWriteRef.

* Remove atomic flush default.

---------

Co-authored-by: bhartnett <51288821+bhartnett@users.noreply.github.com>
2024-10-29 08:14:36 +08:00
web3-developer 608d10a24e
Use nph v0.6.0 in nimble format and run format on project. (#66) 2024-07-22 21:05:02 +08:00
web3-developer 92df0b067f
Add support for snapshots. (#64)
* Add support for snapshots.
2024-07-10 13:15:40 +08:00
web3-developer cf1267e845
Add support for optimistic transaction db, write batch with index, keyMayExist and empty keys. (#63)
* Add support for optimistic transaction db.

* Add keyMayExist to RocksDbRef.

* Add support for write batch with index.

* Allow empty keys to be used in API.
2024-07-08 22:18:30 +08:00
web3-developer 6b7de5730b
Implement missing getter and setters for option types. (#62)
* Update readme.

* Add additional opts getters and setters for ReadOptionsRef and WriteOptionsRef. Updated BackupEngineOptionsRef to use newer c library type.

* Add majority of option type getter and setters.
2024-07-03 23:46:42 +08:00
web3-developer d31b8b8a72
Build dynamic libraries for all platforms using vcpkg. (#61)
* Build dynamic libraries for all platforms using vcpkg.

* Cleanup CI.
2024-07-03 11:34:40 +08:00
web3-developer 01ced36404
Fix segfault in filterpolicy close (#60)
* Fix seq fault caused by double free. Now using API correctly.

* Add tests to cover autoClose.
2024-07-02 12:44:05 +08:00
web3-developer caedba0b3f
Implement autoclose on missed types. (#59)
* Implement autoclose on missed types.

* Cleanup using templates and add more tests.
2024-06-28 23:57:34 +08:00
web3-developer 03313d8068
Auto close feature to improve memory management of option types. (#57)
* Revert some changes from prior PR https://github.com/status-im/nim-rocksdb/pull/48 which enable memory leak of options when not cleaned up manually.

* Clean up, add more tests and use correct free function for listColumnFamilies.

* Close opt types when opening database fails.

* Add autoClose flag to each opt type.

* Finish autoClose changes to prevent memory leaks.
2024-06-28 10:04:37 +08:00
web3-developer ee15ce027b
Update API to support passing in ColFamilyHandleRef instead of column family string. (#52)
* Refactor API to pass in column family handle instead of string.

* Check for unknown column family in getColFamilyHandle and update tests.

* Update column family function names. Remove redundant exists check.
2024-06-27 01:31:39 +08:00
web3-developer a691d5b9d2
Format using nph (#54)
* Format entire project using nph.

* Add nph lint to CI.
2024-06-26 23:00:10 +08:00
Jacek Sieka d648b10e2c
options: reclassify (#51)
Several options were mistakenly classified as db options when in fact
they are column family options - the C interface does not make this
distinction and instead puts them all under one umbrella.

This PR updates options to use nim setter/getter properties allowing
both read and write of most options - lots of options are exposed both
for reading and writing, but hey, one could always add _even more_ of
them - there's certainly no lack!
2024-06-19 08:39:15 +02:00
Jacek Sieka 2879227085
expose additional configuration options (#43)
* caches
* table options
* spelling fixes
2024-06-04 12:06:14 +02:00
web3-developer fc2ba4a836
Update open procs to support adding the default column family if it is missing from the columnFamilies list. (#39) 2024-03-07 09:02:24 +08:00
web3-developer 5f6282e8d4
Rocksdb rewrite integration (#38)
* Column families support (#34)

* Update library to support column families. If not specified, uses the 'default' column family.

* Added tests for column family changes.

* Update library version and readme.

* Updated the librocksdb c library to the latest stable version.

* Started rewrite of library.

* Commit library rewrite progress.

* Completed initial rewrite and refactored tests.

* Completed implementation of backup engine.

* Added tests for new types.

* Completed tests for existing features.

* Remove features not supported by older versions of RocksDB to fix CI (temporary fix).

* Remove flush before backup support from BackupEngine to fix CI.

* Transactions support (#36)

* Update library to support column families. If not specified, uses the 'default' column family.

* Added tests for column family changes.

* Update library version and readme.

* Updated the librocksdb c library to the latest stable version.

* Started rewrite of library.

* Commit library rewrite progress.

* Completed initial rewrite and refactored tests.

* Completed implementation of backup engine.

* Added tests for new types.

* Completed tests for existing features.

* Remove features not supported by older versions of RocksDB to fix CI (temporary fix).

* Remove flush before backup support from BackupEngine to fix CI.

* Implemented RocksDB iterator.

* Implemented pairs iterator.

* Completed implementation of WriteBatch with tests.

* Fix example code.

* Completed implementation of TransactionDb.

* Support setting default column family.

* Remove unneeded usage of var for ref type parameters.

* Completed transactiondb tests.

* Improve and refactor rocksdb test.

* Added support for ingesting sst files using the SstFileWriter. (#37)

* Create ColFamilyReadOnly and ColFamilyReadWrite types for using a specific column family.

* Use inline pragma for small procs and add lock to RocksDbRef type close to prevent double free.

* Added documentation for the public API.

* Initial implementation of sst filewriter.

* Added tests for sstfilewriter.

* Documentation minor improvements.
2024-03-05 11:12:37 +08:00
Adam Spitz 724b72fe10
Made del return a bool, and added clear. (#33)
* Made del return a bool, and added clear.

What I've done here feels very awkward. Maybe I'm missing something,
but it looks to me like RocksDB doesn't support these operations in
any natural way.

These changes were made in order to get our implementation of
KvStoreRef for RocksDB working again after these changes to the
KvStoreRef interface:

8f0ae55353

I don't really recommend merging this; I think I'd prefer to just stop
trying to use this common KvStoreRef interface.

Still, if we do want to keep the common interface, I think this commit
will work well enough.

* Updated the tests to expect del to return a bool too.

* Leave the new `clear` operation unimplemented.
2023-01-17 11:37:10 -05:00
Jacek Sieka e528ee949a
get with callback (#22)
* get with callback

avoids seq copy sometimes

* comment on defect exception safety
2020-04-23 20:55:21 +02:00
Jacek Sieka 8da2f11951
nim 1.2, port to results (#21) 2020-04-18 00:18:04 +02:00
Ștefan Talpalaru 0860aee591 tests refactoring
- added "--threads:on"
- fixed the Nim API tests and moved them to unittest
- added copyright header
- combined the 2 test file into tests/all.nim and set that as the
  Nimble test target
- had Travis run that
- new "tempfile" dependency to create proper tempfiles + deleting them
  at the end
- copied the error string to RocksDBResult
2019-01-20 11:45:52 +02:00
Jacek Sieka cfb1059f34
compile fixes for second test (why didn't nimble test catch these?) 2018-08-15 20:16:57 -06:00
Jacek Sieka 0f6b9ffe8f
disable optimization that requires snappy
this causes early test failures when rocksdb is compiled without it
2018-08-15 20:08:03 -06:00
Jacek Sieka 4b73bca449
fix error parameter type and memory leak
* error is a pointer to a cstring that the API will allocate on error
* if an error is returned, it must be free'd
* note missing tests for when error happens
2018-08-15 19:56:18 -06:00
Yuriy Glukhov ca28e4e3cf Test fixup 2018-07-30 12:25:27 +03:00
Yuriy Glukhov 840d470eb9 Fixed pkg struct (#5) 2018-07-04 14:09:03 +02:00
Zahary Karadjov 419b97e132 Add a basic higher-level API
The API is still very basic and suffering from multiple Nim issues
that will be resolved in the near future:

* destructors will handle the resource cleanup better
* converter concepts will enable a wider range of possible types
  to be used as keys and values.

The API currently uses an ErrorResult type to communicate errors,
but RocksDB doesn't seem to have many recoverable failure modes
and I anticipate that the API will be migrated to use exceptions
once we get a bit more experience with RocksDB.

The C interface file was moved to a separate directory to make
nimble happy (`nimble check`).
2018-06-25 15:59:23 +03:00
Mamy Ratsimbazafy eb2bd02c5a
Fix Travis Continuous Integration + adapt to non null-terminated C string (#1) 2018-02-05 22:19:33 +01:00
mratsim 01077e71a0 Add test suite 2018-02-04 00:55:41 +01:00