GithubHelp home page GithubHelp logo

doytsujin / minidb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hachreak/minidb

0.0 1.0 0.0 43 KB

A minimal in-memory distributed master-less document database

Home Page: https://github.com/hachreak/minidb

License: Other

Makefile 0.62% Erlang 99.38%

minidb's Introduction

minidb

This is a minimal in-memory distributed master-less document database database.

API

Cluster:

  • Auto-cluster: automatically create a cluster specified in the configuration minidb_cluster:join(), or manually make a cluster passing a list of seeds minidb_cluster:make([bootstrap_node1]).
  • Cluster status: minidb_cluster:status()
  • Join a cluster: minidb_cluster:join('bootstrap_node')
  • Leave a cluster: minidb_cluster:leave()
  • Ping a random node: minidb:ping()

CRUD:

  • Create/Update a key: minidb:put(key, value)
  • Patch a value: minidb:patch(key, {subkey1, subvalue1})
  • Read a value: minidb:get(key) or minidb:get(key, default)
  • Query database: minidb:find([..])
  • Get all keys: minidb:keys()
  • Delete a key: minidb:delete
  • Drop everything: minidb:drop()

Query:

The query language is similar to the one used by mongodb:

minidb:find([{"section", {'$eq', "books"}}, {"likes", {'$gt', 100}])

Operators available:

Op. Name Example
'$eq' Equals {"section", {'$eq', "books"}}
'$ne' Not Equals {"section", {'$ne', "books"}}
'$gt' Greater Than {"likes", {'$gt', 100}}
'$gte' Greater or Equals {"likes", {'$gte', 100}}
'$lt' Lower Than {"likes", {'$lt', 100}}
'$lte' Lower or Equals {"likes", {'$lte', 100}}

Note: to get everything: minidb:find([]).

Build

$ rebar3 compile

Run demo

Start the first node:

$ make node1

Start the second node:

$ make node2

After 5 seconds, the second node will automatically connect to the first in a cluster.

To clean all the configuration (cluster informations):

$ make clean

minidb's People

Contributors

hachreak avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.