All Projects → gfredericks → Quinedb

gfredericks / Quinedb

Licence: epl-1.0
QuineDB is a quine that is also a key-value store.

Programming Languages

shell
77523 projects

Labels

Projects that are alternatives of or similar to Quinedb

Opencypher
Specification of the Cypher property graph query language
Stars: ✭ 534 (-4.81%)
Mutual labels:  database
Entityauditbundle
Audit for Doctrine Entities
Stars: ✭ 546 (-2.67%)
Mutual labels:  database
Jsonbase
A database software completely built as JSON files in backend. A powerful, portable and simple database works on top of JSON files. It is like a database software, currently having basic CRUD operation features. You can use this as a backend for your ReST APIs as well. The software is completely free and opensource. We are coming up with new features and providing more updates. The another beautiful advantage with JSON-base is since it is a NPM module, this fits well in your nodeJs applications eco system. if you want to develop quick prototypes/poc or need of a database with minimal requirements then, JSONBASe is an must option that you can consider. However there is a limitation if you go beyond a million records per table.
Stars: ✭ 552 (-1.6%)
Mutual labels:  database
Bustub
The BusTub Relational Database Management System (Educational)
Stars: ✭ 534 (-4.81%)
Mutual labels:  database
Imposm3
Imposm imports OpenStreetMap data into PostGIS
Stars: ✭ 542 (-3.39%)
Mutual labels:  database
Typeorm
ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.
Stars: ✭ 26,559 (+4634.22%)
Mutual labels:  database
Cosette
Cosette is an automated SQL solver.
Stars: ✭ 533 (-4.99%)
Mutual labels:  database
Yugabyte Db
The high-performance distributed SQL database for global, internet-scale apps.
Stars: ✭ 5,890 (+949.91%)
Mutual labels:  database
Lmdbjava
Lightning Memory Database (LMDB) for Java: a low latency, transactional, sorted, embedded, key-value store
Stars: ✭ 546 (-2.67%)
Mutual labels:  database
Copycat
A novel implementation of the Raft consensus algorithm
Stars: ✭ 551 (-1.78%)
Mutual labels:  database
Nitrite Java
Java embedded nosql document store
Stars: ✭ 538 (-4.1%)
Mutual labels:  database
Go Sqlbuilder
A flexible and powerful SQL string builder library plus a zero-config ORM.
Stars: ✭ 539 (-3.92%)
Mutual labels:  database
Flink Cdc Connectors
Change Data Capture (CDC) Connectors for Apache Flink
Stars: ✭ 546 (-2.67%)
Mutual labels:  database
Kakapo.js
🐦 Next generation mocking framework in Javascript
Stars: ✭ 535 (-4.63%)
Mutual labels:  database
Financedatabase
This is a database of 180.000+ symbols containing Equities, ETFs, Funds, Indices, Futures, Options, Currencies, Cryptocurrencies and Money Markets.
Stars: ✭ 554 (-1.25%)
Mutual labels:  database
Pgaudit
PostgreSQL Audit Extension
Stars: ✭ 532 (-5.17%)
Mutual labels:  database
Couchdb
Seamless multi-master syncing database with an intuitive HTTP/JSON API, designed for reliability
Stars: ✭ 5,166 (+820.86%)
Mutual labels:  database
Otj Pg Embedded
Java embedded PostgreSQL component for testing
Stars: ✭ 559 (-0.36%)
Mutual labels:  database
Gin Boilerplate
The fastest way to deploy a restful api's with Gin Framework with a structured project that defaults to PostgreSQL database and JWT authentication middleware stored in Redis
Stars: ✭ 559 (-0.36%)
Mutual labels:  database
Pickledb
pickleDB is an open source key-value store using Python's json module.
Stars: ✭ 549 (-2.14%)
Mutual labels:  database

QuineDB

Build Status

QuineDB is a quine that is also a key/value store.

If your database can't print its own source code, can you really trust it?

Getting Started

QuineDB consists of the quinedb script in this repository. It is written in Bash and requires Bash 4.

When you run it, the (possibly modified) source code of quinedb is printed to STDOUT, and the results of the specific command run are printed to STDERR. Therefore, each time you run a write operation you must redirect STDOUT to an appropriate place. For consistency, we recommend doing this for all operations. However this can be very tedious to do directly, so a bash function such as the following can be helpful, and the examples that follow will make use of it:

qdb () {
  ./quinedb "[email protected]" > qdb.out 2> qdb.err || return "$?"
  cat qdb.out > quinedb
  cat qdb.err
  rm qdb.err qdb.out
}

API

QuineDB has four commands: get, set, delete, and keys.

set

To set a key to a value, use quinedb set <k> <v>:

$ qdb set foo bar
OK
$ qdb set count 42
OK

get

To get a value, use quinedb get <k>:

$ qdb get foo
bar

keys

To list the keys in the database, use quinedb keys:

$ qdb keys
count
foo

delete

To delete a key, use quinedb delete <k>:

$ qdb delete foo
OK
$ qdb keys
count

Syntax

Keys and values are printed in the syntax of bash strings, which allows keys to print one key on each line unambiguously (even if a key contains a newline) and get to unambiguously print no output for a missing key.

$ qdb set \
  $'this\nkey\nhas\nfour\nlines' \
  $'and the \'value\' has \"quotes\"'
OK

$ qdb set empty ''
OK

$ qdb keys
$'this\nkey\nhas\nfour\nlines'
empty

$ qdb get $'this\nkey\nhas\nfour\nlines'
$'and the \'value\' has \"quotes\"'

$ qdb get empty
$''

$ qdb get missing

Transactions

To group several operations into an atomic transaction you can simply chain operations by redirecting STDOUT to an invocation of /usr/bin/env bash like so:

$ ./quinedb set k1 v1 | \
/usr/bin/env bash -s set k2 v2 | \
/usr/bin/env bash -s set k3 v3 | \
/usr/bin/env bash -s keys > tmp; chmod +x tmp; mv tmp quinedb
OK
OK
OK
k1
k3
k2

FAQ

Why should my database be a quine?

  1. Why shouldn't your database be a quine?
  2. If your data and the database code are not stored in the same place, you risk losing track of one, making the other useless.
  3. You can store various versions of your database, or even fork it, with no extra effort.

How fast does it go?

I was able to insert 100 k/v pairs into an empty database in a mere 10 seconds. The runtime of each operation is (probably) proportional to O(n·log(n)), so it's not too surprising that inserting 1000 k/v pairs took over 11 minutes. If you need the database to be fast, we recommend not putting too much data in it.

Are the keys and values unicode strings or arbitrary binary data?

I'm not sure. How does bash work exactly?

How many concurrent connections can I have?

I'm not sure you've been paying attention.

Can I run a QuineDB cluster?

Well I mean, um.

Contributing

Pull requests are welcome.

Acknowledgments

  • @timgaleckas for reviewing and coming up with the mechanism for transactions

License

Copyright © 2016 Gary Fredericks

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

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].