/ariaDB

Key Value Datastore in Haskell

Primary LanguageHaskellBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

ariaDB Build Status

ariaDB is a persistent key-value store written in Haskell. This work is done as a project in Functional Programming course.

Team members

Features

  • Key-Value store as a service exposing REST API
  • Client library (for Haskell) to interact with the API
  • Simple interface : get, put and delete
  • B+ Tree indexing for fast access
  • Caching layer to enhance look up of frequently accessed Key-Value pairs
  • Type Safety (entire code in Haskell)
  • Stores object of any type
  • Concurrent access to the store (Warp)

Performance

Read Write Performance

Usage (Haskell)

import AriaDB

data Person = Person {
    firstName :: String,
    lastName  :: String
} deriving (Show, Read, Eq)

foo = Person "John" "Doe"

main = do
    let testKey = "k1"
    put testKey foo

    bar <- get testKey
    case bar of
        Just v  -> print (v::Person) -- Type Assigned
        Nothing -> print "Nothing"

    baz <- get testKey
    case baz of
        Just v  -> print $ v == foo -- Type Inferred
        Nothing -> print "Value not found"

    delete testKey
    qux <- get testKey
    case qux of
        Just v  -> print (v::Person) -- Type Assigned
        Nothing -> print "Nothing"

Build

To build and run AriaDB service (from project root):

  $ cabal run

Test

	$ cabal run &
	$ cd src/Test
	$ runhaskell -i../Library GetPutDelete.hs

Benchmarking

In order to benchmark, comment the non-relevant parts in src/Test/Benchmark.hs

    $ ghc -O3 --make -isrc/Service src/Test/Benchmark.hs
    $ ./src/Test/Benchmark