package irmin

  1. Overview
  2. Docs
Irmin, a distributed database that follows the same design principles as Git

Install

Dune Dependency

Authors

Maintainers

Sources

irmin-1.1.0.tbz
sha256=c49cc9039b82aa543beffb23e3ec7d0cfb4ab533f5ae29be5d2e937ddc6693f4
md5=6e59e9288faf0033592ab842539caad4

Description

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.

Published: 27 Apr 2017

README

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.

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
open Irmin_unix
module Store =
  Irmin_git.FS (Irmin.Contents.String)(Irmin.Ref.String)(Irmin.Hash.SHA1)

let config = Irmin_git.config ~root:"/tmp/irmin/test" ~bare:true ()
let prog =
  Store.Repo.create config >>= Store.master task >>= fun t ->
  Store.update (t "Updating foo/bar")  ["foo"; "bar"] "hi!" >>= fun () ->
  Store.read_exn (t "Reading foo/bar") ["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.

Dependencies (14)

  1. hex >= "0.2.0"
  2. re
  3. astring
  4. uri >= "1.3.12"
  5. jsonm >= "1.0.0"
  6. cstruct >= "1.6.0"
  7. logs >= "0.5.0"
  8. lwt >= "2.4.7"
  9. ocamlgraph
  10. fmt >= "0.8.0"
  11. topkg build & >= "0.9.0"
  12. ocamlfind build
  13. ocamlbuild build
  14. ocaml >= "4.03.0" & < "4.06.0"

Dev Dependencies (4)

  1. irmin-watcher with-test & >= "0.2.0"
  2. mtime with-test & < "1.0.0"
  3. git-unix with-test & >= "1.10.0"
  4. alcotest with-test & < "1.0.0"

Used by (8)

  1. datakit >= "0.10.0" & < "0.11.0"
  2. datakit-bridge-local-git >= "0.10.0" & < "0.11.0"
  3. datakit-client-git < "0.12.2"
  4. imaplet-lwt >= "0.1.8" & < "0.1.10"
  5. irmin-git = "1.1.0"
  6. irmin-http < "1.2.0"
  7. irmin-mirage < "1.2.0"
  8. irmin-unix = "1.1.0"

Conflicts (1)

  1. result >= "1.5"
OCaml

Innovation. Community. Security.