package irmin-indexeddb

  1. Overview
  2. Docs
Irmin backend using the web-browser's IndexedDB store

Install

Dune Dependency

Authors

Maintainers

Sources

irmin-indexeddb-v2.0.tbz
sha256=9397a500f5a3f83270921d95f861af0da6174d68516ce3fade725b13428ba41d
sha512=34d24e9eb04cd025e9b83b33a55d0341553f536593a837638e1ff8b75053b9ca5144466b9604a03d1d8bc99f33c34f8ae600d926fbe0b31e74230f78c3337f8c

Description

This is an Irmin backend that stores the data in the web-browser's IndexedDB store. For more information, see http://roscidus.com/blog/blog/2015/06/22/cuekeeper-internals-irmin/

Published: 11 Jan 2020

README

Irmin-IndexedDB

Copyright Thomas Leonard, 2020

This is an Irmin backend that stores the data in the web-browser's IndexedDB store.

Instructions

You'll need to pin a fixed version of irmin-git first:

opam pin add -yn irmin-git.2.0.0 https://github.com/talex5/irmin.git#2.0.0-cuekeeper

Also, until https://github.com/mirage/encore/issues/13 is fixed, you'll need to link with helpers.js to add a missing stub.

You can create stores using either the standard Git format, or using Irmin's own format. For Git format (you'll need to add irmin-git as a dependency), use:

(* A Git-format store. This data can be exported and used with the regular Git
   tools. It can also read data produced by older versions of irmin-indexeddb. *)
module I = Irmin_git.Generic(Irmin_indexeddb.Content_store)(Irmin_indexeddb.Branch_store)
    (Irmin.Contents.String)(Irmin.Path.String_list)(Irmin.Branch.String)

For Irmin format, use:

(* An Irmin-format store. This allows storing custom metadata or using
   different hash functions, but is not compatible with the Git tools or with
   databases created by older versions of irmin-indexeddb. *)
module I = Irmin.Make(Irmin_indexeddb.Content_store)(Irmin_indexeddb.Branch_store)
    (Irmin.Metadata.None)(Irmin.Contents.String)
    (Irmin.Path.String_list)(Irmin.Branch.String)(Irmin.Hash.SHA256)

To create a store, use e.g.

let () =
  let config = Irmin_IDB.config "MyProg" in
  I.v config make_task >>= fun store ->
  ...

The argument to Irmin_IDB.config is the name of the database to use (default "Irmin").

Note: In order to provide notifications (to instances running in other tabs), the backend will also write the current branch head hash into HTML local storage.

Bugs

Please any send questions or comments to the mirage mailing list:

http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

Bugs can be reported on the mailing list or as GitHub issues:

https://github.com/talex5/irmin-indexeddb/issues

Conditions

See LICENSE.md.

Dependencies (10)

  1. lwt
  2. git < "3.0.0"
  3. js_of_ocaml-ppx
  4. js_of_ocaml-lwt
  5. js_of_ocaml >= "3.0"
  6. cstruct >= "1.7.0"
  7. irmin >= "2.0.0" & < "2.3.0"
  8. base64 >= "3.0.0"
  9. dune >= "1.11"
  10. ocaml >= "4.5.0"

Dev Dependencies (1)

  1. irmin-git with-test

Used by

None

Conflicts

None