https://github.com/andy-byers/calicodb
A tiny embedded, transactional key-value database 🐱
https://github.com/andy-byers/calicodb
bplus-tree cpp cpp17 database key-value-database key-value-store write-ahead-log
Last synced: 7 months ago
JSON representation
A tiny embedded, transactional key-value database 🐱
- Host: GitHub
- URL: https://github.com/andy-byers/calicodb
- Owner: andy-byers
- License: mit
- Created: 2022-05-23T16:12:00.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-09-25T02:43:45.000Z (over 2 years ago)
- Last Synced: 2023-09-25T05:29:44.528Z (over 2 years ago)
- Topics: bplus-tree, cpp, cpp17, database, key-value-database, key-value-store, write-ahead-log
- Language: C++
- Homepage:
- Size: 4.08 MB
- Stars: 25
- Watchers: 3
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# CalicoDB
CalicoDB is a tiny key-value database library written in C++17 and inspired by SQLite3.
It exposes a small API that allows transactional storage and retrieval of byte sequences from multiple key spaces.
CalicoDB aims to be portable, flexible, and simple.

+ [Disclaimer](#disclaimer)
+ [Features](#features)
+ [Caveats](#caveats)
+ [Documentation](#documentation)
+ [Requirements](#requirements)
+ [Performance](#performance)
+ [TODO](#todo)
+ [Contributions](#contributions)
## Disclaimer
CalicoDB is under active development.
It is not ready for production, and the author is not a professional database developer.
Feedback is appreciated!
## Features
+ Records are stored in buckets, each with an independent sorted range of keys
+ All buckets are stored in the same file, similar to the SQLite database file format
+ Supports multiple readers and a single writer simultaneously (readers have snapshot isolation)
+ Per-bucket bidirectional iteration using cursors
+ Live defragmentation is supported
+ Allows nested buckets
+ In-memory databases
+ Virtual WAL interface
## Caveats
+ Keys, values, and bucket names are limited to roughly 2 GB in length
+ Each connection is single-threaded, and blocking I/O is used
+ Concurrent usage requires each connection to have its own `DB`
+ Only practical for datasets that can reasonably be stored in a single file
+ Platform must support shared-memory primitives (otherwise, may work in "exclusive locking mode")
## Documentation
Check out the [docs](doc/doc.md).
## Requirements
The library requires the following to compile:
+ CMake version 3.14 or later
+ C++ compiler with support for C++17
+ GCC (>= 7.0)
+ Clang (>= 5.0)
The tests depend on:
+ `@google/googletest` (downloaded with CMake FetchContent)
+ Python 3
## Performance
Performance benchmarks are run in a [fork of LevelDB](https://github.com/andy-byers/leveldb/tree/db_bench_calicodb).
Recent results can be found [here](https://github.com/andy-byers/leveldb/blob/db_bench_calicodb/benchmarks/results.md).
## TODO
1. Get everything code reviewed!
2. Support Windows (write an `Env` implementation)
## Documentation
Check out CalicoDB's [usage and design documents](doc).
Build instructions can be found [here](doc/doc.md#build).
## Contributions
Contributions are welcome!
Check out this repo's issues or the [TODO section](#todo) for a list of things that need to be addressed.