Mooore type safety
This commit is contained in:
parent
55e19b4521
commit
291621b828
|
@ -216,15 +216,15 @@ proc backup*(db: RocksDBInstance): RocksDBResult[void] =
|
||||||
# https://github.com/nim-lang/Nim/issues/8112
|
# https://github.com/nim-lang/Nim/issues/8112
|
||||||
# proc `=destroy`*(db: var RocksDBInstance) =
|
# proc `=destroy`*(db: var RocksDBInstance) =
|
||||||
proc close*(db: var RocksDBInstance) =
|
proc close*(db: var RocksDBInstance) =
|
||||||
if db.backupEngine != nil:
|
if not db.backupEngine.isNil:
|
||||||
rocksdb_backup_engine_close(db.backupEngine)
|
rocksdb_backup_engine_close(db.backupEngine)
|
||||||
db.backupEngine = nil
|
db.backupEngine = nil
|
||||||
|
|
||||||
if db.db != nil:
|
if not db.db.isNil:
|
||||||
rocksdb_close(db.db)
|
rocksdb_close(db.db)
|
||||||
db.db = nil
|
db.db = nil
|
||||||
|
|
||||||
if db.options != nil:
|
if not db.options.isNil:
|
||||||
rocksdb_options_destroy(db.options)
|
rocksdb_options_destroy(db.options)
|
||||||
db.options = nil
|
db.options = nil
|
||||||
|
|
||||||
|
|
|
@ -34,53 +34,56 @@ else:
|
||||||
const librocksdb = "librocksdb(|_lite).so"
|
const librocksdb = "librocksdb(|_lite).so"
|
||||||
## Exported types
|
## Exported types
|
||||||
|
|
||||||
type
|
template rocksType(T) =
|
||||||
rocksdb_t* = ptr object
|
type T* = distinct pointer
|
||||||
rocksdb_backup_engine_t* = ptr object
|
proc isNil*(v: T): bool {.borrow.}
|
||||||
rocksdb_backup_engine_info_t* = ptr object
|
|
||||||
rocksdb_restore_options_t* = ptr object
|
rocksType rocksdb_t
|
||||||
rocksdb_cache_t* = ptr object
|
rocksType rocksdb_backup_engine_t
|
||||||
rocksdb_compactionfilter_t* = ptr object
|
rocksType rocksdb_backup_engine_info_t
|
||||||
rocksdb_compactionfiltercontext_t* = ptr object
|
rocksType rocksdb_restore_options_t
|
||||||
rocksdb_compactionfilterfactory_t* = ptr object
|
rocksType rocksdb_cache_t
|
||||||
rocksdb_comparator_t* = ptr object
|
rocksType rocksdb_compactionfilter_t
|
||||||
rocksdb_dbpath_t* = ptr object
|
rocksType rocksdb_compactionfiltercontext_t
|
||||||
rocksdb_env_t* = ptr object
|
rocksType rocksdb_compactionfilterfactory_t
|
||||||
rocksdb_fifo_compaction_options_t* = ptr object
|
rocksType rocksdb_comparator_t
|
||||||
rocksdb_filelock_t* = ptr object
|
rocksType rocksdb_dbpath_t
|
||||||
rocksdb_filterpolicy_t* = ptr object
|
rocksType rocksdb_env_t
|
||||||
rocksdb_flushoptions_t* = ptr object
|
rocksType rocksdb_fifo_compaction_options_t
|
||||||
rocksdb_iterator_t* = ptr object
|
rocksType rocksdb_filelock_t
|
||||||
rocksdb_logger_t* = ptr object
|
rocksType rocksdb_filterpolicy_t
|
||||||
rocksdb_mergeoperator_t* = ptr object
|
rocksType rocksdb_flushoptions_t
|
||||||
rocksdb_options_t* = ptr object
|
rocksType rocksdb_iterator_t
|
||||||
rocksdb_compactoptions_t* = ptr object
|
rocksType rocksdb_logger_t
|
||||||
rocksdb_block_based_table_options_t* = ptr object
|
rocksType rocksdb_mergeoperator_t
|
||||||
rocksdb_cuckoo_table_options_t* = ptr object
|
rocksType rocksdb_options_t
|
||||||
rocksdb_randomfile_t* = ptr object
|
rocksType rocksdb_compactoptions_t
|
||||||
rocksdb_readoptions_t* = ptr object
|
rocksType rocksdb_block_based_table_options_t
|
||||||
rocksdb_seqfile_t* = ptr object
|
rocksType rocksdb_cuckoo_table_options_t
|
||||||
rocksdb_slicetransform_t* = ptr object
|
rocksType rocksdb_randomfile_t
|
||||||
rocksdb_snapshot_t* = ptr object
|
rocksType rocksdb_readoptions_t
|
||||||
rocksdb_writablefile_t* = ptr object
|
rocksType rocksdb_seqfile_t
|
||||||
rocksdb_writebatch_t* = ptr object
|
rocksType rocksdb_slicetransform_t
|
||||||
rocksdb_writebatch_wi_t* = ptr object
|
rocksType rocksdb_snapshot_t
|
||||||
rocksdb_writeoptions_t* = ptr object
|
rocksType rocksdb_writablefile_t
|
||||||
rocksdb_universal_compaction_options_t* = ptr object
|
rocksType rocksdb_writebatch_t
|
||||||
rocksdb_livefiles_t* = ptr object
|
rocksType rocksdb_writebatch_wi_t
|
||||||
rocksdb_column_family_handle_t* = ptr object
|
rocksType rocksdb_writeoptions_t
|
||||||
rocksdb_envoptions_t* = ptr object
|
rocksType rocksdb_universal_compaction_options_t
|
||||||
rocksdb_ingestexternalfileoptions_t* = ptr object
|
rocksType rocksdb_livefiles_t
|
||||||
rocksdb_sstfilewriter_t* = ptr object
|
rocksType rocksdb_column_family_handle_t
|
||||||
rocksdb_ratelimiter_t* = ptr object
|
rocksType rocksdb_envoptions_t
|
||||||
rocksdb_pinnableslice_t* = ptr object
|
rocksType rocksdb_ingestexternalfileoptions_t
|
||||||
rocksdb_transactiondb_options_t* = ptr object
|
rocksType rocksdb_sstfilewriter_t
|
||||||
rocksdb_transactiondb_t* = ptr object
|
rocksType rocksdb_ratelimiter_t
|
||||||
rocksdb_transaction_options_t* = ptr object
|
rocksType rocksdb_pinnableslice_t
|
||||||
rocksdb_optimistictransactiondb_t* = ptr object
|
rocksType rocksdb_transactiondb_options_t
|
||||||
rocksdb_optimistictransaction_options_t* = ptr object
|
rocksType rocksdb_transactiondb_t
|
||||||
rocksdb_transaction_t* = ptr object
|
rocksType rocksdb_transaction_options_t
|
||||||
rocksdb_checkpoint_t* = ptr object
|
rocksType rocksdb_optimistictransactiondb_t
|
||||||
|
rocksType rocksdb_optimistictransaction_options_t
|
||||||
|
rocksType rocksdb_transaction_t
|
||||||
|
rocksType rocksdb_checkpoint_t
|
||||||
|
|
||||||
## DB operations
|
## DB operations
|
||||||
{.pragma: importrocks, importc, cdecl, dynlib: librocksdb.}
|
{.pragma: importrocks, importc, cdecl, dynlib: librocksdb.}
|
||||||
|
|
Loading…
Reference in New Issue