Commit graph

160 commits

Author SHA1 Message Date
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
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
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
d1934f2286 Add formatting config 2021-04-26 09:42:36 -07:00
Andrew Jeffery
6cd2a5f6e4 Cleanup wasm lib and make SyncState somewhat opaque to js
This introduces a JsSyncState struct to give js as a handle to a real
syncstate which we want to keep in the wasm memory region to avoid lots
of serde stuff.

Some methods (getters and setters) are needed on this struct as the js
tests look inside but these are not technically specified for end users.

Also, now we can keep it mostly opaque we don't need the custom
serializer, yay!
2021-04-24 14:25:31 -07:00
Andrew Jeffery
de06c92ab7 Bump interop hash and swap sent_hashes set for map in js
In Js we don't have nice hashsets so we use an object, in Rust we can
actually use a hashset so we now need to do a conversion.
2021-04-24 14:25:31 -07:00
Andrew Jeffery
b3a7eff559 Use hashset for sent_hashes in js types 2021-04-24 14:25:31 -07:00
Andrew Jeffery
0e9ee417b9 Bump js_tests commit hash 2021-04-24 14:25:31 -07:00
Andrew Jeffery
e3de7d970a Only store hashes in sync_state rather than the actual changes 2021-04-24 14:25:31 -07:00
Andrew Jeffery
4c7e0c9167 Mutate the SyncState rather than consuming and returning 2021-04-24 14:25:31 -07:00
Andrew Jeffery
90cbbc7cab Fix ordering of receive_sync_message arguments 2021-04-24 14:25:31 -07:00
Andrew Jeffery
d1df9202c7 js_tests: Update commit hash to use sync-protocol-3 branch 2021-04-24 14:25:31 -07:00
Andrew Jeffery
ffea77f985 Add actual binary types 2021-04-24 14:25:31 -07:00
Andrew Jeffery
d61f1e1c6e Remove our_need and fix default SyncState 2021-04-24 14:25:31 -07:00
Andrew Jeffery
6c93315d74 Make a new types module and add BinaryChange to get uint8array 2021-04-24 14:25:31 -07:00
Andrew Jeffery
0a377a858b Catch up with js changes 2021-04-24 14:25:31 -07:00
Andrew Jeffery
f30a14d8f0 Add custom serializer just to get None to map to null 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
fd9e01fd9e Remove unwraps from wasm backend 2021-04-24 14:25:31 -07:00
Andrew Jeffery
68ddb2504e Improve js interop 2021-04-24 14:25:31 -07:00
Andrew Jeffery
646f88c2d2 Reorder receive_sync_message returns in js 2021-04-24 14:25:31 -07:00
Andrew Jeffery
e1bdf34471 More borrowing 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
84bfb342c8 Swap some arguments in js interface
Still need to solve returning backend state from receive_sync_message in
correct order.
2021-04-24 14:25:31 -07:00
Andrew Jeffery
10e481ad0f Rename peer_state to sync_state 2021-04-24 14:25:31 -07:00
Andrew Jeffery
7c117ab3b1 Properly handle conversion to null for optional message 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
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
Vedant Roy
e607d2e22b
add js interop testing (#91)
* add js interop testing

* checkout specific commit + fix bug in if stmt

* implement suggestions

* add to travis

* friendly error message + fix inverted if

* more intuitive order
2021-04-07 16:54:51 +01:00
Martin Kleppmann
38214ca21e
Merge pull request #65 from automerge/implement-compression
Implement compression
2021-04-02 17:47:39 +01:00
Martin Kleppmann
78d0e4e9d3 Add getAllChanges to wasm backend
Fixes #81
2021-04-02 09:00:07 -07:00
Martin Kleppmann
7ae0edb283 Remove getChangesForActor from wasm backend
This function no longer exists in the JS backend
2021-04-02 09:00:07 -07:00
Alex Good
82cf04ae49 Implement compression 2021-03-27 16:52:43 +00:00
Tyler Samples
ec87f411aa
Fix types in wasm/README.md (#66) 2021-03-27 11:12:50 +00:00
Andrew Jeffery
477fbf20db
backend-wasm: Make yarn release work again (#59) 2021-03-23 16:56:16 +00:00
Alex Good
c103b0638e Ritual abasement at the altar of clippy 2021-03-02 19:35:00 +00:00
Orion Henry
37f8778a81 reorg file for new package 2021-02-18 16:41:20 -05:00
Alex Good
9bfcaea477 Run rustfmt 2021-02-12 12:03:10 -05:00
Orion Henry
6350a8726d trying new ways to package the wasm 2021-02-12 11:49:49 -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
Orion Henry
f8b6228488 remove js wrapper code and move all module wrapper logic into rust 2021-02-04 16:23:15 -05:00
Alex Good
7cd1a059f5 Add proptest for serialization 2021-01-14 12:30:25 -05:00
Orion Henry
b6d6b66c06 UncompressedChange moved packages 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
Martin Kleppmann
5ec8408398 Replace all-zeros UUID with '_root'
Corresponding to automerge/automerge@10ec271cbd
2021-01-12 14:45:32 -05:00
Martin Kleppmann
ec327c0125 Delete unused code 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