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
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
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
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
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
Andrew Jeffery
7a08c52dac
Fix clippy ( #118 )
2021-05-07 17:07:41 +01:00
Andrew Jeffery
9fb8666028
Merge pull request #107 from automerge/encode-ref
...
SyncState: encode can take a ref
2021-05-07 12:01:51 +01:00
Andrew Jeffery
708db48fbb
Fixup after rebase
2021-05-05 21:58:18 +01:00
Alex Good
e86aabb6a3
Implement new sequence patch format
2021-05-05 21:52:57 +01:00
Andrew Jeffery
d2898fd0d7
Add clippy lints
2021-05-04 20:54:50 +01:00
Andrew Jeffery
825cc92b51
Delay cloning until the end
2021-05-04 20:15:25 +01:00
Andrew Jeffery
6da6480c9b
Move change into update_history to avoid a clone
2021-05-04 20:04:59 +01:00
Andrew Jeffery
8254ba6231
Change states to use indices into history
...
This moves to storing the changes only in history and everything else
pointing to that. This reduces duplication and so memory usage,
especially when we may have large changes or documents.
2021-05-04 20:00:00 +01:00
Andrew Jeffery
8f6e663d99
SyncState: encode can take a ref
2021-04-27 15:08:17 +01:00
Andrew Jeffery
3a8447c068
Remove automerge bench harness ( #106 )
...
This removes the default wrapper which throws errors with some cli
arguments, e.g. --save-baseline which is nice for being able to compare
versions!
2021-04-27 10:30:07 +01:00
Andrew Jeffery
f18066bb10
Fix formatting ( #105 )
2021-04-26 21:09:11 +01:00
Orion Henry
7252596691
formatting change
2021-04-26 11:06:41 -07:00
Orion Henry
0e08f00c34
remove direct array access
2021-04-26 11:06:41 -07:00
Orion Henry
98537d9b80
get changes fast
2021-04-26 11:06:41 -07:00
Andrew Jeffery
d1934f2286
Add formatting config
2021-04-26 09:42:36 -07:00
Andrew Jeffery
63d09d5c7e
Change count back to isize
2021-04-26 09:40:27 -07:00
Andrew Jeffery
0305acbd49
Change unwrap_or_default to unwrap
...
Better to not silently ignore the error
2021-04-26 09:40:27 -07:00
Andrew Jeffery
94e0fd7e49
encoding: add documentation and use i64 for rledecoder count
2021-04-26 09:40:27 -07:00
Andrew Jeffery
18ce93603a
encodable: Require encode function implementation
2021-04-25 15:19:33 -07:00
Andrew Jeffery
3a8baf7b0a
Filter sent hashes down to only what they haven't seen
...
This means we no longer need to store an unbounded list of hashes while
syncing. This is possible as we know their heads and all changes we send
should be known to us, thus we can look in our history to see whether
they are safely applied at the other end.
2021-04-25 13:40:06 -07:00
Andrew Jeffery
8bb14b73d5
Remove unnecessary conditional
...
We are deduplicating so it shouldn't matter if either is empty.
2021-04-24 14:25:31 -07:00
Andrew Jeffery
8d3096b823
Make sent_hashes a set instead of a vec
...
We don't care about the ordering so we can just store them in a hashset
all of the time, avoiding having to rebuild the hashset each time.
2021-04-24 14:25:31 -07:00