All Projects → naqvijafar91 → Cutedb

naqvijafar91 / Cutedb

A slick BTree on disk based key value store implemented in pure Go

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Cutedb

Xodus
Transactional schema-less embedded database used by JetBrains YouTrack and JetBrains Hub.
Stars: ✭ 864 (+1189.55%)
Mutual labels:  database, key-value, embedded-database
Lmdbjava
Lightning Memory Database (LMDB) for Java: a low latency, transactional, sorted, embedded, key-value store
Stars: ✭ 546 (+714.93%)
Mutual labels:  database, key-value, embedded-database
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 (+368.66%)
Mutual labels:  database, key-value, key-value-store
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 (+2985.07%)
Mutual labels:  database, key-value, key-value-store
Cubdb
Elixir embedded key/value database
Stars: ✭ 235 (+250.75%)
Mutual labels:  database, key-value, key-value-store
Iowow
The skiplist based persistent key/value storage engine
Stars: ✭ 206 (+207.46%)
Mutual labels:  database, key-value, key-value-store
Cog
A Persistent Embedded Graph Database for Python
Stars: ✭ 90 (+34.33%)
Mutual labels:  database, key-value, embedded-database
Immortaldb
🔩 A relentless key-value store for the browser.
Stars: ✭ 2,962 (+4320.9%)
Mutual labels:  database, key-value, key-value-store
Keyvast
KeyVast - A key value store
Stars: ✭ 33 (-50.75%)
Mutual labels:  database, key-value, key-value-store
Flashdb
An ultra-lightweight database that supports key-value and time series data | 一款支持 KV 数据和时序数据的超轻量级数据库
Stars: ✭ 378 (+464.18%)
Mutual labels:  database, key-value
Stormdb
🌩️ StormDB is a tiny, lightweight, 0 dependency, easy-to-use JSON-based database for NodeJS, the browser or Electron.
Stars: ✭ 406 (+505.97%)
Mutual labels:  database, embedded-database
Nitrite Java
Java embedded nosql document store
Stars: ✭ 538 (+702.99%)
Mutual labels:  database, embedded-database
Datalevin
A simple, fast and durable Datalog database
Stars: ✭ 360 (+437.31%)
Mutual labels:  database, key-value-store
Halodb
A fast, log structured key-value store.
Stars: ✭ 370 (+452.24%)
Mutual labels:  key-value-store, embedded-database
Redislite
Redis in a python module.
Stars: ✭ 464 (+592.54%)
Mutual labels:  database, key-value
Bitnami Docker Redis
Bitnami Redis Docker Image
Stars: ✭ 317 (+373.13%)
Mutual labels:  database, key-value
Pickledb
pickleDB is an open source key-value store using Python's json module.
Stars: ✭ 549 (+719.4%)
Mutual labels:  database, key-value
Laravel Options
Global key-value store in the database
Stars: ✭ 626 (+834.33%)
Mutual labels:  database, key-value
Genji
Document-oriented, embedded SQL database
Stars: ✭ 636 (+849.25%)
Mutual labels:  database, embedded-database
Pogreb
Embedded key-value store for read-heavy workloads written in Go
Stars: ✭ 708 (+956.72%)
Mutual labels:  key-value, key-value-store

cuteDB

The purpose of this project is to understand how a production ready key value store works.

Contributions

All contributors are welcome, lets spread and grow the knowledge about databases by building them.

Steps to Run

mkdir db
go test

It can be used as a library in any go project.

BTree

In computer science, a B-tree is a self-balancing tree data structure that maintains sorted data and allows searches, sequential access, insertions, and deletions in logarithmic time. The B-tree is a generalization of a binary search tree in that a node can have more than two children.[1] Unlike self-balancing binary search trees, the B-tree is well suited for storage systems that read and write relatively large blocks of data, such as discs. It is commonly used in databases and file systems.

Insertions and deletions

If the database does not change, then compiling the index is simple to do, and the index need never be changed. If there are changes, then managing the database and its index becomes more complicated.

Deleting records from a database is relatively easy. The index can stay the same, and the record can just be marked as deleted. The database remains in sorted order. If there are a large number of deletions, then searching and storage become less efficient.

Insertions can be very slow in a sorted sequential file because room for the inserted record must be made. Inserting a record before the first record requires shifting all of the records down one. Such an operation is just too expensive to be practical. One solution is to leave some spaces. Instead of densely packing all the records in a block, the block can have some free space to allow for subsequent insertions. Those spaces would be marked as if they were "deleted" records.

Both insertions and deletions are fast as long as space is available on a block. If an insertion won't fit on the block, then some free space on some nearby block must be found and the auxiliary indices adjusted. The hope is that enough space is available nearby, such that a lot of blocks do not need to be reorganized. Alternatively, some out-of-sequence disk blocks may be used.

Advantages of B-tree usage for databases

The B-tree uses all of the ideas described above. In particular, a B-tree:

  • keeps keys in sorted order for sequential traversing
  • uses a hierarchical index to minimize the number of disk reads
  • uses partially full blocks to speed insertions and deletions
  • keeps the index balanced with a recursive algorithm
  • In addition, a B-tree minimizes waste by making sure the interior nodes are at least half full. A B-tree can handle an arbitrary number of insertions and deletions.

Limitations of cuteDB

  • Currently it can only be used via a single goroutine
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].