Irmin is a distributed database that follows the same design principles as Git
OCaml Other
Latest commit 855d361 Jan 3, 2018
samoht Merge pull request #484 from samoht/4.06
Use cohttp 1.0 and support OCaml 4.06
Permalink
Failed to load latest commit information.
doc Fix doc generation after the split into 5 packages Feb 16, 2017
examples Revert the `empty` -> empty ()` change Apr 24, 2017
pkg remove unused META files May 26, 2017
src Use cohttp 1.0 and support OCaml 4.06 Jan 3, 2018
test packaging cleanup Jul 27, 2017
.gitignore Use jbuilder May 11, 2017
.travis.yml Test 4.05 and 4.06 in Travis Jan 3, 2018
CHANGES.md Update CHANGES Jan 3, 2018
LICENSE.md LICENSE.md: add title Aug 30, 2017
Makefile Add a test target in the Makefile Jul 17, 2017
README.md fix example code such that it actually compiles and makes sense Oct 9, 2017
appveyor.yml fix appveyor script Jul 25, 2017
irmin-chunk.opam Update opam self-constraints Nov 22, 2017
irmin-fs.descr Use jbuilder May 11, 2017
irmin-fs.opam Update opam self-constraints Nov 22, 2017
irmin-git.descr Add opam description files Feb 23, 2017
irmin-git.opam Update opam constraints Jan 3, 2018
irmin-http.descr Add opam description files Feb 23, 2017
irmin-http.opam Update opam constraints Jan 3, 2018
irmin-mem.descr Use jbuilder May 11, 2017
irmin-mem.opam Update opam self-constraints Nov 22, 2017
irmin-mirage.descr Add opam description files Feb 23, 2017
irmin-mirage.opam Update opam constraints Jan 3, 2018
irmin-unix.descr Add opam description files Feb 23, 2017
irmin-unix.opam Update opam constraints Jan 3, 2018
irmin.descr Add opam description files Feb 23, 2017
irmin.opam Import updates in opam files from opam-repository Nov 22, 2017
prepare-exe.sh Add a small script to prepare the final .exe on windows Apr 4, 2016

README.md

Irmin -- A distributed database that follows the same design principles as Git

Irmin is a library for persistent stores with built-in snapshot, branching and reverting mechanisms. It is designed to use a large variety of backends. Irmin is written in pure OCaml and does not depend on external C stubs; it aims to run everywhere, from Linux, to browsers and Xen unikernels.

Build Status docs

Description

Irmin is a library to version-control application data. It has the following features:

  • on-disk format various formats are supported, including the Git format: Irmin on-disk repositories can be inspected and modified using the classic Git command-line tools.

  • wire format various formats are supported, including the Git protocol (only in client mode) or a simple JSON-based REST API (client and server).

  • dynamic behaviour Irmin allows the users to define custom merge functions, to use in-memory transactions (to keep track of reads as well as writes) and to define event-driven workflows using a notification mechanism.

These abstractions allow developers to create applications with concurrent behaviors which are both efficient and safe.

Bindings to other languages

Backends

Irmin ships with various backends. It provides the following OCamlfind pacakges:

  • irmin.mem is an in-memory backend.
  • irmin.git uses the Git format to persist data on disk.
  • irmin.fs uses bin_prot to persist data on disk.
  • irmin.http uses JSON over HTTP to speak with an Irmin server.

Other external backends are available as external OPAM packages (use opam install <pkg> to install):

  • irmin-chunk stores raw contents into a well-balanced rope where leafs are chunks of all the same size.
  • irmin-indexdb is a backend for a web browser's IndexedDB store.

Datastructures

  • merge-queues is an implementation of mergeable queues.
  • merge-ropes is an implementation of mergeable ropes.
  • diff-datatypes is a collection of automatic merge functions based on edit scripts. It is fairly generic but contains specific implementation for mergeable trees, stacks and queues.
  • irmin-datatypes is a collection of mergeable datatypes, including LWW registers, queues and sets.

Use-Cases

Here a list of Irmin users:

  • Cuekeeper a version-controlled TODO list in the browser.
  • imaplet, a version-controlled IMAP server and client.
  • jitsu, a DNS server that automatically starts unikernels on demand. The database is persisted with Irmin.
  • Irmin+Xenstore, the Xenstore deamon rewritten to use Irmin to persist its data.
  • irmin-arp, a distributed ARP cache.
  • dog, a synchronisation tool.
  • irminFS, a prototype version-controlled file-system using Fuse.

Further Reading

Getting Started

Install

Irmin is packaged with opam:

opam install irmin-unix # install all the optional depencies

Usage

Irmin comes with a command-line tool called irmin. See irmin --help for further reading. Use either irmin <command> --help or irmin help <command> for more information on a specific command.

To get the full capabilites of Irmin, use the API:

open Lwt.Infix
open Irmin_unix
module Store = Irmin_unix.Git.FS.KV (Irmin.Contents.String)

let config = Irmin_git.config ~bare:true "/tmp/irmin/test"
let info fmt = Irmin_unix.info ~author:"me <me@moi.com>" fmt

let prog =
  Store.Repo.v config >>= Store.master >>= fun t ->
  Store.set t ~info:(info "Updating foo/bar") ["foo"; "bar"] "hi!" >>= fun () ->
  Store.get t ["foo"; "bar"] >>= fun x ->
  Printf.printf "Read: %s\n%!" x;
  Lwt.return_unit

let () = Lwt_main.run prog

To compile the example above, save it to a file called example.ml. Install irmin and git with opam (opam install irmin-unix) and run

$ ocamlfind ocamlopt example.ml -o example -package irmin.unix,lwt.unix -linkpkg
$ ./example
Read: hi!

The examples directory contains more examples. To build them, run

$ ./configure --enable-examples
$ make

Tutorial

Tutorials are available on the wiki.

Issues

To report any issues please use the bugtracker on Github.

Conditions

See the LICENSE file.

Acknowledgements

Development of Irmin was supported in part by the EU FP7 User-Centric Networking project, Grant No. 611001.