Giter VIP home page Giter VIP logo

remi's Introduction

Remi

A simple Clojure web service prototype of the Epochal Time Model described in Rick Hickey's talk "The Language of the system".

The application is a simple RESTful web service that enables the persistence of arbitrary JSON data structures. Riak is used to store values that are treated as immutable, and Zookeeper is used to reference these values.

With each successive "update" (via PUT requests) the system creates a new value in Riak and updates Zookeper to reference it. Zookeeper maintains all references to older values, so over time we can recall all the previous values of an entity and therefore the persistence behaves like real memory as opposed to place-oriented storage.

Usage

Setup

  • Use the settings.clj_example file to create settings.clj with your own configuration
  • Run with lein run server

Creating a value

With cURL we can store some data via: curl -d "{\"test\": \"some data\"}" -H "Content-type: application/json" http://localhost:3000/bucket/clj-test

which responds with {"test":"some data","id":"8c781c84-b77b-4d1b-8d5e-1c50bd552495"}

Retrieving a value

We can then retrieve the value with: curl http://localhost:3000/bucket/clj-test/8c781c84-b77b-4d1b-8d5e-1c50bd552495

which returns {"test":"some data","id":"8c781c84-b77b-4d1b-8d5e-1c50bd552495"}

Updating a value

Note: That we are not really updating a value, simply storing a new value in Riak and updating Zookeeper to point to it.

We send an update request via: curl -d "{\"test\": \"and something else\"}" -X PUT -H "Content-type: application/json" http://localhost:3000/bucket/clj-test/8c781c84-b77b-4d1b-8d5e-1c50bd552495

which returns: {"test":"and something else","id":"8c781c84-b77b-4d1b-8d5e-1c50bd552495"}

Summary

We now have a succession of states in the database which represent the identity of 8c781c84-b77b-4d1b-8d5e-1c50bd552495 (best not to read aloud)

Todo

  • Request path for retrieving all historical values of a reference
  • Hide the concept of "buckets" from the user?

License

Copyright © 2013 FIXME

Distributed under the Eclipse Public License, the same as Clojure.

remi's People

Contributors

gerardc avatar

Watchers

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