1
0
Fork
You've already forked go-cdb
0
D. J. Bernstein's Constant Database reader and writer written in pure Go.
  • Go 100%
Find a file
2023年02月18日 20:23:40 +01:00
cmd Run cdbget through go format 2023年02月18日 20:22:22 +01:00
recordformat Add recordformat parsing 2023年02月16日 00:45:42 +01:00
constant.go Use a constant for the count of Hash tables 2023年02月12日 16:33:48 +01:00
content.go Add recordformat parsing 2023年02月16日 00:45:42 +01:00
content_test.go Add documentation about content 2023年02月12日 12:07:35 +01:00
database.go Fix collisions handling 2023年02月18日 20:22:40 +01:00
database_test.go Fix collisions handling 2023年02月18日 20:22:40 +01:00
dump.go Fix collisions handling 2023年02月18日 20:22:40 +01:00
errors.go Initial commit 2023年02月11日 00:02:06 +01:00
go.mod Initial commit 2023年02月11日 00:02:06 +01:00
go.sum Initial commit 2023年02月11日 00:02:06 +01:00
hash.go Use a constant for the count of Hash tables 2023年02月12日 16:33:48 +01:00
LICENSE Initial commit 2023年02月11日 00:02:06 +01:00
meta.go Move hashTablePointer into its own file, since it will start being shared 2023年02月14日 21:48:30 +01:00
README.md Remove type from the README 2023年02月18日 20:23:40 +01:00
utils.go Add API to read the database 2023年02月14日 21:50:09 +01:00
utils_test.go Initial commit 2023年02月11日 00:02:06 +01:00

cdb

This is a "pure Go" implementation of "Constant Database" as described by D. J. Bernstein under http://cr.yp.to/cdb.html.

This is a read-only, disk-based, key-value store. The implementation embedded in the program. There is no need to have a client/server architecture.

The advantages are described D. J. Bernstein. But what people care the most are fast-look up (at most two disk accesses per lookup) and low overhead (2kib of metadata per database + 24b per records).

One of the limitation of cdb database is their 4GiB limit, since they store 32 bits positions pointers. This can be consider an advantage for SoC and embedded devices development.

The database is create with initial data once, and read-only. Some use cases include blazing fast static HTTP.

This is an alternative implementation to github.com/jbarham/cdb. For the following reason:

  • J. Barham's Go CDB implementation heavily uses panic() and recover() which is officially an "approved" method to handle errors, however it makes, IMHO, the code hard to follow.

  • J. Barham's Go CDB implementation copy the original cdb, especially for Dump. This tools offers more generic interfaces/methods.