Giter Site home page Giter Site logo

ocaml-xi-rope's Introduction

ocaml-xi-rope Build status

The aim of this library is to implement a (immutable) "rope" data structure based on the one used in xi-editor (authored by Raph Levien).

Xi's rope type is a CRDT (based on WOOT) permitting decentralized collaborative editing without vector clocks.

The ropes are currently implemented and exposed using Daniel Bünzli's pvec library.

My hope is to provide a set of libraries on top of this data structure supporting n-way merges of application configuration state for MirageOS unikernels, and a collaborative text editor widget usable with notty and mirage-framebuffer.

Please report any issues or requests for additional features on the issue tracker.

Limitations

This repository is currently available mainly as a proof of concept, and to enable me to receive feedback on the implementation. As such, this is not production-ready:

  • While the data structures are immutable, it is still quite possible to supply invalid data (cyclic graphs, colliding unique IDs, ..)

  • instead of using result types to signal invalid operations, the implementation throws exceptions left and right.

  • While the construction, merging and snapshotting are implemented, my underlying implementation is pretty inefficient and some work on that will be needed to support large operations with reasonable performance.

  • insertion is supported, but my algorithms, and the API, to handle insertions are fairly limited and cumbersome to work with.

  • The test suite is missing.

    • The test suite is missing QuickCheck shrinkers
  • Nice things like Levien's line-wrapping and paging algorithms are not implemented.

Installing the dependencies

Library:

opam pin add -ny pvec https://github.com/dbuenzli/pvec.git
opam install alcotest fmt logs pvec qcheck rresult uchar

Test / demo utils:

opam install notty
dune build
./_build/default/demo/notty_demo.exe
# this will launch a server on 127.0.0.1:7777
# start the program again in another window to have it connect to
# the server. you can now enjoy collaborative editing with
# horribly broken linewrapping where edits from anyone but the server
# gets propagated to the server exclusively. PRs welcome! :-)

Further reading

Below is a list of resources I found helpful and interesting:

ocaml-xi-rope's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.