moves build output to /src/leveldb/raw.nim

This commit is contained in:
ThatBen 2024-05-09 14:42:38 +02:00
parent 3f3ab38734
commit 3d9a2d982d
4 changed files with 284 additions and 482 deletions

1
.gitignore vendored
View File

@ -2,7 +2,6 @@ nimcache/
/test.db/ /test.db/
/leveldb.e /leveldb.e
tests/packagetest/packagetest tests/packagetest/packagetest
src/leveldb
tests/test tests/test
src/htmldocs/ src/htmldocs/
leveldbtool leveldbtool

View File

@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
root=$(dirname "$0") root=$(dirname "$0")
output="${root}/src/leveldb/raw.nim"
# install nimterop, if not already installed # install nimterop, if not already installed
if ! [ -x "$(command -v toast)" ]; then if ! [ -x "$(command -v toast)" ]; then
nimble install -y nimterop@0.6.13 nimble install -y nimterop@0.6.13
@ -17,8 +19,8 @@ rm -Rf "${root}/sources/benchmarks"
rm "${root}/sources/util/testutil.cc" rm "${root}/sources/util/testutil.cc"
# Prelude: # Prelude:
cat "${root}/prelude.nim" > "${root}/leveldb.nim" cat "${root}/prelude.nim" > "${output}"
echo >> "${root}/leveldb.nim" echo >> "${output}"
# assemble files to be compiled: # assemble files to be compiled:
extensions="c cc cpp" extensions="c cc cpp"
@ -45,5 +47,5 @@ toast \
--includeDirs="${root}/sources/include" \ --includeDirs="${root}/sources/include" \
--includeDirs="${root}/build/include" \ --includeDirs="${root}/build/include" \
--includeDirs="${root}/build/include/port" \ --includeDirs="${root}/build/include/port" \
"${root}/sources/include/leveldb/c.h" >> "${root}/leveldb.nim" "${root}/sources/include/leveldb/c.h" >> "${output}"

View File

@ -1,293 +0,0 @@
when defined(windows):
{.compile: "./sources/util/env_windows.cc".}
{.passc: "-DLEVELDB_PLATFORM_POSIX".}
when defined(posix):
{.compile: "./sources/util/env_posix.cc".}
{.passc: "-DLEVELDB_PLATFORM_WINDOWS".}
# Generated @ 2024-05-09T14:13:25+02:00
# Command line:
# /home/ben/.nimble/pkgs/nimterop-0.6.13/nimterop/toast --compile=./sources/helpers/memenv/memenv.cc --compile=./sources/table/table.cc --compile=./sources/table/iterator.cc --compile=./sources/table/merger.cc --compile=./sources/table/block.cc --compile=./sources/table/table_builder.cc --compile=./sources/table/format.cc --compile=./sources/table/two_level_iterator.cc --compile=./sources/table/filter_block.cc --compile=./sources/table/block_builder.cc --compile=./sources/db/write_batch.cc --compile=./sources/db/version_edit.cc --compile=./sources/db/dbformat.cc --compile=./sources/db/builder.cc --compile=./sources/db/repair.cc --compile=./sources/db/db_impl.cc --compile=./sources/db/dumpfile.cc --compile=./sources/db/filename.cc --compile=./sources/db/log_reader.cc --compile=./sources/db/memtable.cc --compile=./sources/db/table_cache.cc --compile=./sources/db/c.cc --compile=./sources/db/log_writer.cc --compile=./sources/db/version_set.cc --compile=./sources/db/db_iter.cc --compile=./sources/util/hash.cc --compile=./sources/util/options.cc --compile=./sources/util/comparator.cc --compile=./sources/util/coding.cc --compile=./sources/util/histogram.cc --compile=./sources/util/logging.cc --compile=./sources/util/cache.cc --compile=./sources/util/env.cc --compile=./sources/util/filter_policy.cc --compile=./sources/util/arena.cc --compile=./sources/util/bloom.cc --compile=./sources/util/crc32c.cc --compile=./sources/util/status.cc --pnim --preprocess --noHeader --includeDirs=./sources --includeDirs=./sources/helpers --includeDirs=./sources/helpers/memenv --includeDirs=./sources/port --includeDirs=./sources/include --includeDirs=./build/include --includeDirs=./build/include/port ./sources/include/leveldb/c.h
{.push hint[ConvFromXtoItselfNotNeeded]: off.}
import macros
macro defineEnum(typ: untyped): untyped =
result = newNimNode(nnkStmtList)
# Enum mapped to distinct cint
result.add quote do:
type `typ`* = distinct cint
for i in ["+", "-", "*", "div", "mod", "shl", "shr", "or", "and", "xor", "<", "<=", "==", ">", ">="]:
let
ni = newIdentNode(i)
typout = if i[0] in "<=>": newIdentNode("bool") else: typ # comparisons return bool
if i[0] == '>': # cannot borrow `>` and `>=` from templates
let
nopp = if i.len == 2: newIdentNode("<=") else: newIdentNode("<")
result.add quote do:
proc `ni`*(x: `typ`, y: cint): `typout` = `nopp`(y, x)
proc `ni`*(x: cint, y: `typ`): `typout` = `nopp`(y, x)
proc `ni`*(x, y: `typ`): `typout` = `nopp`(y, x)
else:
result.add quote do:
proc `ni`*(x: `typ`, y: cint): `typout` {.borrow.}
proc `ni`*(x: cint, y: `typ`): `typout` {.borrow.}
proc `ni`*(x, y: `typ`): `typout` {.borrow.}
result.add quote do:
proc `ni`*(x: `typ`, y: int): `typout` = `ni`(x, y.cint)
proc `ni`*(x: int, y: `typ`): `typout` = `ni`(x.cint, y)
let
divop = newIdentNode("/") # `/`()
dlrop = newIdentNode("$") # `$`()
notop = newIdentNode("not") # `not`()
result.add quote do:
proc `divop`*(x, y: `typ`): `typ` = `typ`((x.float / y.float).cint)
proc `divop`*(x: `typ`, y: cint): `typ` = `divop`(x, `typ`(y))
proc `divop`*(x: cint, y: `typ`): `typ` = `divop`(`typ`(x), y)
proc `divop`*(x: `typ`, y: int): `typ` = `divop`(x, y.cint)
proc `divop`*(x: int, y: `typ`): `typ` = `divop`(x.cint, y)
proc `dlrop`*(x: `typ`): string {.borrow.}
proc `notop`*(x: `typ`): `typ` {.borrow.}
{.experimental: "codeReordering".}
{.passC: "-I./sources".}
{.passC: "-I./sources/helpers".}
{.passC: "-I./sources/helpers/memenv".}
{.passC: "-I./sources/port".}
{.passC: "-I./sources/include".}
{.passC: "-I./build/include".}
{.passC: "-I./build/include/port".}
{.compile: "./sources/helpers/memenv/memenv.cc".}
{.compile: "./sources/table/table.cc".}
{.compile: "./sources/table/iterator.cc".}
{.compile: "./sources/table/merger.cc".}
{.compile: "./sources/table/block.cc".}
{.compile: "./sources/table/table_builder.cc".}
{.compile: "./sources/table/format.cc".}
{.compile: "./sources/table/two_level_iterator.cc".}
{.compile: "./sources/table/filter_block.cc".}
{.compile: "./sources/table/block_builder.cc".}
{.compile: "./sources/db/write_batch.cc".}
{.compile: "./sources/db/version_edit.cc".}
{.compile: "./sources/db/dbformat.cc".}
{.compile: "./sources/db/builder.cc".}
{.compile: "./sources/db/repair.cc".}
{.compile: "./sources/db/db_impl.cc".}
{.compile: "./sources/db/dumpfile.cc".}
{.compile: "./sources/db/filename.cc".}
{.compile: "./sources/db/log_reader.cc".}
{.compile: "./sources/db/memtable.cc".}
{.compile: "./sources/db/table_cache.cc".}
{.compile: "./sources/db/c.cc".}
{.compile: "./sources/db/log_writer.cc".}
{.compile: "./sources/db/version_set.cc".}
{.compile: "./sources/db/db_iter.cc".}
{.compile: "./sources/util/hash.cc".}
{.compile: "./sources/util/options.cc".}
{.compile: "./sources/util/comparator.cc".}
{.compile: "./sources/util/coding.cc".}
{.compile: "./sources/util/histogram.cc".}
{.compile: "./sources/util/logging.cc".}
{.compile: "./sources/util/cache.cc".}
{.compile: "./sources/util/env.cc".}
{.compile: "./sources/util/filter_policy.cc".}
{.compile: "./sources/util/arena.cc".}
{.compile: "./sources/util/bloom.cc".}
{.compile: "./sources/util/crc32c.cc".}
{.compile: "./sources/util/status.cc".}
defineEnum(Enum_ch1)
const
leveldb_no_compression* = (0).cint
leveldb_snappy_compression* = (1).cint
type
leveldb_t* {.incompleteStruct.} = object
leveldb_cache_t* {.incompleteStruct.} = object
leveldb_comparator_t* {.incompleteStruct.} = object
leveldb_env_t* {.incompleteStruct.} = object
leveldb_filelock_t* {.incompleteStruct.} = object
leveldb_filterpolicy_t* {.incompleteStruct.} = object
leveldb_iterator_t* {.incompleteStruct.} = object
leveldb_logger_t* {.incompleteStruct.} = object
leveldb_options_t* {.incompleteStruct.} = object
leveldb_randomfile_t* {.incompleteStruct.} = object
leveldb_readoptions_t* {.incompleteStruct.} = object
leveldb_seqfile_t* {.incompleteStruct.} = object
leveldb_snapshot_t* {.incompleteStruct.} = object
leveldb_writablefile_t* {.incompleteStruct.} = object
leveldb_writebatch_t* {.incompleteStruct.} = object
leveldb_writeoptions_t* {.incompleteStruct.} = object
proc leveldb_open*(options: ptr leveldb_options_t; name: cstring;
errptr: ptr cstring): ptr leveldb_t {.importc, cdecl.}
proc leveldb_close*(db: ptr leveldb_t) {.importc, cdecl.}
proc leveldb_put*(db: ptr leveldb_t; options: ptr leveldb_writeoptions_t;
key: cstring; keylen: uint; val: cstring; vallen: uint;
errptr: ptr cstring) {.importc, cdecl.}
proc leveldb_delete*(db: ptr leveldb_t; options: ptr leveldb_writeoptions_t;
key: cstring; keylen: uint; errptr: ptr cstring) {.importc,
cdecl.}
proc leveldb_write*(db: ptr leveldb_t; options: ptr leveldb_writeoptions_t;
batch: ptr leveldb_writebatch_t; errptr: ptr cstring) {.
importc, cdecl.}
proc leveldb_get*(db: ptr leveldb_t; options: ptr leveldb_readoptions_t;
key: cstring; keylen: uint; vallen: ptr uint;
errptr: ptr cstring): cstring {.importc, cdecl.}
## ```
## Returns NULL if not found. A malloc()ed array otherwise.
## Stores the length of the array invallen.
## ```
proc leveldb_create_iterator*(db: ptr leveldb_t;
options: ptr leveldb_readoptions_t): ptr leveldb_iterator_t {.
importc, cdecl.}
proc leveldb_create_snapshot*(db: ptr leveldb_t): ptr leveldb_snapshot_t {.
importc, cdecl.}
proc leveldb_release_snapshot*(db: ptr leveldb_t;
snapshot: ptr leveldb_snapshot_t) {.importc,
cdecl.}
proc leveldb_property_value*(db: ptr leveldb_t; propname: cstring): cstring {.
importc, cdecl.}
## ```
## Returns NULL if property name is unknown.
## Else returns a pointer to a malloc()-ed null-terminated value.
## ```
proc leveldb_approximate_sizes*(db: ptr leveldb_t; num_ranges: cint;
range_start_key: ptr cstring;
range_start_key_len: ptr uint;
range_limit_key: ptr cstring;
range_limit_key_len: ptr uint; sizes: ptr uint64) {.
importc, cdecl.}
proc leveldb_compact_range*(db: ptr leveldb_t; start_key: cstring;
start_key_len: uint; limit_key: cstring;
limit_key_len: uint) {.importc, cdecl.}
proc leveldb_destroy_db*(options: ptr leveldb_options_t; name: cstring;
errptr: ptr cstring) {.importc, cdecl.}
proc leveldb_repair_db*(options: ptr leveldb_options_t; name: cstring;
errptr: ptr cstring) {.importc, cdecl.}
proc leveldb_iter_destroy*(a1: ptr leveldb_iterator_t) {.importc, cdecl.}
proc leveldb_iter_valid*(a1: ptr leveldb_iterator_t): uint8 {.importc, cdecl.}
proc leveldb_iter_seek_to_first*(a1: ptr leveldb_iterator_t) {.importc, cdecl.}
proc leveldb_iter_seek_to_last*(a1: ptr leveldb_iterator_t) {.importc, cdecl.}
proc leveldb_iter_seek*(a1: ptr leveldb_iterator_t; k: cstring; klen: uint) {.
importc, cdecl.}
proc leveldb_iter_next*(a1: ptr leveldb_iterator_t) {.importc, cdecl.}
proc leveldb_iter_prev*(a1: ptr leveldb_iterator_t) {.importc, cdecl.}
proc leveldb_iter_key*(a1: ptr leveldb_iterator_t; klen: ptr uint): cstring {.
importc, cdecl.}
proc leveldb_iter_value*(a1: ptr leveldb_iterator_t; vlen: ptr uint): cstring {.
importc, cdecl.}
proc leveldb_iter_get_error*(a1: ptr leveldb_iterator_t; errptr: ptr cstring) {.
importc, cdecl.}
proc leveldb_writebatch_create*(): ptr leveldb_writebatch_t {.importc, cdecl.}
proc leveldb_writebatch_destroy*(a1: ptr leveldb_writebatch_t) {.importc, cdecl.}
proc leveldb_writebatch_clear*(a1: ptr leveldb_writebatch_t) {.importc, cdecl.}
proc leveldb_writebatch_put*(a1: ptr leveldb_writebatch_t; key: cstring;
klen: uint; val: cstring; vlen: uint) {.importc,
cdecl.}
proc leveldb_writebatch_delete*(a1: ptr leveldb_writebatch_t; key: cstring;
klen: uint) {.importc, cdecl.}
proc leveldb_writebatch_iterate*(a1: ptr leveldb_writebatch_t; state: pointer;
put: proc (a1: pointer; k: cstring; klen: uint; v: cstring; vlen: uint) {.
cdecl.}; deleted: proc (a1: pointer; k: cstring; klen: uint) {.cdecl.}) {.
importc, cdecl.}
proc leveldb_writebatch_append*(destination: ptr leveldb_writebatch_t;
source: ptr leveldb_writebatch_t) {.importc,
cdecl.}
proc leveldb_options_create*(): ptr leveldb_options_t {.importc, cdecl.}
proc leveldb_options_destroy*(a1: ptr leveldb_options_t) {.importc, cdecl.}
proc leveldb_options_set_comparator*(a1: ptr leveldb_options_t;
a2: ptr leveldb_comparator_t) {.importc,
cdecl.}
proc leveldb_options_set_filter_policy*(a1: ptr leveldb_options_t;
a2: ptr leveldb_filterpolicy_t) {.
importc, cdecl.}
proc leveldb_options_set_create_if_missing*(a1: ptr leveldb_options_t; a2: uint8) {.
importc, cdecl.}
proc leveldb_options_set_error_if_exists*(a1: ptr leveldb_options_t; a2: uint8) {.
importc, cdecl.}
proc leveldb_options_set_paranoid_checks*(a1: ptr leveldb_options_t; a2: uint8) {.
importc, cdecl.}
proc leveldb_options_set_env*(a1: ptr leveldb_options_t; a2: ptr leveldb_env_t) {.
importc, cdecl.}
proc leveldb_options_set_info_log*(a1: ptr leveldb_options_t;
a2: ptr leveldb_logger_t) {.importc, cdecl.}
proc leveldb_options_set_write_buffer_size*(a1: ptr leveldb_options_t; a2: uint) {.
importc, cdecl.}
proc leveldb_options_set_max_open_files*(a1: ptr leveldb_options_t; a2: cint) {.
importc, cdecl.}
proc leveldb_options_set_cache*(a1: ptr leveldb_options_t;
a2: ptr leveldb_cache_t) {.importc, cdecl.}
proc leveldb_options_set_block_size*(a1: ptr leveldb_options_t; a2: uint) {.
importc, cdecl.}
proc leveldb_options_set_block_restart_interval*(a1: ptr leveldb_options_t;
a2: cint) {.importc, cdecl.}
proc leveldb_options_set_max_file_size*(a1: ptr leveldb_options_t; a2: uint) {.
importc, cdecl.}
proc leveldb_options_set_compression*(a1: ptr leveldb_options_t; a2: cint) {.
importc, cdecl.}
proc leveldb_comparator_create*(state: pointer;
destructor: proc (a1: pointer) {.cdecl.};
compare: proc (a1: pointer; a: cstring; alen: uint; b: cstring; blen: uint): cint {.
cdecl.}; name: proc (a1: pointer): cstring {.cdecl.}): ptr leveldb_comparator_t {.
importc, cdecl.}
proc leveldb_comparator_destroy*(a1: ptr leveldb_comparator_t) {.importc, cdecl.}
proc leveldb_filterpolicy_create*(state: pointer;
destructor: proc (a1: pointer) {.cdecl.};
create_filter: proc (a1: pointer; key_array: ptr cstring;
key_length_array: ptr uint; num_keys: cint;
filter_length: ptr uint): cstring {.cdecl.};
key_may_match: proc (a1: pointer; key: cstring; length: uint;
filter: cstring; filter_length: uint): uint8 {.cdecl.};
name: proc (a1: pointer): cstring {.cdecl.}): ptr leveldb_filterpolicy_t {.
importc, cdecl.}
proc leveldb_filterpolicy_destroy*(a1: ptr leveldb_filterpolicy_t) {.importc,
cdecl.}
proc leveldb_filterpolicy_create_bloom*(bits_per_key: cint): ptr leveldb_filterpolicy_t {.
importc, cdecl.}
proc leveldb_readoptions_create*(): ptr leveldb_readoptions_t {.importc, cdecl.}
proc leveldb_readoptions_destroy*(a1: ptr leveldb_readoptions_t) {.importc,
cdecl.}
proc leveldb_readoptions_set_verify_checksums*(a1: ptr leveldb_readoptions_t;
a2: uint8) {.importc, cdecl.}
proc leveldb_readoptions_set_fill_cache*(a1: ptr leveldb_readoptions_t;
a2: uint8) {.importc, cdecl.}
proc leveldb_readoptions_set_snapshot*(a1: ptr leveldb_readoptions_t;
a2: ptr leveldb_snapshot_t) {.importc,
cdecl.}
proc leveldb_writeoptions_create*(): ptr leveldb_writeoptions_t {.importc, cdecl.}
proc leveldb_writeoptions_destroy*(a1: ptr leveldb_writeoptions_t) {.importc,
cdecl.}
proc leveldb_writeoptions_set_sync*(a1: ptr leveldb_writeoptions_t; a2: uint8) {.
importc, cdecl.}
proc leveldb_cache_create_lru*(capacity: uint): ptr leveldb_cache_t {.importc,
cdecl.}
proc leveldb_cache_destroy*(cache: ptr leveldb_cache_t) {.importc, cdecl.}
proc leveldb_create_default_env*(): ptr leveldb_env_t {.importc, cdecl.}
proc leveldb_env_destroy*(a1: ptr leveldb_env_t) {.importc, cdecl.}
proc leveldb_env_get_test_directory*(a1: ptr leveldb_env_t): cstring {.importc,
cdecl.}
## ```
## If not NULL, the returned buffer must be released using leveldb_free().
## ```
proc leveldb_free*(`ptr`: pointer) {.importc, cdecl.}
## ```
## Utility
## Calls free(ptr).
## REQUIRES: ptr was malloc()-ed and returned by one of the routines
## in this file. Note that in certain cases (typically on Windows), you
## may need to call this routine instead of free(ptr) to dispose of
## malloc()-ed memory returned by this library.
## ```
proc leveldb_major_version*(): cint {.importc, cdecl.}
## ```
## Return the major version number for this release.
## ```
proc leveldb_minor_version*(): cint {.importc, cdecl.}
## ```
## Return the minor version number for this release.
## ```
{.pop.}

View File

@ -1,199 +1,293 @@
## Copyright (c) 2011 The LevelDB Authors. All rights reserved. when defined(windows):
## Use of this source code is governed by a BSD-style license that can be {.compile: "./sources/util/env_windows.cc".}
## found in the LICENSE file. See the AUTHORS file for names of contributors. {.passc: "-DLEVELDB_PLATFORM_POSIX".}
##
## C bindings for leveldb. May be useful as a stable ABI that can be
## used by programs that keep leveldb in a shared library, or for
## a JNI api.
##
## Does not support:
## . getters for the option types
## . custom comparators that implement key shortening
## . custom iter, db, env, cache implementations using just the C bindings
##
## Some conventions:
##
## (1) We expose just opaque struct pointers and functions to clients.
## This allows us to change internal representations without having to
## recompile clients.
##
## (2) For simplicity, there is no equivalent to the Slice type. Instead,
## the caller has to pass the pointer and length as separate
## arguments.
##
## (3) Errors are represented by a null-terminated c string. NULL
## means no error. All operations that can raise an error are passed
## a "char** errptr" as the last argument. One of the following must
## be true on entry:
## errptr == NULL
## errptr points to a malloc()ed null-terminated error message
## (On Windows, \*errptr must have been malloc()-ed by this library.)
## On success, a leveldb routine leaves \*errptr unchanged.
## On failure, leveldb frees the old value of \*errptr and
## set \*errptr to a malloc()ed error message.
##
## (4) Bools have the type uint8_t (0 == false; rest == true)
##
## (5) All of the pointer arguments must be non-NULL.
##
{.passl: "-lleveldb".} when defined(posix):
{.compile: "./sources/util/env_posix.cc".}
{.passc: "-DLEVELDB_PLATFORM_WINDOWS".}
## # Exported types # Generated @ 2024-05-09T14:13:25+02:00
# Command line:
# /home/ben/.nimble/pkgs/nimterop-0.6.13/nimterop/toast --compile=./sources/helpers/memenv/memenv.cc --compile=./sources/table/table.cc --compile=./sources/table/iterator.cc --compile=./sources/table/merger.cc --compile=./sources/table/block.cc --compile=./sources/table/table_builder.cc --compile=./sources/table/format.cc --compile=./sources/table/two_level_iterator.cc --compile=./sources/table/filter_block.cc --compile=./sources/table/block_builder.cc --compile=./sources/db/write_batch.cc --compile=./sources/db/version_edit.cc --compile=./sources/db/dbformat.cc --compile=./sources/db/builder.cc --compile=./sources/db/repair.cc --compile=./sources/db/db_impl.cc --compile=./sources/db/dumpfile.cc --compile=./sources/db/filename.cc --compile=./sources/db/log_reader.cc --compile=./sources/db/memtable.cc --compile=./sources/db/table_cache.cc --compile=./sources/db/c.cc --compile=./sources/db/log_writer.cc --compile=./sources/db/version_set.cc --compile=./sources/db/db_iter.cc --compile=./sources/util/hash.cc --compile=./sources/util/options.cc --compile=./sources/util/comparator.cc --compile=./sources/util/coding.cc --compile=./sources/util/histogram.cc --compile=./sources/util/logging.cc --compile=./sources/util/cache.cc --compile=./sources/util/env.cc --compile=./sources/util/filter_policy.cc --compile=./sources/util/arena.cc --compile=./sources/util/bloom.cc --compile=./sources/util/crc32c.cc --compile=./sources/util/status.cc --pnim --preprocess --noHeader --includeDirs=./sources --includeDirs=./sources/helpers --includeDirs=./sources/helpers/memenv --includeDirs=./sources/port --includeDirs=./sources/include --includeDirs=./build/include --includeDirs=./build/include/port ./sources/include/leveldb/c.h
type {.push hint[ConvFromXtoItselfNotNeeded]: off.}
leveldb_options_t* = object import macros
leveldb_writeoptions_t* = object
leveldb_readoptions_t* = object
leveldb_writebatch_t* = object
leveldb_iterator_t* = object
leveldb_snapshot_t* = object
leveldb_comparator_t* = object
leveldb_filterpolicy_t* = object
leveldb_env_t* = object
leveldb_logger_t* = object
leveldb_cache_t* = object
leveldb_t* = object
## DB operations macro defineEnum(typ: untyped): untyped =
result = newNimNode(nnkStmtList)
proc leveldb_open*(options: ptr leveldb_options_t; name: cstring; errptr: ptr cstring): ptr leveldb_t {.importc.} # Enum mapped to distinct cint
proc leveldb_close*(db: ptr leveldb_t) {.importc.} result.add quote do:
proc leveldb_put*(db: ptr leveldb_t; options: ptr leveldb_writeoptions_t; key: cstring; type `typ`* = distinct cint
keylen: csize_t; val: cstring; vallen: csize_t; errptr: ptr cstring) {.importc.}
proc leveldb_delete*(db: ptr leveldb_t; options: ptr leveldb_writeoptions_t;
key: cstring; keylen: csize_t; errptr: ptr cstring) {.importc.}
proc leveldb_write*(db: ptr leveldb_t; options: ptr leveldb_writeoptions_t;
batch: ptr leveldb_writebatch_t; errptr: ptr cstring) {.importc.}
## Returns NULL if not found. A malloc()ed array otherwise.
## Stores the length of the array in \*vallen.
proc leveldb_get*(db: ptr leveldb_t; options: ptr leveldb_readoptions_t; key: cstring; for i in ["+", "-", "*", "div", "mod", "shl", "shr", "or", "and", "xor", "<", "<=", "==", ">", ">="]:
keylen: csize_t; vallen: ptr csize_t; errptr: ptr cstring): cstring {.importc.} let
proc leveldb_create_iterator*(db: ptr leveldb_t; options: ptr leveldb_readoptions_t): ptr leveldb_iterator_t {.importc.} ni = newIdentNode(i)
proc leveldb_create_snapshot*(db: ptr leveldb_t): ptr leveldb_snapshot_t {.importc.} typout = if i[0] in "<=>": newIdentNode("bool") else: typ # comparisons return bool
proc leveldb_release_snapshot*(db: ptr leveldb_t; snapshot: ptr leveldb_snapshot_t) {.importc.} if i[0] == '>': # cannot borrow `>` and `>=` from templates
## Returns NULL if property name is unknown. let
## Else returns a pointer to a malloc()-ed null-terminated value. nopp = if i.len == 2: newIdentNode("<=") else: newIdentNode("<")
result.add quote do:
proc `ni`*(x: `typ`, y: cint): `typout` = `nopp`(y, x)
proc `ni`*(x: cint, y: `typ`): `typout` = `nopp`(y, x)
proc `ni`*(x, y: `typ`): `typout` = `nopp`(y, x)
else:
result.add quote do:
proc `ni`*(x: `typ`, y: cint): `typout` {.borrow.}
proc `ni`*(x: cint, y: `typ`): `typout` {.borrow.}
proc `ni`*(x, y: `typ`): `typout` {.borrow.}
result.add quote do:
proc `ni`*(x: `typ`, y: int): `typout` = `ni`(x, y.cint)
proc `ni`*(x: int, y: `typ`): `typout` = `ni`(x.cint, y)
proc leveldb_property_value*(db: ptr leveldb_t; propname: cstring): cstring {.importc.} let
proc leveldb_approximate_sizes*(db: ptr leveldb_t; num_ranges: cint; divop = newIdentNode("/") # `/`()
range_start_key: ptr cstring; dlrop = newIdentNode("$") # `$`()
range_start_key_len: ptr csize_t; notop = newIdentNode("not") # `not`()
range_limit_key: ptr cstring; result.add quote do:
range_limit_key_len: ptr csize_t; sizes: ptr uint64) {.importc.} proc `divop`*(x, y: `typ`): `typ` = `typ`((x.float / y.float).cint)
proc leveldb_compact_range*(db: ptr leveldb_t; start_key: cstring; proc `divop`*(x: `typ`, y: cint): `typ` = `divop`(x, `typ`(y))
start_key_len: csize_t; limit_key: cstring; proc `divop`*(x: cint, y: `typ`): `typ` = `divop`(`typ`(x), y)
limit_key_len: csize_t) {.importc.} proc `divop`*(x: `typ`, y: int): `typ` = `divop`(x, y.cint)
## Management operations proc `divop`*(x: int, y: `typ`): `typ` = `divop`(x.cint, y)
proc leveldb_destroy_db*(options: ptr leveldb_options_t; name: cstring; proc `dlrop`*(x: `typ`): string {.borrow.}
errptr: ptr cstring) {.importc.} proc `notop`*(x: `typ`): `typ` {.borrow.}
proc leveldb_repair_db*(options: ptr leveldb_options_t; name: cstring;
errptr: ptr cstring) {.importc.}
## Iterator
proc leveldb_iter_destroy*(a1: ptr leveldb_iterator_t) {.importc.}
proc leveldb_iter_valid*(a1: ptr leveldb_iterator_t): uint8 {.importc.}
proc leveldb_iter_seek_to_first*(a1: ptr leveldb_iterator_t) {.importc.}
proc leveldb_iter_seek_to_last*(a1: ptr leveldb_iterator_t) {.importc.}
proc leveldb_iter_seek*(a1: ptr leveldb_iterator_t; k: cstring; klen: csize_t) {.importc.}
proc leveldb_iter_next*(a1: ptr leveldb_iterator_t) {.importc.}
proc leveldb_iter_prev*(a1: ptr leveldb_iterator_t) {.importc.}
proc leveldb_iter_key*(a1: ptr leveldb_iterator_t; klen: ptr csize_t): cstring {.importc.}
proc leveldb_iter_value*(a1: ptr leveldb_iterator_t; vlen: ptr csize_t): cstring {.importc.}
proc leveldb_iter_get_error*(a1: ptr leveldb_iterator_t; errptr: ptr cstring) {.importc.}
## Write batch
proc leveldb_writebatch_create*(): ptr leveldb_writebatch_t {.importc.} {.experimental: "codeReordering".}
proc leveldb_writebatch_destroy*(a1: ptr leveldb_writebatch_t) {.importc.} {.passC: "-I./sources".}
proc leveldb_writebatch_clear*(a1: ptr leveldb_writebatch_t) {.importc.} {.passC: "-I./sources/helpers".}
proc leveldb_writebatch_put*(a1: ptr leveldb_writebatch_t; key: cstring; klen: csize_t; {.passC: "-I./sources/helpers/memenv".}
val: cstring; vlen: csize_t) {.importc.} {.passC: "-I./sources/port".}
proc leveldb_writebatch_delete*(a1: ptr leveldb_writebatch_t; key: cstring; {.passC: "-I./sources/include".}
klen: csize_t) {.importc.} {.passC: "-I./build/include".}
proc leveldb_writebatch_iterate*(a1: ptr leveldb_writebatch_t; state: pointer; put: proc ( {.passC: "-I./build/include/port".}
a1: pointer; k: cstring; klen: csize_t; v: cstring; vlen: csize_t); deleted: proc ( {.compile: "./sources/helpers/memenv/memenv.cc".}
a1: pointer; k: cstring; klen: csize_t)) {.importc.} {.compile: "./sources/table/table.cc".}
proc leveldb_writebatch_append*(destination: ptr leveldb_writebatch_t; {.compile: "./sources/table/iterator.cc".}
source: ptr leveldb_writebatch_t) {.importc.} {.compile: "./sources/table/merger.cc".}
## Options {.compile: "./sources/table/block.cc".}
{.compile: "./sources/table/table_builder.cc".}
proc leveldb_options_create*(): ptr leveldb_options_t {.importc.} {.compile: "./sources/table/format.cc".}
proc leveldb_options_destroy*(a1: ptr leveldb_options_t) {.importc.} {.compile: "./sources/table/two_level_iterator.cc".}
proc leveldb_options_set_comparator*(a1: ptr leveldb_options_t; {.compile: "./sources/table/filter_block.cc".}
a2: ptr leveldb_comparator_t) {.importc.} {.compile: "./sources/table/block_builder.cc".}
proc leveldb_options_set_filter_policy*(a1: ptr leveldb_options_t; {.compile: "./sources/db/write_batch.cc".}
a2: ptr leveldb_filterpolicy_t) {.importc.} {.compile: "./sources/db/version_edit.cc".}
proc leveldb_options_set_create_if_missing*(a1: ptr leveldb_options_t; a2: uint8) {.importc.} {.compile: "./sources/db/dbformat.cc".}
proc leveldb_options_set_error_if_exists*(a1: ptr leveldb_options_t; a2: uint8) {.importc.} {.compile: "./sources/db/builder.cc".}
proc leveldb_options_set_paranoid_checks*(a1: ptr leveldb_options_t; a2: uint8) {.importc.} {.compile: "./sources/db/repair.cc".}
proc leveldb_options_set_env*(a1: ptr leveldb_options_t; a2: ptr leveldb_env_t) {.importc.} {.compile: "./sources/db/db_impl.cc".}
proc leveldb_options_set_info_log*(a1: ptr leveldb_options_t; {.compile: "./sources/db/dumpfile.cc".}
a2: ptr leveldb_logger_t) {.importc.} {.compile: "./sources/db/filename.cc".}
proc leveldb_options_set_write_buffer_size*(a1: ptr leveldb_options_t; a2: csize_t) {.importc.} {.compile: "./sources/db/log_reader.cc".}
proc leveldb_options_set_max_open_files*(a1: ptr leveldb_options_t; a2: cint) {.importc.} {.compile: "./sources/db/memtable.cc".}
proc leveldb_options_set_cache*(a1: ptr leveldb_options_t; a2: ptr leveldb_cache_t) {.importc.} {.compile: "./sources/db/table_cache.cc".}
proc leveldb_options_set_block_size*(a1: ptr leveldb_options_t; a2: csize_t) {.importc.} {.compile: "./sources/db/c.cc".}
proc leveldb_options_set_block_restart_interval*(a1: ptr leveldb_options_t; a2: cint) {.importc.} {.compile: "./sources/db/log_writer.cc".}
proc leveldb_options_set_max_file_size*(a1: ptr leveldb_options_t; a2: csize_t) {.importc.} {.compile: "./sources/db/version_set.cc".}
{.compile: "./sources/db/db_iter.cc".}
{.compile: "./sources/util/hash.cc".}
{.compile: "./sources/util/options.cc".}
{.compile: "./sources/util/comparator.cc".}
{.compile: "./sources/util/coding.cc".}
{.compile: "./sources/util/histogram.cc".}
{.compile: "./sources/util/logging.cc".}
{.compile: "./sources/util/cache.cc".}
{.compile: "./sources/util/env.cc".}
{.compile: "./sources/util/filter_policy.cc".}
{.compile: "./sources/util/arena.cc".}
{.compile: "./sources/util/bloom.cc".}
{.compile: "./sources/util/crc32c.cc".}
{.compile: "./sources/util/status.cc".}
defineEnum(Enum_ch1)
const const
leveldb_no_compression* = 0 leveldb_no_compression* = (0).cint
leveldb_snappy_compression* = 1 leveldb_snappy_compression* = (1).cint
type
proc leveldb_options_set_compression*(a1: ptr leveldb_options_t; a2: cint) {.importc.} leveldb_t* {.incompleteStruct.} = object
## Comparator leveldb_cache_t* {.incompleteStruct.} = object
leveldb_comparator_t* {.incompleteStruct.} = object
proc leveldb_comparator_create*(state: pointer; destructor: proc (a1: pointer); compare: proc ( leveldb_env_t* {.incompleteStruct.} = object
a1: pointer; a: cstring; alen: csize_t; b: cstring; blen: csize_t): cint; leveldb_filelock_t* {.incompleteStruct.} = object
name: proc (a1: pointer): cstring): ptr leveldb_comparator_t {.importc.} leveldb_filterpolicy_t* {.incompleteStruct.} = object
proc leveldb_comparator_destroy*(a1: ptr leveldb_comparator_t) {.importc.} leveldb_iterator_t* {.incompleteStruct.} = object
## Filter policy leveldb_logger_t* {.incompleteStruct.} = object
leveldb_options_t* {.incompleteStruct.} = object
proc leveldb_filterpolicy_create*(state: pointer; destructor: proc (a1: pointer); leveldb_randomfile_t* {.incompleteStruct.} = object
leveldb_readoptions_t* {.incompleteStruct.} = object
leveldb_seqfile_t* {.incompleteStruct.} = object
leveldb_snapshot_t* {.incompleteStruct.} = object
leveldb_writablefile_t* {.incompleteStruct.} = object
leveldb_writebatch_t* {.incompleteStruct.} = object
leveldb_writeoptions_t* {.incompleteStruct.} = object
proc leveldb_open*(options: ptr leveldb_options_t; name: cstring;
errptr: ptr cstring): ptr leveldb_t {.importc, cdecl.}
proc leveldb_close*(db: ptr leveldb_t) {.importc, cdecl.}
proc leveldb_put*(db: ptr leveldb_t; options: ptr leveldb_writeoptions_t;
key: cstring; keylen: uint; val: cstring; vallen: uint;
errptr: ptr cstring) {.importc, cdecl.}
proc leveldb_delete*(db: ptr leveldb_t; options: ptr leveldb_writeoptions_t;
key: cstring; keylen: uint; errptr: ptr cstring) {.importc,
cdecl.}
proc leveldb_write*(db: ptr leveldb_t; options: ptr leveldb_writeoptions_t;
batch: ptr leveldb_writebatch_t; errptr: ptr cstring) {.
importc, cdecl.}
proc leveldb_get*(db: ptr leveldb_t; options: ptr leveldb_readoptions_t;
key: cstring; keylen: uint; vallen: ptr uint;
errptr: ptr cstring): cstring {.importc, cdecl.}
## ```
## Returns NULL if not found. A malloc()ed array otherwise.
## Stores the length of the array invallen.
## ```
proc leveldb_create_iterator*(db: ptr leveldb_t;
options: ptr leveldb_readoptions_t): ptr leveldb_iterator_t {.
importc, cdecl.}
proc leveldb_create_snapshot*(db: ptr leveldb_t): ptr leveldb_snapshot_t {.
importc, cdecl.}
proc leveldb_release_snapshot*(db: ptr leveldb_t;
snapshot: ptr leveldb_snapshot_t) {.importc,
cdecl.}
proc leveldb_property_value*(db: ptr leveldb_t; propname: cstring): cstring {.
importc, cdecl.}
## ```
## Returns NULL if property name is unknown.
## Else returns a pointer to a malloc()-ed null-terminated value.
## ```
proc leveldb_approximate_sizes*(db: ptr leveldb_t; num_ranges: cint;
range_start_key: ptr cstring;
range_start_key_len: ptr uint;
range_limit_key: ptr cstring;
range_limit_key_len: ptr uint; sizes: ptr uint64) {.
importc, cdecl.}
proc leveldb_compact_range*(db: ptr leveldb_t; start_key: cstring;
start_key_len: uint; limit_key: cstring;
limit_key_len: uint) {.importc, cdecl.}
proc leveldb_destroy_db*(options: ptr leveldb_options_t; name: cstring;
errptr: ptr cstring) {.importc, cdecl.}
proc leveldb_repair_db*(options: ptr leveldb_options_t; name: cstring;
errptr: ptr cstring) {.importc, cdecl.}
proc leveldb_iter_destroy*(a1: ptr leveldb_iterator_t) {.importc, cdecl.}
proc leveldb_iter_valid*(a1: ptr leveldb_iterator_t): uint8 {.importc, cdecl.}
proc leveldb_iter_seek_to_first*(a1: ptr leveldb_iterator_t) {.importc, cdecl.}
proc leveldb_iter_seek_to_last*(a1: ptr leveldb_iterator_t) {.importc, cdecl.}
proc leveldb_iter_seek*(a1: ptr leveldb_iterator_t; k: cstring; klen: uint) {.
importc, cdecl.}
proc leveldb_iter_next*(a1: ptr leveldb_iterator_t) {.importc, cdecl.}
proc leveldb_iter_prev*(a1: ptr leveldb_iterator_t) {.importc, cdecl.}
proc leveldb_iter_key*(a1: ptr leveldb_iterator_t; klen: ptr uint): cstring {.
importc, cdecl.}
proc leveldb_iter_value*(a1: ptr leveldb_iterator_t; vlen: ptr uint): cstring {.
importc, cdecl.}
proc leveldb_iter_get_error*(a1: ptr leveldb_iterator_t; errptr: ptr cstring) {.
importc, cdecl.}
proc leveldb_writebatch_create*(): ptr leveldb_writebatch_t {.importc, cdecl.}
proc leveldb_writebatch_destroy*(a1: ptr leveldb_writebatch_t) {.importc, cdecl.}
proc leveldb_writebatch_clear*(a1: ptr leveldb_writebatch_t) {.importc, cdecl.}
proc leveldb_writebatch_put*(a1: ptr leveldb_writebatch_t; key: cstring;
klen: uint; val: cstring; vlen: uint) {.importc,
cdecl.}
proc leveldb_writebatch_delete*(a1: ptr leveldb_writebatch_t; key: cstring;
klen: uint) {.importc, cdecl.}
proc leveldb_writebatch_iterate*(a1: ptr leveldb_writebatch_t; state: pointer;
put: proc (a1: pointer; k: cstring; klen: uint; v: cstring; vlen: uint) {.
cdecl.}; deleted: proc (a1: pointer; k: cstring; klen: uint) {.cdecl.}) {.
importc, cdecl.}
proc leveldb_writebatch_append*(destination: ptr leveldb_writebatch_t;
source: ptr leveldb_writebatch_t) {.importc,
cdecl.}
proc leveldb_options_create*(): ptr leveldb_options_t {.importc, cdecl.}
proc leveldb_options_destroy*(a1: ptr leveldb_options_t) {.importc, cdecl.}
proc leveldb_options_set_comparator*(a1: ptr leveldb_options_t;
a2: ptr leveldb_comparator_t) {.importc,
cdecl.}
proc leveldb_options_set_filter_policy*(a1: ptr leveldb_options_t;
a2: ptr leveldb_filterpolicy_t) {.
importc, cdecl.}
proc leveldb_options_set_create_if_missing*(a1: ptr leveldb_options_t; a2: uint8) {.
importc, cdecl.}
proc leveldb_options_set_error_if_exists*(a1: ptr leveldb_options_t; a2: uint8) {.
importc, cdecl.}
proc leveldb_options_set_paranoid_checks*(a1: ptr leveldb_options_t; a2: uint8) {.
importc, cdecl.}
proc leveldb_options_set_env*(a1: ptr leveldb_options_t; a2: ptr leveldb_env_t) {.
importc, cdecl.}
proc leveldb_options_set_info_log*(a1: ptr leveldb_options_t;
a2: ptr leveldb_logger_t) {.importc, cdecl.}
proc leveldb_options_set_write_buffer_size*(a1: ptr leveldb_options_t; a2: uint) {.
importc, cdecl.}
proc leveldb_options_set_max_open_files*(a1: ptr leveldb_options_t; a2: cint) {.
importc, cdecl.}
proc leveldb_options_set_cache*(a1: ptr leveldb_options_t;
a2: ptr leveldb_cache_t) {.importc, cdecl.}
proc leveldb_options_set_block_size*(a1: ptr leveldb_options_t; a2: uint) {.
importc, cdecl.}
proc leveldb_options_set_block_restart_interval*(a1: ptr leveldb_options_t;
a2: cint) {.importc, cdecl.}
proc leveldb_options_set_max_file_size*(a1: ptr leveldb_options_t; a2: uint) {.
importc, cdecl.}
proc leveldb_options_set_compression*(a1: ptr leveldb_options_t; a2: cint) {.
importc, cdecl.}
proc leveldb_comparator_create*(state: pointer;
destructor: proc (a1: pointer) {.cdecl.};
compare: proc (a1: pointer; a: cstring; alen: uint; b: cstring; blen: uint): cint {.
cdecl.}; name: proc (a1: pointer): cstring {.cdecl.}): ptr leveldb_comparator_t {.
importc, cdecl.}
proc leveldb_comparator_destroy*(a1: ptr leveldb_comparator_t) {.importc, cdecl.}
proc leveldb_filterpolicy_create*(state: pointer;
destructor: proc (a1: pointer) {.cdecl.};
create_filter: proc (a1: pointer; key_array: ptr cstring; create_filter: proc (a1: pointer; key_array: ptr cstring;
key_length_array: ptr csize_t; num_keys: cint; key_length_array: ptr uint; num_keys: cint;
filter_length: ptr csize_t): cstring; key_may_match: proc ( filter_length: ptr uint): cstring {.cdecl.};
a1: pointer; key: cstring; length: csize_t; filter: cstring; filter_length: csize_t): uint8; key_may_match: proc (a1: pointer; key: cstring; length: uint;
name: proc (a1: pointer): cstring): ptr leveldb_filterpolicy_t {.importc.} filter: cstring; filter_length: uint): uint8 {.cdecl.};
proc leveldb_filterpolicy_destroy*(a1: ptr leveldb_filterpolicy_t) {.importc.} name: proc (a1: pointer): cstring {.cdecl.}): ptr leveldb_filterpolicy_t {.
proc leveldb_filterpolicy_create_bloom*(bits_per_key: cint): ptr leveldb_filterpolicy_t {.importc.} importc, cdecl.}
## Read options proc leveldb_filterpolicy_destroy*(a1: ptr leveldb_filterpolicy_t) {.importc,
cdecl.}
proc leveldb_readoptions_create*(): ptr leveldb_readoptions_t {.importc.} proc leveldb_filterpolicy_create_bloom*(bits_per_key: cint): ptr leveldb_filterpolicy_t {.
proc leveldb_readoptions_destroy*(a1: ptr leveldb_readoptions_t) {.importc.} importc, cdecl.}
proc leveldb_readoptions_create*(): ptr leveldb_readoptions_t {.importc, cdecl.}
proc leveldb_readoptions_destroy*(a1: ptr leveldb_readoptions_t) {.importc,
cdecl.}
proc leveldb_readoptions_set_verify_checksums*(a1: ptr leveldb_readoptions_t; proc leveldb_readoptions_set_verify_checksums*(a1: ptr leveldb_readoptions_t;
a2: uint8) {.importc.} a2: uint8) {.importc, cdecl.}
proc leveldb_readoptions_set_fill_cache*(a1: ptr leveldb_readoptions_t; a2: uint8) {.importc.} proc leveldb_readoptions_set_fill_cache*(a1: ptr leveldb_readoptions_t;
a2: uint8) {.importc, cdecl.}
proc leveldb_readoptions_set_snapshot*(a1: ptr leveldb_readoptions_t; proc leveldb_readoptions_set_snapshot*(a1: ptr leveldb_readoptions_t;
a2: ptr leveldb_snapshot_t) {.importc.} a2: ptr leveldb_snapshot_t) {.importc,
## Write options cdecl.}
proc leveldb_writeoptions_create*(): ptr leveldb_writeoptions_t {.importc, cdecl.}
proc leveldb_writeoptions_create*(): ptr leveldb_writeoptions_t {.importc.} proc leveldb_writeoptions_destroy*(a1: ptr leveldb_writeoptions_t) {.importc,
proc leveldb_writeoptions_destroy*(a1: ptr leveldb_writeoptions_t) {.importc.} cdecl.}
proc leveldb_writeoptions_set_sync*(a1: ptr leveldb_writeoptions_t; a2: uint8) {.importc.} proc leveldb_writeoptions_set_sync*(a1: ptr leveldb_writeoptions_t; a2: uint8) {.
## Cache importc, cdecl.}
proc leveldb_cache_create_lru*(capacity: uint): ptr leveldb_cache_t {.importc,
proc leveldb_cache_create_lru*(capacity: csize_t): ptr leveldb_cache_t {.importc.} cdecl.}
proc leveldb_cache_destroy*(cache: ptr leveldb_cache_t) {.importc.} proc leveldb_cache_destroy*(cache: ptr leveldb_cache_t) {.importc, cdecl.}
## Env proc leveldb_create_default_env*(): ptr leveldb_env_t {.importc, cdecl.}
proc leveldb_env_destroy*(a1: ptr leveldb_env_t) {.importc, cdecl.}
proc leveldb_create_default_env*(): ptr leveldb_env_t {.importc.} proc leveldb_env_get_test_directory*(a1: ptr leveldb_env_t): cstring {.importc,
proc leveldb_env_destroy*(a1: ptr leveldb_env_t) {.importc.} cdecl.}
## If not NULL, the returned buffer must be released using leveldb_free(). ## ```
## If not NULL, the returned buffer must be released using leveldb_free().
proc leveldb_env_get_test_directory*(a1: ptr leveldb_env_t): cstring {.importc.} ## ```
## Utility proc leveldb_free*(`ptr`: pointer) {.importc, cdecl.}
## Calls free(ptr). ## ```
## REQUIRES: ptr was malloc()-ed and returned by one of the routines ## Utility
## in this file. Note that in certain cases (typically on Windows), you ## Calls free(ptr).
## may need to call this routine instead of free(ptr) to dispose of ## REQUIRES: ptr was malloc()-ed and returned by one of the routines
## malloc()-ed memory returned by this library. ## in this file. Note that in certain cases (typically on Windows), you
## may need to call this routine instead of free(ptr) to dispose of
proc leveldb_free*(`ptr`: pointer) {.importc.} ## malloc()-ed memory returned by this library.
## Return the major version number for this release. ## ```
proc leveldb_major_version*(): cint {.importc, cdecl.}
proc leveldb_major_version*(): cint {.importc.} ## ```
## Return the minor version number for this release. ## Return the major version number for this release.
## ```
proc leveldb_minor_version*(): cint {.importc.} proc leveldb_minor_version*(): cint {.importc, cdecl.}
## ```
## Return the minor version number for this release.
## ```
{.pop.}