Coder Social home page Coder Social logo

patrickbrown-dev / pbdb Goto Github PK

View Code? Open in Web Editor NEW
26.0 2.0 0.0 80 KB

A key/value database inspired by chapter 3 of Designing Data-Intensive Applications by Martin Kleppmann.

License: BSD 3-Clause "New" or "Revised" License

Go 97.98% Dockerfile 2.02%
golang database kv-store kv-database go

pbdb's Introduction

pbdb

Go Reference

Description

pbdb is a key/value database inspired by chapter 3 of Designing Data-Intensive Applications by Martin Kleppmann.

The underlying storage format is very simple: a text file where each line contains a key-value pair, separated by a comma (roughly like a CSV file, ignoring escaping issues). Every call to db_set appends to the end of the file, so if you update a key several times, the old versions of the value are not overwritten โ€” you need to look at the last occurrence of a key in a file to find the latest value [...] (Kleppmann 2017)

It also uses a hash index (like Kleppmann later suggests) to speed up reads.

Installation

Option A: Build and run the provided Dockerfile

docker build -t pbdb:latest .
docker run -p 1728:1728/tcp pbdb:latest

Option B: Compile and run the source code

go build
./pbdb run -d dbfile

Usage

pbdb is an experiment and not meant for production by any sense of the word. However, if you wish to run it here's how:

pbdb run --data DATABASE_FILE --port PORT

This will start the database and bind it to PORT (default: 1728). The database will survive restarts, but will need a moment to reindex its in-memory hash index. You can interact with the database using http.

$ curl localhost:1728/set/foo -d bar
$ curl localhost:1728/get/foo
bar$

Caveats

  • You'll have a bad time if your values have new line characters.
  • There's no authentication. You have been warned.

Works Cited

Kleppmann, Martin. Designing Data-Intensive Applications (Kindle Locations 1934-1937). O'Reilly Media. Kindle Edition.

pbdb's People

Contributors

patrickbrown-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.