Commit graph

712 commits

Author SHA1 Message Date
Vedant Roy
acf4f19cd5 Make comment clearer 2021-05-18 16:25:19 -04:00
Vedant Roy
98c6ac876d Implement encode/decode for SyncState 2021-05-18 16:25:19 -04:00
Andrew Jeffery
e2e7483a07
Use elem id from insertion in frontend (#134) 2021-05-18 21:24:55 +01:00
Orion Henry
f47ba3c46a small error slipped through 2021-05-18 10:59:39 -04:00
Vedant Roy
6a4a3c5a00 Don't use ..Default::default() + formatting? 2021-05-18 07:50:35 -07:00
Vedant Roy
1b76115f27 Add unsafe docs + remove extraneous file 2021-05-18 07:50:35 -07:00
Vedant Roy
c274d18528 Add test for sync c bindings 2021-05-18 07:50:35 -07:00
Vedant Roy
305d089180 Add untested C-bindings for sync state 2021-05-18 07:50:35 -07:00
Alex Good
87410e4c8f Add comment explaining why it doesn't work 2021-05-17 19:53:36 +01:00
Alex Good
9bbaf7cbd5 Merge branch 'main' into implement-new-sequence-patch-format 2021-05-17 13:03:57 +01:00
Andrew Jeffery
426ccbc818
Expose event handler id (#132) 2021-05-16 20:16:54 +01:00
Andrew Jeffery
5637956895 Add custom RootDiff type
This ensures that the patch starts with the right diff type statically
and will give an error to js during deserialization.
2021-05-16 14:02:57 +01:00
Andrew Jeffery
30a89cb49d Fix clippy lints 2021-05-16 13:10:28 +01:00
Andrew Jeffery
2e07e93e72 Change patches diffs to be non-optional 2021-05-16 13:01:37 +01:00
Andrew Jeffery
f2025028cf Fix elem_id in get_patch test 2021-05-15 19:38:11 +01:00
Andrew Jeffery
553bf1f8ef Handle overwriting inserts with updates from the same actor 2021-05-15 19:14:16 +01:00
Andrew Jeffery
96eef611d0 Default head to index 0 2021-05-15 18:05:25 +01:00
Andrew Jeffery
7c4858e686 Fix obtaining index for set operation 2021-05-15 18:01:03 +01:00
Alex Good
6eb96f2816 Split patch generation out of OpSet 2021-05-14 21:56:24 +01:00
Andrew Jeffery
641fd11703
Change init to new and add defaults (#130)
Structs should use `new` for the constructor name and implement
`Default` where they can.
2021-05-14 21:35:09 +01:00
Alex Good
df3770477b Move initial patch generation to patches::from_scratch_diff 2021-05-14 21:13:07 +01:00
Alex Good
7d3e0ccc37 Move pending diffs into new patches module 2021-05-14 20:42:04 +01:00
Andrew Jeffery
d82e2ed217
Improve filter_changes for sync (#126)
* Improve filter_changes for sync

This helps to avoid traversing the entire graph when we get a successive
change that we know can't be a predecessor of the heads.

Also filter_changes shouldn't be globally public.
2021-05-14 20:20:27 +01:00
Andrew Jeffery
f6f874439b
Move decoding to a new module and separate errors (#129) 2021-05-14 20:20:05 +01:00
Andrew Jeffery
2aa35bc349
Add derive Arbitrary support behind cargo feature (#124) 2021-05-14 16:38:35 +01:00
Alex Good
3d5590f90a wip 2021-05-13 18:39:05 +01:00
Alex Good
7ccaae92fd Add test for updates inside conflicted list elements 2021-05-12 23:00:03 +01:00
Andrew Jeffery
5713f4263f Update op id 2021-05-12 16:29:24 +01:00
Andrew Jeffery
d36149e3ce Update js hash 2021-05-12 16:16:05 +01:00
Andrew Jeffery
576a2736f6 Sort diffs by actor id 2021-05-12 15:11:14 +01:00
Andrew Jeffery
31e245e3b7 Handle conflicts with multiple updates 2021-05-12 14:29:14 +01:00
Andrew Jeffery
833149d77f Fix returning an operation for increments 2021-05-12 13:42:06 +01:00
Andrew Jeffery
e5f70ddcb6 Allow del in gen_seq_diff 2021-05-11 22:42:04 +01:00
Andrew Jeffery
e2ec827d66 Ensure we execute diffs for nested objects from lists 2021-05-11 20:45:28 +01:00
Andrew Jeffery
4242415f5b Return empty mapdiff when no root object in pending 2021-05-11 17:01:11 +01:00
Andrew Jeffery
94c02f061c Use actual op.id in update 2021-05-11 16:21:02 +01:00
Andrew Jeffery
cf1ad2c5f8 Use proper key for elem_id 2021-05-11 16:13:37 +01:00
Andrew Jeffery
e9cfd205f6 Remove unused drain 2021-05-11 16:13:22 +01:00
Andrew Jeffery
a5dee2867c Add debug to edits struct 2021-05-11 16:13:08 +01:00
Andrew Jeffery
9ace8892f6 Remove unchanged diff
Uses empty edits or props instead.
2021-05-11 12:48:45 +01:00
alexjg
e92188104f
Ensure that ChangeBytes::compressed contains the original compressed bytes (#112)
* Ensure that ChangeBytes::compressed contains the original compressed bytes, fixes #95

* Fix clippy

* Move bytes into decompress check

Co-authored-by: Andrew Jeffery <dev@jeffas.io>
2021-05-11 10:33:12 +01:00
dependabot[bot]
560a1c3381
Bump lodash from 4.17.20 to 4.17.21 in /automerge-backend-wasm (#119)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-11 10:21:33 +01:00
Andrew Jeffery
765c5287d7
Add event handler logic (#116)
* Add event handlers

Remove partialeq from Backend since I'm not sure of its relevance or
correctness anyway and complicates things with the event handlers.

* Add docs and use id

* Remove partialeq

* Add docs for enum variants

* Check index on remove_handler

* Pass functions through rather than making field pub
2021-05-11 10:15:37 +01:00
Andrew Jeffery
6050f39d46 Change patch diffs to start with mapdiff 2021-05-11 09:26:19 +01:00
Andrew Jeffery
a512728649 Fix expansion of multi delete 2021-05-11 08:38:09 +01:00
Andrew Jeffery
4caa9798d6 Don't skip props 2021-05-10 23:43:59 +01:00
Andrew Jeffery
497f554b02 Fix bug in expanded op iterator logic and add tests 2021-05-10 23:25:46 +01:00
Andrew Jeffery
59a24081d2 Switch to expanded_op more 2021-05-10 19:25:43 +01:00
Andrew Jeffery
d794ad4dd5 Update diffedit naming of fields and add comments
This brings the DiffEdit types more in line with the typescript ones and
fixes the names. Also changed to using match guards in the append_edit
function so we can take edit by value.
2021-05-10 13:19:48 +01:00
Andrew Jeffery
9c522cb587 Handle collapsing inserts in edits 2021-05-10 12:27:28 +01:00