Giter Club home page Giter Club logo

irmin-indexeddb's Introduction

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 mirage/encore#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.

irmin-indexeddb's People

Contributors

talex5 avatar kit-ty-kate 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.