Commit graph

43 commits

Author SHA1 Message Date
Orion Henry
b5742315ef move op observer into transaction 2022-09-29 15:59:08 -05:00
Alex Good
427002caf3 Correctly load documents with deleted objects
The logic for reconstructing changes from the compressed document format
records operations which set a key in an object so that it can later
reconstruct delete operations from the successor list of the document
format operations. The logic to do this was only recording set
operations and not `make*` operations. This meant that delete operations
targeting `make*` operations could not be loaded correctly.

Correctly record `make*` operations for later use in constructing delete
operations.
2022-09-12 12:38:57 +01:00
Alex Good
9ac8827219
Remove storage-v2 feature flag
Signed-off-by: Alex Good <alex@memoryandthought.me>
2022-08-22 21:21:21 +01:00
Alex Good
9c86c09aaa
Rename Change::compressed_bytes -> Change::bytes 2022-08-22 21:18:11 +01:00
Alex Good
63dca26fe2
Additional tests for storage-v2
Various tests were required to cover edge cases in the new storage-v2
implementation.

Signed-off-by: Alex Good <alex@memoryandthought.me>
2022-08-22 21:16:47 +01:00
Alex Good
34e919a4c8
Plumb in storage-v2
This is achieved by liberal use of feature flags. Main additions are:

* Build the OpSet more efficiently when loading from compressed
  document storage using a DocObserver as implemented in
  `automerge::op_tree::load`
* Reimplement the parsing login in the various types in
  `automerge::sync`

There are numerous other small changes required to get the types to line
up.

Signed-off-by: Alex Good <alex@memoryandthought.me>
2022-08-22 21:16:47 +01:00
Alex Good
d785c319b8
Add ScalarValue::Unknown
The colunar storage format allows for values which we do not know the
type of. In order that we can handle these types in a forward compatible
way we add ScalarValue::Unknown.

Signed-off-by: Alex Good <alex@memoryandthought.me>
2022-08-22 21:04:19 +01:00
Orion Henry
0c9e77b644 added a test to ensure we dont break counter serialization 2022-06-09 12:45:20 +02:00
Andrew Jeffery
dae6509e13 Update autocommit's apply_changes to take an iterator 2022-05-26 09:02:59 +01:00
Andrew Jeffery
933bf5ee07 Return an error when getting clock for missing hash 2022-05-20 10:05:08 +01:00
Andrew Jeffery
78ef6e3a2d Fix formatting 2022-04-23 09:27:01 +01:00
Orion Henry
1bee30c784
Merge branch 'main' into observer-counters 2022-04-20 20:35:07 -04:00
Andrew Jeffery
d667552a98 Add increment observation for observer 2022-04-20 14:44:04 +01:00
Andrew Jeffery
bfe7378968 Prevent increment on non-counter 2022-04-20 11:37:03 +01:00
Orion Henry
757f1f058a simplify test more 2022-04-18 17:03:32 -04:00
Orion Henry
c66d8a5b54 fmt 2022-04-18 16:43:28 -04:00
Orion Henry
ab09a7aa5d make test simpler 2022-04-18 16:39:11 -04:00
Orion Henry
5923d67bea duplicate changes in the queue could corrupt internal state 2022-04-18 16:31:13 -04:00
Andrew Jeffery
07553195fa Update wasm and js with new names 2022-04-08 18:23:56 +01:00
Andrew Jeffery
1ca49cfa9b Add range to transactable and rename value to get
Also changes values to get_conflicts for more clarity on what it does
and opening up the name for iterating over values.
2022-04-08 18:18:22 +01:00
Andrew Jeffery
fa2971a29a Have value be a reference for scalars 2022-04-04 12:47:08 +01:00
Andrew Jeffery
d331ceb6d4 Rename set to put and set_object to put_object 2022-04-01 13:40:58 +01:00
Andrew Jeffery
1a66dc7ab1 Use full names for delete and increment 2022-04-01 13:36:00 +01:00
Orion Henry
95f27f362c
Merge pull request #283 from jeffa5/experiment-make
Separate scalars and objects in transaction API
2022-03-04 16:53:17 -05:00
Andrew Jeffery
d71e87882e Make save infallible 2022-03-04 12:28:05 +00:00
Andrew Jeffery
79d493ddd2 Rename make to set_object 2022-03-04 09:50:48 +00:00
Andrew Jeffery
e42adaf84b Fixup automerge tests 2022-03-04 09:47:37 +00:00
Andrew Jeffery
9406bf09ea Fix some tests 2022-03-03 22:53:55 +00:00
Andrew Jeffery
682b8007b9 Borrow exid to avoid &ROOT everywhere 2022-03-03 09:05:08 +00:00
Andrew Jeffery
30e0748c15 Remove new_with_actor_id on documents 2022-03-02 17:02:26 +00:00
Andrew Jeffery
8eea9d7c0b Always have an actor 2022-03-02 16:59:45 +00:00
Andrew Jeffery
3493dbd74a Rename autotxn to autocommit 2022-02-21 10:49:14 +00:00
Andrew Jeffery
50a1b4f99c Add transactable trait 2022-02-21 10:32:57 +00:00
Andrew Jeffery
59e36cebe4 Improve transactions with drop, transact and better commit
Also remove modification operations directly on Automerge and switch
tests to using AutoTxn.
2022-02-17 11:29:36 +00:00
Orion Henry
c8c695618b remove marks 2022-02-10 11:42:15 -05:00
Orion Henry
54fec3e438 lamport compare was backward on actorids and so was value resolution 2022-01-20 14:17:11 -08:00
Orion Henry
b30a2b9cc1 give Counter its own type 2022-01-14 06:27:42 -08:00
Orion Henry
d50062b769 move values into the counter type - remove need for vis_window 2022-01-14 06:27:42 -08:00
Orion Henry
e59d24f68b return values are sorted - add counter del test 2022-01-14 06:27:42 -08:00
Orion Henry
3046cbab35
Replace the OpID API with an object ID
Rather than returning an OpID for every mutation, we now return an
`Option<ObjId>`. This is `Some` only when a `make*` operation was
applied. This `ObjID` is an opaque type which can be used with any
document.
2022-01-01 20:15:02 +00:00
Alex Good
fa936b5a28 Add script to run clippy 2021-12-24 10:18:16 -08:00
Alex Good
6a63d30a56 Add some rust tests
This commit adds a bunch of testing infrastructure as well as most of
the tests from the `legacy_tests.js` file in the js codebase that seem
applicable to this codebase.
2021-12-20 17:54:40 -08:00
Alex Good
962340805c
automerge::set - don't generate ops for noops
Repeatedly setting the same value for a particular (obj, key)
combination now no longer generates an operation. To allow this we
modify the return value of `automerge::set` so that it may return an
`Option<OpId>` instead of an `OpId`.

Signed-off-by: Alex Good <alex@memoryandthought.me>
2021-12-18 15:57:03 +00:00