No description
Find a file
2025-03-14 08:20:07 -04:00
docs Updated docs. 2020-08-01 23:50:29 -04:00
filehash Changed headers in ffdb_hash_func to more modern style. 2025-03-14 08:19:04 -04:00
niledb/private Switched to Nim v0.19. Changed asarray to use UncheckedArray. Made public 2018-11-25 13:40:17 -05:00
tests Some changes to key/val to accomodate Nim complaints. 2020-12-30 17:47:50 -05:00
.gitignore More files in .gitignore. 2017-07-04 22:47:07 -04:00
.travis.yml Switched to Nim v0.19. Changed asarray to use UncheckedArray. Made public 2018-11-25 13:40:17 -05:00
LICENSE Changed license to BSD3. 2017-09-29 15:41:15 -04:00
niledb.nim Some changes to key/val to accomodate Nim complaints. 2020-12-30 17:47:50 -05:00
niledb.nimble Changed to 1.3.2 2025-03-14 08:20:07 -04:00
README.md Small change to readme. 2017-07-05 00:24:12 -04:00

Niledb Build Status

A fast file-hash DB. The interface is Key/Value pair semantics. Storage of these pairs is into strings, and uses an underlying filehash package implemented over a Berkeley Sleepy Cat file-hash database. A single integer index is provided to allow the grouping of the values from many DB's but with a single key.

The filehash DB provides page-level checksums and supports caching of pages for fast retrievals and storage. Multi-threading reading is supported. The DB scales well, an in production, has been used to hold up to 80GB single files with O(100K) keys.

The serializetools module provides tools for serialization and deserialization of keys and values to/from strings.

Example

import niledb, serializetools/serializebin
import posix  ## used for file-modes

MyObj_t = object
  more: int                                    ## Example of nesting

MyKey_t = object
  fred:     int                                ## Simple types
  george:   tuple[here: string, there: char]   ## More complicated types
  stuff:    seq[MyObj_t]                       ## Supports nested objects

MyVal_t = object
  vals:  array[0..3, MyObj_t]                  ## Nested types are also allowed

# The DB
var db: ConfDataStoreDB = newConfDataStoreDB()

# Open an existing DB using posix file modes
var ret = db.open("some_file", O_RDONLY, 0o400)

# Grab all the keys and deserialize them
let des_keys: seq[MyKey_t] = allKeys[MyKey_t](db)

# Get a specific key/val
var val: MyVal_t
ret = db.get(allKeys[0], val)   # return error code if key does not exist

# which is equivalent to 
let val_str: string = db[allKeys[0]]
val = deserializeBinary[MyVal_t](val_str)