A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.
Find a file
Jason Kankiewicz f52b9a13f7 Added Doxygen documentation generation.
Renamed `AMDatatype` to `AmDataType`.
Reorganized the `AmDataType` tags.
Renamed `AMfree()` to `AMdestroy()`.
Renamed `AMclone()` to `AMdup()`.
2022-02-24 14:39:38 -05:00
.github/workflows Add a CI step to run the CMake build of the C bindings for @alexjg. 2022-02-16 13:24:08 -08:00
automerge rework to return a queriable result 2022-02-22 10:21:45 -05:00
automerge-c Added Doxygen documentation generation. 2022-02-24 14:39:38 -05:00
automerge-js fix return types 2022-02-22 10:21:44 -05:00
automerge-wasm fmt 2022-02-22 10:21:45 -05:00
edit-trace v0 wip 2022-02-22 10:21:42 -05:00
examples/cra Update app to include text editor, import Automerge correctly 2022-02-22 10:21:42 -05:00
scripts/ci Add a CI step to run the CMake build of the C bindings for @alexjg. 2022-02-16 13:24:08 -08:00
.envrc Add nix config 2021-12-17 11:48:14 +00:00
.gitignore Add CMake support. 2022-02-16 13:24:08 -08:00
Cargo.toml break the ground 2022-02-03 19:43:36 -05:00
deny.toml Add deny.toml and a script for calling cargo deny 2021-12-24 10:18:16 -08:00
flake.lock flake.lock: Update 2022-02-22 10:21:41 -05:00
flake.nix Change rust flake to use default profile 2022-02-22 10:21:41 -05:00
LICENSE Add deny.toml and a script for calling cargo deny 2021-12-24 10:18:16 -08:00
Makefile Fixup readme and add makefile 2021-12-17 23:37:21 +00:00
README.md Add CMake instructions for @orionz. 2022-02-16 13:24:08 -08:00
TODO.md update todo 2022-01-18 12:45:10 -05:00

Automerge - NEXT

This is pretty much a ground up rewrite of automerge-rs. The objective of this rewrite is to radically simplify the API. The end goal being to produce a library which is easy to work with both in Rust and from FFI.

How?

The current iteration of automerge-rs is complicated to work with because it adopts the frontend/backend split architecture of the JS implementation. This architecture was necessary due to basic operations on the automerge opset being too slow to perform on the UI thread. Recently @orionz has been able to improve the performance to the point where the split is no longer necessary. This means we can adopt a much simpler mutable API.

The architecture is now built around the OpTree. This is a data structure which supports efficiently inserting new operations and realising values of existing operations. Most interactions with the OpTree are in the form of implementations of TreeQuery - a trait which can be used to traverse the optree and producing state of some kind. User facing operations are exposed on an Automerge object, under the covers these operations typically instantiate some TreeQuery and run it over the OpTree.

Status

We have working code which passes all of the tests in the JS test suite. We're now working on writing a bunch more tests and cleaning up the API.

Development

Running CI

The steps CI will run are all defined in ./scripts/ci. Obviously CI will run everything when you submit a PR, but if you want to run everything locally before you push you can run ./scripts/ci/run to run everything.

Running the JS tests

You will need to have node, yarn, rust and wasm-pack installed.

To build and test the rust library:

  $ cd automerge
  $ cargo test

To build and test the wasm library:

  ## setup
  $ cd automerge-wasm
  $ yarn

  ## building or testing
  $ yarn build
  $ yarn test

  ## without this the js library wont automatically use changes
  $ yarn link

  ## cutting a release or doing benchmarking
  $ yarn release
  $ yarn opt ## or set `wasm-opt = false` in Cargo.toml on supported platforms (not arm64 osx)

To test the js library. This is where most of the tests reside.

  ## setup
  $ cd automerge-js
  $ yarn
  $ yarn link "automerge-wasm"

  ## testing
  $ yarn test

And finally, to build and test the C bindings with CMake:

## setup
$ cd automerge-c
$ mkdir -p build
$ cd build
$ cmake -S .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
## building and testing
$ cmake --build .

To add debugging symbols, replace Release with Debug. To build a shared library instead of a static one, replace OFF with ON.

The C bindings can be built and tested on any platform for which CMake is available but the steps for doing so vary across platforms and are too numerous to list here.

Benchmarking

The edit-trace folder has the main code for running the edit trace benchmarking.