1 Star 0 Fork 0

荒野無燈 / nildb

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

nildb golang bind

this is a golang binding for nildb C api.

benchmark (Intel(R) Core(TM) i7-8700K CPU @ 4.50GHz, 6 core 12 thread):

goos: linux
goarch: amd64
pkg: bitbucket.org/8ox86/nildb
BenchmarkOpen100-12      	 1000000	      2184 ns/op
BenchmarkOpen1000-12     	 1000000	      2189 ns/op
BenchmarkGet-12          	 1000000	      1152 ns/op
BenchmarkSet-12          	  500000	     14261 ns/op
BenchmarkSave100-12      	   10000	    203917 ns/op
BenchmarkSave10000-12    	   10000	    206707 ns/op
PASS
ok  	bitbucket.org/8ox86/nildb	17.072s

NIL Key/Value database

NILDB is about the simplest key/value store you'll ever see, anywhere. It's written in plain vanilla C using only the standard string and FILE I/O functions, and should port to just about anything with a disk or something that acts like one.

NILDB is based on KISSDB, with significant update to reduce file size and improve efficiency, and also added the capability to delete entries.

It stores keys and values of fixed length in a stupid-simple file format based on fixed-size hash tables. If a hash collision occurrs, a link list is created and the entry is appended to the database. You can add, update, lookup and delete.

Hash table size is a space/speed trade-off parameter. Larger hash tables will reduce collisions and speed things up a bit, at the expense of memory and disk space. A good size is usually about 1/2 the average number of entries you expect.

Features:

  • Tiny
  • Almost zero memory footprint
  • Very space-efficient on disk
  • Pretty respectably fast, especially given its simplicity
  • 64-bit file size limit is 2^64 bytes, and 2^32 offset limit between the same hashed entries.
  • Ports to anything with a C compiler and stdlib/stdio
  • Public domain
  • Works cross big-endian and little-endian system.

Limitations:

  • Fixed-size keys and values, must recreate and copy to change any init size parameter (Although can be adapted to varied value size easily)
  • No search for subsets of keys/values
  • No indexes
  • No transactions
  • No special recovery features if a database gets corrupted
  • No built-in thread-safety (guard it with a mutex in MT code)
  • No built-in caching of data (use filesystem cache)

Alternative key/value stores and embedded databases:

  • KISSDB The base of this project, uses multiple hash tables instead of just one
  • LMDB uses mmap() and is very fast (not quite as tiny/simple/portable)
  • CDB is also minimal and fast, but has a 4gb size limit
  • Kyoto Cabinet is very fast, full-featured, and modern (license required for commercial use)
  • tdbm a simple, high-performance database with nested atomic transactions
  • LevelDB a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.
  • tdb From Samba group
  • mdbm a very fast memory-mapped key/value store, from Yahoo
  • boltdb a golang key/value store
  • Rocksdb A persistent key-value store for fast storage environments, from Facebook
  • Others: GDBM, NDBM, Berkeley DB, Wikipedia DBM
  • Discussion on Reddit

NILDB is in the public domain as according to the Creative Commons Public Domain Dedication.

Author: Tiebing Zhang, Circle Media Inc; Adam Ierymenko / ZeroTier Networks LLC

空文件

简介

golang binding for nildb C api. 展开 收起
Go
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/8ox86/nildb.git
git@gitee.com:8ox86/nildb.git
8ox86
nildb
nildb
master

搜索帮助

14c37bed 8189591 565d56ea 8189591