Andrew Jeffery
01ae8e0ece
Fix overflow panic in apply_local_change
2021-05-20 13:57:44 +01:00
Andrew Jeffery
c8b2e9029a
Add more fuzzing
2021-05-20 13:57:10 +01:00
Andrew Jeffery
d5dfefb704
Fix backend panics ( #141 )
...
* Fix a panic when indexing the bytes
* Fix leb failing to read enough bytes
* Fix another panic out of bounds
* Use get rather than checking
* Check addition with arbitrary val
* Add backend load fuzzing
* Handle no ops sub
* Fix another index out of bounds
2021-05-20 11:24:23 +01:00
Andrew Jeffery
a0bd33e5a6
Refactor travis to have more jobs ( #120 )
...
* Refactor travis to have more jobs
2021-05-20 11:01:54 +01:00
Vedant Roy
ddc9c6d4ce
Add missing Safety header
2021-05-18 16:25:19 -04:00
Vedant Roy
0df5444669
Better sync test
...
Multiple round trips + exercise encode/decode
2021-05-18 16:25:19 -04:00
Vedant Roy
4b7886dfe6
Remove unused var
2021-05-18 16:25:19 -04:00
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
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
Andrew Jeffery
426ccbc818
Expose event handler id ( #132 )
2021-05-16 20:16:54 +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
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
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
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
d3ef07d79f
Merge pull request #113 from automerge/backend-tidy
...
Tidying up some backend code.
2021-05-07 11:58:56 +01:00
Andrew Jeffery
1289f70ac4
Remove duplicate yarn release in travis ( #108 )
2021-05-07 11:56:41 +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
Andrew Jeffery
c38476368c
Use default criterion config
2021-04-26 15:43:33 -04:00
Andrew Jeffery
7175ceeb47
Add some save and load benchmarks
2021-04-26 15:43:33 -04: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
Orion Henry
5d0e1052cc
update get_missing for c api
2021-04-26 11:18:59 -04: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
748d8f9a58
Update nix config
2021-04-24 14:48:48 -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
1f3a6d0ffc
CI: only run on main branch
...
Also runs on PRs to main
2021-04-24 14:25:31 -07:00
Andrew Jeffery
7fa62da400
CI: Don't test all targets
...
This unnecessarily runs the benchmarks to ensure they pass.
2021-04-24 14:25:31 -07:00