Commit graph

385 commits

Author SHA1 Message Date
Andrew Jeffery
6b424d6e97 Take ownership of have 2021-04-24 14:25:31 -07:00
Andrew Jeffery
220580506d Performance updates
Where we do lots of contains checks we should use hashsets rather than
linear scan through a Vec.

Also tried to minimise some copying.
2021-04-24 14:25:31 -07:00
Andrew Jeffery
f8df532d25 Don't have an old_sync_state, just a sync_state 2021-04-24 14:25:31 -07:00
Andrew Jeffery
0655f7ade6 Remove unused log macro 2021-04-24 14:25:31 -07:00
Andrew Jeffery
7c3f52f2e3 Fix need request when head is a false positive 2021-04-24 14:25:31 -07:00
Andrew Jeffery
62f6c6d288 Fix updating sharedHeads when a subset of changes is sent 2021-04-24 14:25:31 -07:00
Andrew Jeffery
6b6135d108 Require vec rather than slice 2021-04-24 14:25:31 -07:00
Andrew Jeffery
85f53685e2 Move to binary representation of changes in api 2021-04-24 14:25:31 -07:00
Andrew Jeffery
7d13091393 Fix bug in get_missing_deps 2021-04-24 14:25:31 -07:00
Andrew Jeffery
68ddb2504e Improve js interop 2021-04-24 14:25:31 -07:00
Andrew Jeffery
e1bdf34471 More borrowing 2021-04-24 14:25:31 -07:00
Andrew Jeffery
00dcd531c1 Use more references 2021-04-24 14:25:31 -07:00
Andrew Jeffery
3fd548cbe1 Use nicer syntax for repeat 2021-04-24 14:25:31 -07:00
Andrew Jeffery
7573c58521 Implement encodable for slice of change hashes 2021-04-24 14:25:31 -07:00
Andrew Jeffery
69bbd8c64d Remove clone 2021-04-24 14:25:31 -07:00
Andrew Jeffery
469b40e371 Remove unnecessary brackets 2021-04-24 14:25:31 -07:00
Andrew Jeffery
34ede85699 Inline probe as usize 2021-04-24 14:25:31 -07:00
Andrew Jeffery
4dd2d42629 Use builtin function to build u32 from bytes 2021-04-24 14:25:31 -07:00
Andrew Jeffery
9cd146a464 Advance heads only needs slice 2021-04-24 14:25:31 -07:00
Andrew Jeffery
8b4632ae07 Use SyncHave::default 2021-04-24 14:25:31 -07:00
Andrew Jeffery
c5d3572670 Remove unwraps in sync 2021-04-24 14:25:31 -07:00
Andrew Jeffery
4b7bbe6710 Rename peer to sync 2021-04-24 14:25:31 -07:00
Andrew Jeffery
cd56799e1c Move all to sync 2021-04-24 14:25:31 -07:00
Andrew Jeffery
766b5621d4 Add more sync work 2021-04-24 14:25:31 -07:00
Andrew Jeffery
3eeb825138 Initial sync work 2021-04-24 14:25:31 -07:00
Andrew Jeffery
137e6d2808 Fix clippy lints 2021-04-07 08:07:53 -07:00
Andrew Jeffery
342504714a Format 2021-04-07 08:07:53 -07:00
Martin Kleppmann
38214ca21e
Merge pull request #65 from automerge/implement-compression
Implement compression
2021-04-02 17:47:39 +01:00
Martin Kleppmann
f63fbe6156 Fix release build 2021-04-02 17:40:52 +01:00
Gregory
f6b3964733 backend: remove unecessary draining of changes to apply. 2021-04-01 09:19:32 -07:00
Andrew Jeffery
d17554dfc4 Remove rc on backend 2021-03-31 08:59:38 -07:00
Andrew Jeffery
02e1a6b6cc Simplify if statement to remove unreachable case
If `op_by_id` contains `succ` then we can get the index straight away,
else we can do the original work. This means we don't need an `else`
case for a third situation as in reality there isn't one.
2021-03-30 09:01:03 -07:00
Andrew Jeffery
3f5a781c71
Simplify while stack not empty (#68) 2021-03-28 21:28:37 +01:00
Alex Good
82cf04ae49 Implement compression 2021-03-27 16:52:43 +00:00
Andrew Jeffery
1e36b62272
Check the checksum in the document on decoding (#62) 2021-03-26 13:59:03 +00:00
Andrew Jeffery
921e9859b2
Fix issue in RleDecoder with null runs (#63)
* Add test to check save and load works on failing input

We loop 100 times due to it being a flaky test, likely due to an
iteration order issue in hashmaps.

* Update printing diff of changes

* Add new case for save then load

* Add another failing test case for save_load

* Update test case

* Update test case to not use empty strings in keys

* Specify to decode into usize in rle decoder

The `decoder.read` call was previously inferring to use isize since the
`self.count` variable is that type. This meant that for a list of null
values >= 64 in length it would read it as negative and so enter an
infinite loop of reading nulls, even if there were other values to read.

This changes the read to use usize but introduces the issue of usize
potentially being bigger than isize. This should be very unlikely for
what it is currently used for though so I'll defer this to later work.

* Add a test case to check the repeated nulls issue in rle

* Update tests

* Specify reading rle len as i64 instead of isize
2021-03-26 13:57:08 +00:00
Alex Good
c103b0638e Ritual abasement at the altar of clippy 2021-03-02 19:35:00 +00:00
Alex Good
4f4674a4a1 Implement cursors in frontend 2021-03-02 16:07:52 +00:00
Alex Good
93d45c381d Run rustfmt 2021-02-15 15:04:05 +00:00
Alex Good
33328796cd Remove mutable reference to actors in OpSet::finalize_diffs 2021-02-12 12:03:10 -05:00
Alex Good
08f324f7e6 Merge ref encoding/decoding and value encoding/decoding 2021-02-12 12:03:10 -05:00
Alex Good
26dfc7ea40 Implement cursor logic in backend 2021-02-12 12:03:10 -05:00
Alex Good
2d31952d77 Implement encoding and decoding of cursor operations 2021-02-12 12:03:10 -05:00
Orion Henry
ef38e6d7da getting some WASM errors trying to access crypto in the browser - switching to SmallRng with a 0 seed for now - deterministic distribution of nodes in the skip list should be fine 2021-02-12 11:49:06 -05:00
Matt Ho
0c44edd919
fixed typos (#43) 2021-02-01 10:57:11 +00:00
Alex Good
a28ae6edb6 Fix dependency encoding in document format 2021-01-31 15:59:51 +00:00
Orion Henry
db2d540cae zero length error 2021-01-29 17:59:57 -05:00
Orion Henry
c135b02a48 full document compression 2021-01-29 17:55:59 -05:00
Alex Good
ae4b9f8f94 Add some benchmarks and make some performance related tweaks 2021-01-25 13:49:38 +00:00
Orion Henry
82deb8a517 fix succ/pred bugs on doc uncompress 2021-01-22 15:32:36 -05:00
Orion Henry
9a90a8f84c add full document decompression 2021-01-22 13:32:50 -05:00
Alex Good
c45d055ce3 Fix clippy 2021-01-16 17:55:30 +00:00
Alex Good
497372db99 Immutable frontend rewrite 2021-01-16 17:40:47 +00:00
Orion Henry
4f61f7da08 simplified encoding code - 1 less copy 2021-01-14 15:23:42 -05:00
Orion Henry
cd6d83ef6d removed an unnecessarry round trip from the change encoder 2021-01-14 14:51:54 -05:00
Alex Good
7cd1a059f5 Add proptest for serialization 2021-01-14 12:30:25 -05:00
Alex Good
3c4d64c8a0 Add extra_bytes 2021-01-14 12:30:25 -05:00
Alex Good
3187afcc51 Use more expressive Operation structure 2021-01-14 12:30:25 -05:00
Alex Good
ce38f5360b Move automerge_backend::UnencodedChange -> automerge_protocol::UncompressedChange 2021-01-14 12:30:25 -05:00
Orion Henry
0b469640d4 update format-tweaks to serialize properly 2021-01-12 14:45:32 -05:00
Martin Kleppmann
4f9e07a29d Allow extra bytes at the end of a change
Corresponding to automerge/automerge@7f2e9f4897
2021-01-12 14:45:32 -05:00
Martin Kleppmann
1350b3e4be Move index of columns ahead of the column data
Corresponding to automerge/automerge@d7f97c5387
2021-01-12 14:45:32 -05:00
Martin Kleppmann
fae835343f Require strictly monotonically increasing column IDs 2021-01-12 14:45:32 -05:00
Martin Kleppmann
13b3faf921 Move deps closer to the start of an encoded change
Corresponding to automerge/automerge@7d9adb4807
2021-01-12 14:45:32 -05:00
Orion Henry
83145b82c4 add getHeads() and new deps functionality 2021-01-01 17:39:44 -05:00
Orion Henry
f3049202a7 update api to localChange 2020-12-30 15:27:07 -05:00
Orion Henry
b8d71f3b53 remove undo/redo 2020-12-17 19:13:05 -05:00
Orion Henry
939ccf38aa adding ack function 2020-11-12 11:03:44 -05:00
Orion Henry
1d126dd263 faster max_op calc 2020-11-10 12:25:07 -05:00
Peter van Hardenberg
0a5e39b5fa wip 2020-11-09 15:30:31 -08:00
Orion Henry
d5b49316e7 wip 2020-11-09 18:11:49 -05:00
Orion Henry
d8d24e23a5 remove extra clone 2020-11-09 14:23:24 -05:00
Orion Henry
d03abd7457 fmt 2020-11-09 09:50:27 -05:00
Orion Henry
c2768c5ebc refactor process_request to feed the ops in one at a time removing the
dobule list management ops
2020-11-09 09:48:45 -05:00
Orion Henry
39add00bf9 fxbuildhasher 2020-11-09 09:48:45 -05:00
Orion Henry
26a5d05fe2 copy2 changes 2020-11-09 09:48:45 -05:00
Orion Henry
783f615a23 update to use new format for encoding key=_head 2020-09-08 16:53:07 -04:00
Orion Henry
fb3b56112c update binary encoding for op actions to match js implementation 2020-09-08 16:29:24 -04:00
Orion Henry
ce75f5e29e add a deserializer for message 2020-06-05 17:48:51 -04:00
Orion Henry
fbc70ba0e3 UnencodedChange.message is a required field according to typescript - default to emptystring 2020-06-05 17:07:33 -04:00
Alex Good
80409879e0 More clippy shenanigans 2020-06-04 14:51:24 +01:00
Alex Good
7585a9d7a1 Run clippy on nightly 2020-06-04 10:30:27 +01:00
Alex Good
2cf2835e76 Make Patch::clock keys ActorID rather than String 2020-05-30 01:44:00 +01:00
Alex Good
62345c2b5f Make Patch::actor an ActorID, not a string 2020-05-30 01:24:26 +01:00
Alex Good
a36a364443 Rename automerge_protocol::Value -> ScalarValue 2020-05-29 21:04:29 +01:00
Alex Good
b7527c28eb Stop child IDs which are valid object IDs raising MissingObjectError 2020-05-25 19:24:45 +01:00
Alex Good
baaebef6d1 Merge branch 'master' into two-level-objtype 2020-05-25 18:47:46 +01:00
Orion Henry
ab71d01487 internal types impl COPY 2020-05-25 09:43:28 -04:00
Alex Good
2443cdf860 Remove objtype wrapper for diffs 2020-05-24 11:06:23 +01:00
Alex Good
40c8f8f9b3 Move ObjType to two level hierarchy 2020-05-24 10:22:18 +01:00
Orion Henry
cbfac9a7b2 clearly show when using external types via amp:: 2020-05-23 12:38:31 -04:00
Orion Henry
a8cb2d805b opid should have an actor not a string 2020-05-23 12:15:53 -04:00
Orion Henry
48dfd6f29a ActorID is now bytes 2020-05-22 19:00:39 -04:00
Orion Henry
87b44cf977 ChangeRequest->Request 2020-05-22 16:11:26 -04:00
Orion Henry
c6ec8515af move OpType and Operation back to Backend 2020-05-22 15:54:14 -04:00
Orion Henry
e9c03ccdaa BinChange is now Change 2020-05-22 15:16:42 -04:00
Orion Henry
a6f1499b2f Change -> UnencodedChange 2020-05-22 15:10:19 -04:00
Orion Henry
92d357efe7 break out change - do some cleanup 2020-05-22 14:57:51 -04:00
Orion Henry
89a1ed46f7 move change back to the backend repo 2020-05-22 13:54:02 -04:00
Orion Henry
ad1b1490d8 fmt 2020-05-21 19:05:57 -04:00
Orion Henry
2d31ed09cc canonical BinChange wip 2020-05-21 18:53:07 -04:00
Orion Henry
6654bb2fed ideas file for cli 2020-05-18 13:41:29 -04:00
Alex Good
0e5ce40cff Fix tests 2020-05-16 02:20:52 +01:00
Alex Good
9bb374b492 Run rustfmt 2020-05-14 01:05:01 +01:00
Alex Good
f8fe19ef08 run clippy 2020-05-14 00:54:06 +01:00
Orion Henry
df3f4f2eba c interface v2 2020-05-13 15:37:46 -04:00
Orion Henry
587ee83187 update readme 2020-05-13 12:13:42 -04:00
Orion Henry
50655c3b82 insert field in undo_ops 2020-05-13 11:47:10 -04:00
Orion Henry
200233c9a0 resolve time to second 2020-05-13 11:46:25 -04:00
Alex Good
f91aa3375b Remove From<&[u8]> for ChangeHash and add TryFrom<&[u8]> 2020-05-10 14:32:13 +01:00
Alex Good
49f69d741a Move ChangeHash into protocol/lib.rs and rename new -> zero 2020-05-10 14:16:48 +01:00
Alex Good
1e6038c3d7 Change ActorID::to_string -> ActorID::to_hex_string to avoid clashes with Display 2020-05-10 14:06:55 +01:00
Alex Good
1839348109 Remove pub export automerge_protocol:{..} from automerge-backend 2020-05-10 14:00:38 +01:00
Alex Good
8e8bee7fa1 Move Patch,Diff etc 2020-05-10 13:57:51 +01:00
Alex Good
f910845def Move Operation 2020-05-10 13:42:23 +01:00
Alex Good
21f3bec8ba Move Operation 2020-05-10 13:35:33 +01:00
Alex Good
45346d9617 Move Operation::{generate_redos, can_merge, and merge} to to backend.rs 2020-05-10 13:29:18 +01:00
Alex Good
4bd3f912c4 Move OpType 2020-05-10 13:17:46 +01:00
Alex Good
12c3ade5ab Move OpRequest, ReqOpType, and RequestKey 2020-05-10 13:12:30 +01:00
Alex Good
873c9791a1 Move resolve_key to backend.rs 2020-05-10 12:59:57 +01:00
Alex Good
fdc044d284 Move DataType and Value 2020-05-10 12:50:57 +01:00
Alex Good
7ee984a80d Move ElementID and Key 2020-05-10 02:03:16 +01:00
Alex Good
d37617b9a1 Move object ID 2020-05-10 01:46:43 +01:00
Alex Good
de0b05540e Move opid 2020-05-10 01:37:40 +01:00
Alex Good
2e28e2c01e Move ObjType 2020-05-10 01:22:04 +01:00
Alex Good
a8c1fb7ba1 Move ChangeHash to protocol crate 2020-05-10 01:08:04 +01:00
Alex Good
7b8a0ec6c9 Move ActorID 2020-05-09 20:03:45 +01:00
Orion Henry
c45351b121 first cut of the C api 2020-05-07 07:57:34 -07:00
Orion Henry
c6b6d59aa1 bugfix in RLE encode/decode 2020-05-06 10:31:50 -07:00
Orion Henry
bddccbe8fd tests passing for the new deps/hash api 2020-05-05 10:34:18 -07:00
Orion Henry
eebcee91dc patch refactor 2020-05-02 20:09:04 -07:00
Orion Henry
a5b0492c36 key/value/diff refactor 2020-04-29 14:49:53 -07:00
Orion Henry
bb881a373d added all the number types 2020-04-27 18:52:45 -07:00
Orion Henry
2c599d49d6 get tests working again 2020-04-27 14:22:04 -07:00
Orion Henry
74b9ecbcfe fmt 2020-04-27 10:53:18 -07:00
Orion Henry
c7874cc849 encoding in - tests passing 2020-04-27 09:18:48 -07:00
Orion Henry
ba44d3a717 set_stdio 2020-04-21 20:15:56 -07:00
Orion Henry
f58e2ffb4f clean up decoder trait 2020-04-21 17:32:10 -07:00
Orion Henry
e601f8c7d1 light cleanup 2020-04-21 13:20:25 -07:00
Orion Henry
fa125e94c5 clean up js errors 2020-04-21 13:08:00 -07:00
Orion Henry
eaa023e219 now taking arrays of binary changes as intended 2020-04-21 11:58:07 -07:00
Orion Henry
d855ab9283 decode binary changes 2020-04-21 10:54:25 -07:00
Orion Henry
13e8e01a79 use dynamic key resolver 2020-04-18 08:05:05 -07:00
Orion Henry
dbbf53cc55 reduce cloning with versions 2020-04-17 15:06:05 -07:00
Orion Henry
4f11bb8baa lots of little cleanup and micro ops in skip list 2020-04-17 10:06:10 -07:00
Orion Henry
6c70182ecd light cleanup 2020-04-17 08:50:24 -07:00
Orion Henry
bef7a9d4cc fix tests 2020-04-17 08:26:47 -07:00
Orion Henry
b2a2394647 orderedmap to orderedset 2020-04-17 08:20:01 -07:00
Orion Henry
586a7e179e performance experiment with ord deltas 2020-04-17 07:50:23 -07:00
Orion Henry
fe38f41569 integrate skiplist into backend 2020-04-16 06:07:40 -07:00