Pure Go implementation of D. J. Bernstein's cdb constant database library.

Related tags

Database cdb
Overview

cdb

This is a Go package to read and write cdb ("constant database") files.

The cdb file format is a machine-independent format with the following features:

  • Fast lookups: A successful lookup in a large database normally takes just two disk accesses. An unsuccessful lookup takes only one.
  • Low overhead: A database uses 2048 bytes, plus 24 bytes per record, plus the space for keys and data.
  • No random limits: cdb can handle any database up to 4 gigabytes. There are no other restrictions; records don't even have to fit into memory.

See the original cdb specification and C implementation by D. J. Bernstein at http://cr.yp.to/cdb.html.

Installation

Assuming you have a working Go environment, installation is simply:

go get github.com/jbarham/cdb

The package documentation can be viewed online at https://pkg.go.dev/github.com/jbarham/cdb or on the command line by running go doc github.com/jbarham/cdb.

The included self-test program cdb_test.go illustrates usage of the package.

Utilities

The cdb package includes ports of the programs cdbdump and cdbmake from the original implementation.

Comments
  • Header is not cached, lookups may take 3 seeks rather than claimed 2.

    Header is not cached, lookups may take 3 seeks rather than claimed 2.

    The 2kB header is not stored in cdb.Cdb, so find() calls c.readNums((h << 3) & 2047) on the first lookup after each call to FindStart(). If the OS cache was flushed, this could lead to 3 seeks rather than 2.

    opened by patrick-higgins 3
  • io.EOF is not returned when a key would be in an empty hash table

    io.EOF is not returned when a key would be in an empty hash table

    The guard around c.hslots == 0 in cdb.(*Cdb).find() calls an empty return, which ultimately results in nil being returned rather than io.EOF, even though the key does not exist in the database.

    opened by patrick-higgins 3
  • Add DumpN() functions

    Add DumpN() functions

    We use this patch at work which is mainly a change to the Dump() interface, which now calls DumpN(). DumpN() provides a means to perform partial dumps of n records starting at a specific position.

    opened by scfarley 0
  • Add cdb.Get and command 'cdbget'; no fs dependency in tests

    Add cdb.Get and command 'cdbget'; no fs dependency in tests

    I added an interface to cdb.Get to port 'cdbget' to Golang. I also tweaked the cdb_test.go a little bit by implementing a []byte-backed io.WriteSeeker to avoid any filesystem related dependencies while running tests.

    opened by mgumz 0
  • Feature Request: iterate keys

    Feature Request: iterate keys

    Python's cdb library has a handy function to iterate all keys in a cdb database: http://pilcrow.madison.wi.us/pycdb_doc.html

    It would be awesome to be able to do the same with go-cdb.

    (Also the function for # of items in a cdb is handy and would be nice)

    opened by llimllib 2
Owner
John Barham
John Barham
pure golang key database support key have value. 非常高效实用的键值数据库。

orderfile32 pure golang key database support key have value The orderfile32 is standard alone fast key value database. It have two version. one is thi

null 3 Apr 30, 2022
BadgerDB is an embeddable, persistent and fast key-value (KV) database written in pure Go

BadgerDB BadgerDB is an embeddable, persistent and fast key-value (KV) database written in pure Go. It is the underlying database for Dgraph, a fast,

Blizard 1 Dec 10, 2021
A lightweight document-oriented NoSQL database written in pure Golang.

Lightweight document-oriented NoSQL Database ???? English | ???? 简体中文 | ???? Spanish CloverDB is a lightweight NoSQL database designed for being simpl

Stefano Scafiti 302 Nov 27, 2022
Owl is a db manager platform,committed to standardizing the data, index in the database and operations to the database, to avoid risks and failures.

Owl is a db manager platform,committed to standardizing the data, index in the database and operations to the database, to avoid risks and failures. capabilities which owl provides include Process approval、sql Audit、sql execute and execute as crontab、data backup and recover .

null 34 Nov 9, 2022
This is a simple graph database in SQLite, inspired by "SQLite as a document database".

About This is a simple graph database in SQLite, inspired by "SQLite as a document database". Structure The schema consists of just two structures: No

Denis Papathanasiou 1.1k Nov 21, 2022
Hard Disk Database based on a former database

Hard Disk Database based on a former database

null 0 Nov 1, 2021
Simple key value database that use json files to store the database

KValDB Simple key value database that use json files to store the database, the key and the respective value. This simple database have two gRPC metho

Francisco Santos 0 Nov 13, 2021
Beerus-DB: a database operation framework, currently only supports Mysql, Use [go-sql-driver/mysql] to do database connection and basic operations

Beerus-DB · Beerus-DB is a database operation framework, currently only supports Mysql, Use [go-sql-driver/mysql] to do database connection and basic

Beerus 7 Oct 29, 2022
A rudimentary implementation of a basic document (NoSQL) database in Go

tiedot Documentation Keywords: Golang, go, document database, NoSQL, JSON tiedot - Your NoSQL database powered by Golang tiedot is a document database

Howard 2.7k Nov 14, 2022
A simple, fast, embeddable, persistent key/value store written in pure Go. It supports fully serializable transactions and many data structures such as list, set, sorted set.

NutsDB English | 简体中文 NutsDB is a simple, fast, embeddable and persistent key/value store written in pure Go. It supports fully serializable transacti

徐佳军 2.6k Nov 28, 2022
Low-level key/value store in pure Go.

Description Package slowpoke is a simple key/value store written using Go's standard library only. Keys are stored in memory (with persistence), value

Vadim Kulibaba 100 Oct 14, 2022
The Monogon Project Monorepo. May contain traces of peanuts and a pure Go Linux userland.

This is the main repository containing the source code for the Monogon Project.

null 48 Nov 8, 2022
Eagle - Eagle is a fast and strongly encrypted key-value store written in pure Golang.

EagleDB EagleDB is a fast and simple key-value store written in Golang. It has been designed for handling an exaggerated read/write workload, which su

null 9 Sep 28, 2022
An embedded key/value database for Go.

bbolt bbolt is a fork of Ben Johnson's Bolt key/value store. The purpose of this fork is to provide the Go community with an active maintenance and de

etcd-io 6k Nov 25, 2022
BuntDB is an embeddable, in-memory key/value database for Go with custom indexing and geospatial support

BuntDB is a low-level, in-memory, key/value store in pure Go. It persists to disk, is ACID compliant, and uses locking for multiple readers and a sing

Josh Baker 3.9k Nov 27, 2022
CockroachDB - the open source, cloud-native distributed SQL database.

CockroachDB is a cloud-native SQL database for building global, scalable cloud services that survive disasters. What is CockroachDB? Docs Quickstart C

CockroachDB 26.1k Nov 21, 2022
ACID key-value database.

Coffer Simply ACID* key-value database. At the medium or even low latency it tries to provide greater throughput without losing the ACID properties of

Eduard 31 Sep 26, 2022
A decentralized, trusted, high performance, SQL database with blockchain features

中文简介 CovenantSQL(CQL) is a Byzantine Fault Tolerant relational database built on SQLite: ServerLess: Free, High Availabile, Auto Sync Database Service

CovenantSQL 1.4k Nov 17, 2022
Native GraphQL Database with graph backend

The Only Native GraphQL Database With A Graph Backend. Dgraph is a horizontally scalable and distributed GraphQL database with a graph backend. It pro

Dgraph 18.7k Nov 22, 2022