All Projects → lbguilherme → Rethinkdb Lite

lbguilherme / Rethinkdb Lite

Licence: mit
A RethinkDB-compatible database written in Crystal

Programming Languages

crystal
512 projects

Projects that are alternatives of or similar to Rethinkdb Lite

Tidis
Distributed transactional NoSQL database, Redis protocol compatible using tikv as backend
Stars: ✭ 1,182 (+2648.84%)
Mutual labels:  database, rocksdb
Rocksdb Sharp
.net bindings for the rocksdb by facebook
Stars: ✭ 173 (+302.33%)
Mutual labels:  database, rocksdb
Crux
General purpose bitemporal database for SQL, Datalog & graph queries
Stars: ✭ 1,296 (+2913.95%)
Mutual labels:  database, rocksdb
Rust Rocksdb
rust wrapper for rocksdb
Stars: ✭ 815 (+1795.35%)
Mutual labels:  database, rocksdb
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 (+3869.77%)
Mutual labels:  database, rocksdb
Rocker
Erlang/Elixir wrapper for RocksDB
Stars: ✭ 19 (-55.81%)
Mutual labels:  database, rocksdb
Bumblebee
Clever face for ADS
Stars: ✭ 36 (-16.28%)
Mutual labels:  database
Rxrealm
RxSwift extension for RealmSwift's types
Stars: ✭ 1,007 (+2241.86%)
Mutual labels:  database
Sqlz
SQL Query Builder for Go
Stars: ✭ 36 (-16.28%)
Mutual labels:  database
Social Scrapbook
Save your memory into our online scrapbook and share your experience.
Stars: ✭ 35 (-18.6%)
Mutual labels:  database
Active Record
Active Record database abstraction layer
Stars: ✭ 43 (+0%)
Mutual labels:  database
Android Debug Database
A library for debugging android databases and shared preferences - Make Debugging Great Again
Stars: ✭ 7,946 (+18379.07%)
Mutual labels:  database
Play Reactive Slick
This is Play Template with a nice User Interface. If you want to use Play as web framework and Postgres as Database then this demo project can be used as a starting point for your application.
Stars: ✭ 40 (-6.98%)
Mutual labels:  database
Laravel Queue Database Ph4
Laravel Database Queue with Optimistic locking
Stars: ✭ 37 (-13.95%)
Mutual labels:  database
Declarativesql
Attribute-based database access
Stars: ✭ 41 (-4.65%)
Mutual labels:  database
Fieldtop
Finds near-overflow columns in MySQL databases
Stars: ✭ 36 (-16.28%)
Mutual labels:  database
Nano
🍀 Fast, decentralized and git-trackable database.
Stars: ✭ 42 (-2.33%)
Mutual labels:  database
Stanford dbclass
Collection of my solutions to the (infamous) dbclass (2014 version) offered by Stanford.
Stars: ✭ 35 (-18.6%)
Mutual labels:  database
Skyalt
Accessible database and analytics. Organize and learn from data without engineers.
Stars: ✭ 40 (-6.98%)
Mutual labels:  database
Avbook
AV 电影管理系统, avmoo , javbus , javlibrary 爬虫,线上 AV 影片图书馆,AV 磁力链接数据库,Japanese Adult Video Library,Adult Video Magnet Links - Japanese Adult Video Database
Stars: ✭ 8,133 (+18813.95%)
Mutual labels:  database

GitHub Actions Crystal Version

RethinkDB-lite

This is a personal project aiming at reimplementing everything RethinkDB currently does. At the same time, it is also a driver capable of connecting to a database and sending queries.

First use case: Database driver

You can connect to a running RethinkDB instance and send queries. Methods are pretty much equal to the official Ruby driver, for which you can find documentation here: https://rethinkdb.com/api/ruby/. This is not feature complete yet, a lot of functions are missing. Be aware of bugs (please report them).

require "rethinkdb-lite/src/driver/*"
include RethinkDB::DSL

conn = r.connect("localhost")

r.table_create("heros").run(conn)
r.table("heros").insert({name: "Iron Man", power: 17}).run(conn)
r.table("heros").insert({name: "Batman", power: 13}).run(conn)
r.table("heros").insert({name: "Superman", power: 650}).run(conn)
r.table("heros").insert({name: "Hulk", power: 103}).run(conn)

overpower_hero = r.table("heros").filter { |hero| hero["power"] == 650 }["name"][0].run(conn)

pp overpower_hero

Second use case: Local database for your application

This is similar to SQLite. A single-user database is run with a local path where data is stored. This is reimplementing the behavior of RethinkDB, but working as an embeddable library. The goal is to have every query that you would do on the real RethinkDB working here, with similar semantics. This is not feature complete yet, a lot of functions are missing. Be aware of bugs (please report them).

require "rethinkdb-lite/src/driver/*"
include RethinkDB::DSL

# The data will be stored in this directory.
conn = r.local_database("path/to/data")

r.table_create("users").run(conn)
r.table("users").insert({name: "John", username: "john", password: "123"}).run(conn)

Third use case: RethinkDB server

That local database from the second use case can also be served as a full multi-user database, listening for RethinkDB driver connections and also serving the Web UI for administration. It can receive connection from any official or non-official RethinkDB driver from https://rethinkdb.com/docs/install-drivers/.

require "rethinkdb-lite/src/server/*"
require "rethinkdb-lite/src/driver/*"
include RethinkDB::DSL

conn = r.local_database("path/to/data")

RethinkDB::Server::WebUiServer.new(8080, conn).start
RethinkDB::Server::DriverServer.new(28015, conn).start

# http://localhost:8080 will bring the Web UI
# localhost:28015 will be ready for driver connections

sleep

Goals

  • Implement all current features of RethinkDB (all query functions, clustering, changefeed, geoindex, ...)
  • Be fully compatible with RethinkDB's drivers and WebUI
  • Make small improvements along the way (with minimal user impact)
  • Make it fast
  • Add new features (query optimizer? autorebalancing?)

Roadmap

  • Pass successfuly on RethinkDB's spec suite
  • Add some better newer tests
  • Benchmark and improve performance
  • Implement epic features: clustering, changefeeds
  • Implement new features: query optimizer?

Running

Install these dependencies:

  • Crystal for compiling the main code
  • Node for compiling the Web UI
  • Duktape for a embeddable javascript runtime for r.js() (apt install duktape-dev)
  • RocksDB for the storage engine (apt install librocksdb-dev)

Then run:

cd vendor/rethinkdb-webui
npm ci
npm run build
cd ../..
shards
crystal src/main.cr

And open your browser at http://localhost:8080.

Most of the Web UI doesn't work yet, but you can use the tabs Tables and Data Explorer. Try some queries there.

You can also use any client driver to connect from another language, see https://rethinkdb.com/docs/install-drivers/.

For higher read/write throughput enable multithreading. Use the following:

crystal run -Dpreview_mt src/main.cr

Running Tests

You should have a running real empty RethinkDB server for testing. Do not use one with data in it. You can start one with by simply running rethinkdb on the terminal, after installing it.

crystal spec

References

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