alexjg
cf2a5125a1
Fix logic for condensing insert ops ( #242 )
...
The logic for condensing multiple inserts was faulty in that it did not
take into account the `insert` flag on the ops that were being
condensed. This led to an issue where multiple set operations on an
object were converted into a multi-insert operation in the patch. This
commit adds a fix and a few tests.
2021-11-15 22:28:00 +00:00
Andrew Jeffery
3c786b26a8
Make apply_local_change return ref to change ( #231 )
...
* Make apply_local_change return ref to change
* Remove mut for change
* Document apply_local_changes
2021-07-29 17:41:56 +01:00
Andrew Jeffery
9f554252d0
Use tinyvec for actor id ( #179 )
...
* Use tinyvec for actor id
Most of the time users will not be using their own identifiers and so
use random uuids. These can fit nicely on the stack for a speedup.
TinyVec allows us to capture this mostly stack, sometimes heap
behaviour.
* Use git version of tinyvec for arbitrary
2021-07-15 10:18:07 +01:00
Andrew Jeffery
fa9361f780
Rename Sequence to List ( #218 )
2021-07-13 16:27:48 +01:00
Andrew Jeffery
a55ea62c66
Return an error to the user when trying to delete a non-existent key ( #204 )
...
* Return an error to the user when trying to delete a non-existent key
* Add tests for deleting a missing key
2021-07-01 16:09:58 +01:00
Vedant Roy
ca638691d0
Tests pass after rebase
2021-06-25 11:06:25 -07:00
Vedant Roy
aecfcf2c87
Rebase + clippy
2021-06-25 11:06:25 -07:00
Vedant Roy
a3a9d0b1fb
condense_insert_ops failing
2021-06-25 11:06:25 -07:00
Andrew Jeffery
987263b25d
Add SortedVec struct to ensure preds are sorted ( #176 )
...
* Add SortedVec struct to ensure preds are sorted
* Add into_iter for sortedvec
2021-06-19 17:25:25 +01:00
Andrew Jeffery
fc1b8f87fb
Use SmolStr in place of String ( #182 )
...
Most of the strings are small and so fit nicely in a SmolStr. When they
don't it just reverts to using a normal String.
2021-06-19 16:28:51 +01:00
Andrew Jeffery
ff8b8613d5
Flatten objtype ( #175 )
...
* Flatten object type
* Use separate construct functions
* Use separate gen_*_diff functions
* Remove maptype and seqtype from Diffs
* Preallocate ops in new_map_or_table
* More preallocations
2021-06-17 20:06:10 +01:00
Andrew Jeffery
8b3938c2e7
Rename UncompressedChange to Change ( #173 )
...
It wasn't really uncompressed as we have compressed and uncompressed
changes in the backend. It is just not encoded into the binary format.
The module separation (protocol vs backend) should help with the
distinction.
2021-06-16 11:50:26 +01:00
Andrew Jeffery
14af0738dd
Remove MapType from Map and add Table variant ( #168 )
...
This simplifies the Value enum and hides the protocol internals from the
variants.
2021-06-14 21:26:02 +01:00
Andrew Jeffery
a6e955abfd
Rework statetree to be a tree ( #156 )
2021-06-14 11:08:14 +01:00
Andrew Jeffery
28459f868f
Remove value_at_path ( #159 )
...
This has the same functionality as get_value and we only need one.
2021-06-07 10:18:00 +01:00
Orion Henry
72d15bfe99
a few things broke in the merge
2021-05-24 16:27:05 -04:00
Vedant Roy
aaccefcb11
Switch back to using Vec<u8>
2021-05-24 13:17:37 -07:00
Vedant Roy
6539029eaa
Add apply_patch test
2021-05-24 13:17:37 -07:00
Vedant Roy
22af56b059
Internal representation = base64 string
2021-05-24 13:17:37 -07:00
Vedant Roy
41021f398f
Add bytes type
2021-05-24 13:17:37 -07:00
Alex Good
9bbaf7cbd5
Merge branch 'main' into implement-new-sequence-patch-format
2021-05-17 13:03:57 +01:00
Andrew Jeffery
5637956895
Add custom RootDiff type
...
This ensures that the patch starts with the right diff type statically
and will give an error to js during deserialization.
2021-05-16 14:02:57 +01:00
Andrew Jeffery
2e07e93e72
Change patches diffs to be non-optional
2021-05-16 13:01:37 +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
9ace8892f6
Remove unchanged diff
...
Uses empty edits or props instead.
2021-05-11 12:48:45 +01:00
Andrew Jeffery
6050f39d46
Change patch diffs to start with mapdiff
2021-05-11 09:26:19 +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
Alex Good
e86aabb6a3
Implement new sequence patch format
2021-05-05 21:52:57 +01:00
Andrew Jeffery
d1934f2286
Add formatting config
2021-04-26 09:42:36 -07:00
Andrew Jeffery
aebfdc6572
Update patches with pending_changes
2021-04-24 14:25:31 -07:00
Andrew Jeffery
fc45ff09a3
Allow change to return value from users closure ( #84 )
...
* Allow change to return value from users closure
* Add closure_result field to OptimisticChangeResult
2021-04-15 10:49:04 +01:00
Andrew Jeffery
d17554dfc4
Remove rc on backend
2021-03-31 08:59:38 -07:00
Andrew Jeffery
239fe59090
Use grapheme clusters in Text instead of char ( #72 )
...
* Use grapheme clusters in Text instead of char
char is not what users typically expect as a 'letter' so we should use
grapheme clusters instead. These can't always be represented as single
rust char types so the Text now stores a Vec of single grapheme Strings.
* Add test for grapheme clusters in text
* Use debug_assert_eq instead of debug_assert
2021-03-28 21:32:03 +01:00
Andrew Jeffery
776aef660a
Fix alignment error on wasm32 ( #71 )
...
* Add failing alignment test case
* Add wasm-pack test to ci
* Box im_rc::Vector contents to satisfy alignment
This makes the frontend not have alignment issues on 32 bit
architectures (e.g. wasm32-unknown-unknown). The box provides a
consistent alignment for the Vector.
2021-03-28 21:28:18 +01: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
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
Alex Good
8516476db2
Fix handling of Unchanged diffs in StateTreeValue::new_from_diff
2021-01-19 14:55:54 +00:00
Alex Good
56750f68d1
Fix inserts at beginning of a text object
2021-01-19 14:20:09 +00:00
Alex Good
497372db99
Immutable frontend rewrite
2021-01-16 17:40:47 +00:00
Martin Kleppmann
5ec8408398
Replace all-zeros UUID with '_root'
...
Corresponding to automerge/automerge@10ec271cbd
2021-01-12 14:45:32 -05:00
Alex Good
d7560d88ed
Start making errors more descriptive
2020-06-04 00:32:18 +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
baba6a75b6
rustfmt
2020-05-26 16:20:26 +01:00
Alex Good
03a786d608
Fix a few small bugs
2020-05-26 16:17:06 +01:00
Alex Good
baaebef6d1
Merge branch 'master' into two-level-objtype
2020-05-25 18:47:46 +01:00