Coder Social home page Coder Social logo

fridge's Introduction

Fridge

Fridge is an immutable key-value store. It usually stores values as files on disk, but the storage layer can be swapped out for e.g. a relational database or an in-memory store.

Development

You'll need Ruby 2.7.1 installed via rbenv.

One-time setup (the standard Ruby stuff):

gem install bundler
bundle

To run the tests:

make

To run the development server:

make run

To run just the unit tests:

make unit

Revisions

A Fridge database is versioned. Any change to a value creates a new, incrementing revision number, which is returned from the API call.

You can ask for the value corresponding to a key as of a particular revision. Details of the API are below.

HTTP API

Setting a key-value pair

PUT /values/foo HTTP/1.1
Content-Type: text/plain

Hello, world!

Response:

{
  "revision": {
    "id": 1
  },
  "timestamp": "2020-01-01 17:45.678Z"
}

Getting a key

GET /values/foo HTTP/1.1

Response:

Hello, world!

Getting the value of a key at a previous revision

GET /values/foo?revision=1

Response:

Hello, world!

Getting the value of a key at a revision when it did not exist

GET /values/foo?revision=0

Response:

404 Not Found

Getting the value of a key at a timestamp

GET /values/foo?time=2020-01-01

Getting the revision history

GET /revisions?limit=50&mostRecent=100

Filtering by date:

GET /revisions?limit=50&before=2020-01-01

Response:

{
  "revisions": [
    {
      "id": 1,
      "timestamp": "2020-01-01 17:45:01.789Z",
      "change": "create",
      "key": "foo"
    }
  ]
}

Pruning old revisions

DELETE /revisions/10

This deletes revision 10 and every earlier revision.

fridge's People

Contributors

benchristel avatar dependabot[bot] avatar

Stargazers

Wilson E. Husin avatar

Watchers

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