All Projects → lucaong → Cubdb

lucaong / Cubdb

Licence: other
Elixir embedded key/value database

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to Cubdb

Gokv
Simple key-value store abstraction and implementations for Go (Redis, Consul, etcd, bbolt, BadgerDB, LevelDB, Memcached, DynamoDB, S3, PostgreSQL, MongoDB, CockroachDB and many more)
Stars: ✭ 314 (+33.62%)
Mutual labels:  database, key-value, key-value-store
Immortaldb
🔩 A relentless key-value store for the browser.
Stars: ✭ 2,962 (+1160.43%)
Mutual labels:  database, key-value, key-value-store
Unqlite
An Embedded NoSQL, Transactional Database Engine
Stars: ✭ 1,583 (+573.62%)
Mutual labels:  database, key-value, embedded
Iowow
The skiplist based persistent key/value storage engine
Stars: ✭ 206 (-12.34%)
Mutual labels:  database, key-value, key-value-store
Cutedb
A slick BTree on disk based key value store implemented in pure Go
Stars: ✭ 67 (-71.49%)
Mutual labels:  database, key-value, key-value-store
Flashdb
An ultra-lightweight database that supports key-value and time series data | 一款支持 KV 数据和时序数据的超轻量级数据库
Stars: ✭ 378 (+60.85%)
Mutual labels:  database, key-value, embedded
Olric
Distributed cache and in-memory key/value data store. It can be used both as an embedded Go library and as a language-independent service.
Stars: ✭ 2,067 (+779.57%)
Mutual labels:  database, key-value, key-value-store
Keyvast
KeyVast - A key value store
Stars: ✭ 33 (-85.96%)
Mutual labels:  database, key-value, key-value-store
Ejdb
🏂 EJDB 2.0 — Embeddable JSON Database engine C library. Simple XPath like query language (JQL). Websockets / Android / iOS / React Native / Flutter / Java / Dart / Node.js bindings. Docker image.
Stars: ✭ 1,187 (+405.11%)
Mutual labels:  database, key-value, embedded
Slowpoke
Low-level key/value store in pure Go.
Stars: ✭ 98 (-58.3%)
Mutual labels:  database, key-value, embedded
Rust Etcd
An etcd client library for Rust.
Stars: ✭ 119 (-49.36%)
Mutual labels:  database, key-value
Gkvdb
[mirror] Go语言开发的基于DRH(Deep-Re-Hash)深度哈希分区算法的高性能高可用Key-Value嵌入式事务数据库。基于纯Go语言实现,具有优异的跨平台性,良好的高可用及文件IO复用设计,高效的底层数据库文件操作性能,支持原子操作、批量操作、事务操作、多表操作、多表事务、随机遍历等特性。
Stars: ✭ 109 (-53.62%)
Mutual labels:  database, key-value
Etcd
Distributed reliable key-value store for the most critical data of a distributed system
Stars: ✭ 38,238 (+16171.49%)
Mutual labels:  database, key-value
Nutsdb
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.
Stars: ✭ 1,827 (+677.45%)
Mutual labels:  database, key-value
Olegdb
Enough works to use this in production
Stars: ✭ 122 (-48.09%)
Mutual labels:  database, key-value-store
Filebase
A Simple but Powerful Flat File Database Storage.
Stars: ✭ 235 (+0%)
Mutual labels:  database, key-value
Arangodb
🥑 ArangoDB is a native multi-model database with flexible data models for documents, graphs, and key-values. Build high performance applications using a convenient SQL-like query language or JavaScript extensions.
Stars: ✭ 11,880 (+4955.32%)
Mutual labels:  database, key-value
Zookeeper
Apache ZooKeeper
Stars: ✭ 10,061 (+4181.28%)
Mutual labels:  database, key-value
Ardb
A redis protocol compatible nosql, it support multiple storage engines as backend like Google's LevelDB, Facebook's RocksDB, OpenLDAP's LMDB, PerconaFT, WiredTiger, ForestDB.
Stars: ✭ 1,707 (+626.38%)
Mutual labels:  database, key-value
Immudb
immudb - world’s fastest immutable database, built on a zero trust model
Stars: ✭ 3,743 (+1492.77%)
Mutual labels:  database, key-value

Build Status Coverage Status Hex Version docs

CubDB is an embedded key-value database written in the Elixir language. It runs locally, it is schema-less, and backed by a single file.

Head to the API reference for usage details, or read the Frequently Asked Questions and the How To section for more information.

Features

  • Both keys and values can be any arbitrary Elixir (or Erlang) term.

  • Simple get, put, and delete operations

  • Arbitrary selection of ranges of entries sorted by key with select

  • Atomic transactions with put_multi, get_and_update_multi, etc.

  • Concurrent read operations, that do not block nor are blocked by writes

  • Unexpected shutdowns won't corrupt the database or break atomicity

  • Manual or automatic compaction to optimize space usage

To ensure consistency, performance, and robustness to data corruption, CubDB database file uses an append-only, immutable B-tree data structure. Entries are never changed in-place, and read operations are performend on immutable snapshots.

Usage

Start CubDB by specifying a directory for its database file (if not existing, it will be created):

{:ok, db} = CubDB.start_link(data_dir: "my/data/directory")

Important: avoid starting multiple CubDB processes on the same data directory. Only one CubDB process should use a specific data directory at any time.

get, put, and delete operations work as you probably expect:

CubDB.put(db, :foo, "some value")
#=> :ok

CubDB.get(db, :foo)
#=> "some value"

CubDB.delete(db, :foo)
#=> :ok

CubDB.get(db, :foo)
#=> nil

Multiple operations can be performed as an atomic transaction with put_multi, delete_multi, and the other [...]_multi functions:

CubDB.put_multi(db, [a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8])
#=> :ok

Range of entries sorted by key are retrieved using select:

CubDB.select(db, min_key: :b, max_key: :e)
#=> {:ok, [b: 2, c: 3, d: 4, e: 5]}

But select can do much more than that. It can apply a pipeline of operations (map, filter, take, drop and more) to the selected entries, it can select the entries in normal or reverse order, and it can reduce the result using an arbitrary function:

# Take the sum of the last 3 even values:
CubDB.select(db,
  # select entries in reverse order
  reverse: true,

  # apply a pipeline of operations to the entries
  pipe: [
    # map each entry discarding the key and keeping only the value
    map: fn {_key, value} -> value end,

    # filter only even integers
    filter: fn value -> is_integer(value) && Integer.is_even(value) end,

    # take the first 3 values
    take: 3
  ],

  # reduce the result to a sum
  reduce: fn n, sum -> sum + n end
)
#=> {:ok, 18}

For more details, read the API documentation.

Installation

CubDB can be installed by adding cubdb to your list of dependencies in mix.exs:

def deps do
  [{:cubdb, "~> 1.0.0-rc.8"}]
end

Acknowledgement

The file data structure used by CubDB is inspired by CouchDB. A big thanks goes to the CouchDB maintainers for the readable codebase and extensive documentation.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].