GithubHelp home page GithubHelp logo

siderdb's Introduction

SiderDB

An in-memory, key-value database that supports transactions

How to Run

SiderDB requires Python 3.4.3. It is a command line program. To start the database command line: python src/database.py

Transactions

The database runs all commands and changes its state permanantely even when there is an open transaction. When the database runs a command, it supports transactions by creating and saving "undo" commands that undo the current command to a transaction block.

A transaction block represents a transaction. Transaction blocks are kept in a stack.

On rollback, the database pops a transaction block off the stack and runs the undo commands of that block.

On commit, the database removes all the transaction blocks from the stack.

Command Syntax

Commands and arguments are split by spaces. Commands will not run without the correct number of arguments.

Keys and values can be any valid string of non-whitespace characters.

Commands do not support quotes. The command SET tomato "fruit" sets tomato to the value "fruit" which incudes the quotes. The command SET "jones " sets "jones to the value ".

Regular Commands

  • SET key value - Set the variable key to value. Overwrites key if it already exists.
  • GET key - Print the value of the variable key. Prints NULL if key is not in the database.
  • NUMEQUALTO value - Print the number of variables that are set to the specified value.
  • UNSET key - Delete the variable key if it exists.
  • END - End the program.

Transaction Commands

  • BEGIN - Create a new transaction. Transactions can be nested.
  • ROLLBACK - Undo the changes of the most recently created transaction and close the transaction. Prints NO TRANSACTION if there are no open transactions.
  • COMMIT - Commits all open transactions and closes them. Prints NO TRANSACTION if there are no open transactions.

siderdb's People

Contributors

aehuynh avatar

Watchers

James Cloos avatar  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.