Commit graph

789 commits

Author SHA1 Message Date
Orion Henry
72bc14d0a2
Merge pull request #442 from AudigoLabs/length-fix
Fixed bug with length not being set in C frontend of automerge-1.0
2022-10-15 13:59:29 -07:00
Brian Gomberg
38e4450d02 Fixed bug with length not being set 2022-09-27 16:00:07 -07:00
Orion Henry
cdb2b52ef7
Merge pull request #272 from jeffa5/gh-pages-docs
Add docs workflow for gh-pages
2022-03-03 14:30:09 -05:00
Andrew Jeffery
63415e3e20 Try fix unused unit lint 2022-03-03 17:51:36 +00:00
Andrew Jeffery
3f74053b52 Add docs workflow 2022-03-03 17:31:26 +00:00
Orion Henry
1c61986d33 clippy and fmt 2022-02-24 15:48:48 -05:00
David Pollak
bde0a6fbf6 Cleaned up some warnings and errors running against Rust 1.58.1 2022-02-24 15:20:48 -05:00
Andrew Jeffery
68491b66a3 Move some backend functions to traversal 2022-02-18 08:47:27 -08:00
Andrew Jeffery
3cf2044a07 Move vector clock implementation to new module 2022-02-18 08:47:27 -08:00
Andrew Jeffery
7991369dfa Add semicolon 2022-02-18 08:47:27 -08:00
Andrew Jeffery
729e6ccbce Document vector clock usage 2022-02-18 08:47:27 -08:00
Andrew Jeffery
d3783b6a94 Sync perf 2022-02-18 08:47:27 -08:00
Andrew Jeffery
907df09b6a Use queue when getting vector clocks to do BFS 2022-02-18 08:47:27 -08:00
Andrew Jeffery
1a8f5c159f Cleanup code 2022-02-18 08:47:27 -08:00
Andrew Jeffery
a654e2b548 Tidy imports 2022-02-18 08:47:27 -08:00
Andrew Jeffery
e57e839022 Just use vector clocks in retain 2022-02-18 08:47:27 -08:00
Andrew Jeffery
7ceee4957e Print length of may_find 2022-02-18 08:47:27 -08:00
Andrew Jeffery
1cd32a295f Use clock in filter_changes 2022-02-18 08:47:27 -08:00
Andrew Jeffery
f5d9d3a105 Add clocks cache 2022-02-18 08:47:27 -08:00
Andrew Jeffery
abef4dac8c Don't clone actor id 2022-02-18 08:47:27 -08:00
Andrew Jeffery
601ba7a50c Use vector clock for slow path 2022-02-18 08:47:27 -08:00
Andrew Jeffery
a76428dfc1 Use vector clock for get_changes
When get_changes has to fall back to get_changes_slow it can be very
slow, having to traverse the entire graph but also suffers from having
to keep track of the seen dependencies in a hashset (which rather
thrashes the memory).

Instead, if we calculate the vector clock for each hash we are given and
take the maximum over those then we can see which changes we need more
easily. In the worst case this still suffers from going through the
entire graph but this could be cached for later use. The worst case is
now when an actor makes a single change right at the start of the
history. In this case we have to go through the entire graph just to
find it and ensure that it is in the closure.
2022-02-18 08:47:27 -08:00
Orion Henry
fa13c58cc7 new yarn.lock 2022-01-28 19:51:41 -05:00
Andrew Jeffery
3c0c407192
Add initial github actions setup (#237)
Add initial github actions setup
2022-01-10 17:18:18 +00:00
Orion Henry
52412ee75a update mocha 2021-12-15 12:26:21 -05:00
alexjg
cf2a5125a1
Fix logic for condensing insert ops (#242)
The logic for condensing multiple inserts was faulty in that it did not
take into account the `insert` flag on the ops that were being
condensed. This led to an issue where multiple set operations on an
object were converted into a multi-insert operation in the patch. This
commit adds a fix and a few tests.
2021-11-15 22:28:00 +00:00
alexjg
e72571962b
Correctly sort actor IDs when encoding changes (#241)
The javascript implementation of automerge sorts actor IDs
lexicographically when encoding changes. We were sorting actor IDs in
the order the appear in the change we're encoding. This meant that the
index that we assigned to operations in the encoded change was different
to that which the javascript implementation assigns, resulting in
mismatched head errors as the hashes we created did not match the
javascript implementation.

This change fixes the issue by sorting actor IDs lexicographically. We
make a pass over the operations in the change before encoding to collect
the actor IDs and sort them. This means we no longer need to pass a
mutable `Vec<ActorId>` to the various encode functions, which cleans
things up a little.

Fixes #240
2021-10-17 11:58:15 +01:00
Alex Good
9a421f1f79
Update interop tests to automerge 1.0.1-preview.5
This resulted in one failing test which was due to the pending_changes
we report for a patch being incorrectly calculated from missing
dependencies. I've added a test for this failure and fixed it, interop
tests now pass.
2021-10-14 13:40:16 +01:00
Alex Good
fcb30c27c9
Fix the -o parameter of automerge export
The last commit added a `-o` parameter to `automerge export` for
consistency with `automerge merge`. This commit makes it possible to
omit this parameter.
2021-10-14 12:24:58 +01:00
alexjg
e682ac62ea
Add a merge command to the CLI (#239)
`merge` loads documents either from a list of path, or from standard
input, merges them and emits the merged document to standard output or a
given path.
2021-10-14 12:00:30 +01:00
Alex Good
d279819bfc Update to rand 0.8 2021-10-11 19:48:33 +01:00
Andrew Jeffery
ba32c07fc4 Fixup apply_local_change doc link 2021-10-10 16:51:56 +01:00
Andrew Jeffery
9baf384e80 Add builder for Automerge to use existing fe and be 2021-10-10 16:51:41 +01:00
Andrew Jeffery
0243b42c0c
Combined frontend and backend interface (#238)
* Add combined frontend and backend interface

This provides a simpler interface to automerge when one doesn't
particularly need to separate things across multiple threads.
2021-10-09 18:06:39 +01:00
Alex Good
830d9c36e9 We add ChangeHash to the exports of automerge
Signed-off-by: Alex Good <alex@memoryandthought.me>
2021-10-09 14:22:26 +01:00
Alex Good
5a26f8fcd1 Add missing licenses 2021-09-23 23:41:51 +01:00
Alex Good
22342bbbc1 fmt 2021-09-20 15:52:10 +01:00
Alex Good
899e4584b2 Re-export errors 2021-09-20 15:39:46 +01:00
Andrew Jeffery
94769e2dae
Sequence tree (#236)
Switch from im_rc to `SequenceTree`
2021-09-14 13:38:15 +01:00
Andrew Jeffery
3c786b26a8
Make apply_local_change return ref to change (#231)
* Make apply_local_change return ref to change

* Remove mut for change

* Document apply_local_changes
2021-07-29 17:41:56 +01:00
Andrew Jeffery
72a79a31d8
Remove default from ActorId (#230)
* Use random as ActorId default

* Remove default for actor

* Use take function on DiffableValue

* Missed the mem::replace
2021-07-29 14:39:30 +01:00
Andrew Jeffery
ce62b25e17
Move Frontend and FrontendState to separate modules (#229) 2021-07-28 17:47:07 +01:00
Andrew Jeffery
8640f98bae
Optimistic state tree (#227)
* Use mutationtracker in frontendstate

This allows us to directly track the modified optimistic state and
avoids us having to clone the state when we receive a non-local patch.

* Split mutation tracker from OptimisticStateTree

* Store diffs not whole patches

* Reset the reconciled_root_state when no in_flight_requests

* Document some functions

* Use .. in struct destructuring

* Update docs
2021-07-22 17:01:14 +01:00
Andrew Jeffery
4ce27ac18b
Use released 1.3.0 of tinyvec (#225) 2021-07-20 15:35:32 +01:00
Andrew Jeffery
f14697cb61
Add size_hint for expanded op iterator (#219) 2021-07-15 11:52:07 +01:00
Andrew Jeffery
be119d67e1
Value proxy (#212)
* Make some bits more visible

* Add basic proxy with map

* Actually expose the Proxies

* Add more proxies and functionality

* Use &str instead of &SmolStr

* Add some derives

* Add derives to RootProxy

* Add value method

* Add general value method to ValueProxy

* Rename *Proxy to *Ref and update modules

* Format

* Fixup Sequence name
2021-07-15 11:51:56 +01:00
Andrew Jeffery
9f554252d0
Use tinyvec for actor id (#179)
* Use tinyvec for actor id

Most of the time users will not be using their own identifiers and so
use random uuids. These can fit nicely on the stack for a speedup.
TinyVec allows us to capture this mostly stack, sometimes heap
behaviour.

* Use git version of tinyvec for arbitrary
2021-07-15 10:18:07 +01:00
Andrew Jeffery
a8d133beb2
Update readme sections mentioning performance branch (#217) 2021-07-13 16:28:08 +01:00
Andrew Jeffery
fa9361f780
Rename Sequence to List (#218) 2021-07-13 16:27:48 +01:00
Andrew Jeffery
01300d42a7
Add is_* and extraction methods to Value and Primitive (#213)
These methods make operating on the values easier in some situations.
2021-07-13 14:07:49 +01:00