Commit graph

142 commits

Author SHA1 Message Date
Orion Henry
1c61986d33 clippy and fmt 2022-02-24 15:48:48 -05:00
David Pollak
bde0a6fbf6 Cleaned up some warnings and errors running against Rust 1.58.1 2022-02-24 15:20:48 -05:00
Andrew Jeffery
3c0c407192
Add initial github actions setup (#237)
Add initial github actions setup
2022-01-10 17:18:18 +00:00
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
Alex Good
d279819bfc Update to rand 0.8 2021-10-11 19:48:33 +01:00
Alex Good
5a26f8fcd1 Add missing licenses 2021-09-23 23:41:51 +01:00
Andrew Jeffery
94769e2dae
Sequence tree (#236)
Switch from im_rc to `SequenceTree`
2021-09-14 13:38:15 +01: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
72a79a31d8
Remove default from ActorId (#230)
* Use random as ActorId default

* Remove default for actor

* Use take function on DiffableValue

* Missed the mem::replace
2021-07-29 14:39:30 +01:00
Andrew Jeffery
ce62b25e17
Move Frontend and FrontendState to separate modules (#229) 2021-07-28 17:47:07 +01:00
Andrew Jeffery
8640f98bae
Optimistic state tree (#227)
* Use mutationtracker in frontendstate

This allows us to directly track the modified optimistic state and
avoids us having to clone the state when we receive a non-local patch.

* Split mutation tracker from OptimisticStateTree

* Store diffs not whole patches

* Reset the reconciled_root_state when no in_flight_requests

* Document some functions

* Use .. in struct destructuring

* Update docs
2021-07-22 17:01:14 +01:00
Andrew Jeffery
be119d67e1
Value proxy (#212)
* Make some bits more visible

* Add basic proxy with map

* Actually expose the Proxies

* Add more proxies and functionality

* Use &str instead of &SmolStr

* Add some derives

* Add derives to RootProxy

* Add value method

* Add general value method to ValueProxy

* Rename *Proxy to *Ref and update modules

* Format

* Fixup Sequence name
2021-07-15 11:51: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
01300d42a7
Add is_* and extraction methods to Value and Primitive (#213)
These methods make operating on the values easier in some situations.
2021-07-13 14:07:49 +01:00
Andrew Jeffery
94162fc15f
Fix logic for updating changed_indices in diffable sequence (#203)
* Fix logic for updating changed_indices

* Add tests for diffable sequence changed_indices
2021-07-13 12:04:49 +01:00
Andrew Jeffery
5e99648b36
diffable seq: Box Vector contents (#210)
This makes it so that rebalancing moves less data around thus making the
trace benchmark twice as fast!

I can't believe I didn't try it sooner...
2021-07-06 13:40:57 +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
David Craven
5d42e50798
Generic actor (#202)
* No reason to force usage of uuid's.

* Fix tests and benches.
2021-07-01 15:49:35 +01:00
Orion Henry
3db6f9ef13
Fix Clippy issues, broken tests, formatting issues (#188)
* fix clippy errors

* Bump travis nvm version

* Add smol_str arbitrary

* Fix Err prefix clippy error

* Fix clippy needless-borrow

* Ensure SortedVec sorts on deserialize

Co-authored-by: Andrew Jeffery <dev@jeffas.io>
2021-06-28 13:20:21 +01:00
Vedant Roy
132fa001fc Address review comments 2021-06-25 11:06:25 -07: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
b82463bb87 Tests pass 2021-06-25 11:06:25 -07:00
Vedant Roy
a3a9d0b1fb condense_insert_ops failing 2021-06-25 11:06:25 -07:00
Vedant Roy
9353ae40b2 Remove F32 2021-06-25 11:06:25 -07:00
Andrew Jeffery
08fd039eb3
Reduce use of new features to build on older Rusts (#184) 2021-06-25 16:03:13 +01:00
Andrew Jeffery
885a763766
Calculate pred_for_key before deleting the key (#183) 2021-06-20 12:46:50 +01: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
98dbd6150e
Mutation tracker rollback (#165)
* Make set and delete operations return the old value

* Add rollback to MutableDocument

* Use rollback in optimistically_apply_change
2021-06-16 14:16:48 +01:00
Andrew Jeffery
0f0e9e827a
New value zero copy multivalue (#170)
* Remove copying when making a multivalue from a newvalue

* Optimise cursors in new value

* Make key be a value not reference

* Rename union to extend
2021-06-16 12:16:31 +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
4821cdd766
Calculate pred for deletion from text before deleting (#174) 2021-06-16 11:49:58 +01:00
Andrew Jeffery
f224940fdc
Fix Frontend debug struct name (#172) 2021-06-16 09:22:06 +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
a744637787
Add get_value to Value (#160) 2021-06-10 14:13:50 +01:00
Andrew Jeffery
098074dd1e
Add AsRef for Value (#162) 2021-06-09 16:51:56 +01:00
Andrew Jeffery
b8d282db61
Add more derived traits for Path (#163) 2021-06-09 11:06:54 +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
Andrew Jeffery
edf9edd35e
Simplify apply root diff (#150) 2021-05-26 11:45:30 +01:00
Andrew Jeffery
51f50b8f5c
diffable seq: Avoid rebuilding the updating list each time (#149)
This means we can keep things in the original state but while applying
the diff we don't have to keep building a new vec each time.

This makes B1.1 run in ~11 seconds for me.
2021-05-26 09:17:08 +01:00
Andrew Jeffery
949d7b9f62 Remove unused variables
These were likely used at one point but now just incur an expensive
allocation cost. This reduces the B1.1 Append N characters benchmark
from ~19s to ~16s.
2021-05-25 22:45:36 +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
b6db78329a Satisfy clippy 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