Commit graph

35 commits

Author SHA1 Message Date
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
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
Alex Good
d71a734e49 Add OpIds to enforce ordering of Op::succ and Op::pred
The ordering of opids in the successor and predecessors of an op is
relevant when encoding because inconsistent ordering changes the
hashgraph. This means we must maintain the invariant that opids are
encoded in ascending lamport order. We have been maintaining this
invariant in the encoding implementation - however, this is not ideal
because it requires allocating for every op in the change when we commit
a transaction.

Add `types::OpIds` and use it in place of `Vec<OpId>` for `Op::succ` and
`Op::pred`. `OpIds` maintains the invariant that the IDs it contains
must be ordered with respect to some comparator function - which is
always `OpSetMetadata::lamport_cmp`. Remove the sorting of opids in
SuccEncoder::append.
2022-07-17 20:58:47 +01:00
Adel Salakh
f14a61e581 Sort successors in SuccEncoder
Makes SuccEncoder sort successors in Lamport clock order.
Such an ordering is expected by automerge js when loading documents,
otherwise some documents fail to load with a "operation IDs are not in
ascending order" error.
2022-07-13 11:25:12 +01:00
Andrew Jeffery
67da930a40 Add missing lints 2022-04-23 11:15:15 +01:00
Andrew Jeffery
af951f324a Run cargo fix 2022-04-23 11:06:39 +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
5cbc977076 More internal renames of del and inc 2022-04-01 13:36:27 +01:00
Andrew Jeffery
ed244d980a Make start_op be nonzero to prevent bad loads 2022-03-24 16:42:46 +00:00
Andrew Jeffery
a2cb15e936 Remove obj from the op as it can be gotten from the optree
This makes the Op struct smaller, helping memory usage and cache
coherence.
2022-03-11 11:40:28 +00:00
Andrew Jeffery
7a930db44d Don't decode changes for save 2022-03-02 10:45:25 +00:00
Andrew Jeffery
cffadafbd0 Stop collecting to vecs in save 2022-03-02 10:27:29 +00:00
Orion Henry
c8c695618b remove marks 2022-02-10 11:42:15 -05:00
Orion Henry
bfc051f4fb cleanup / rename 2022-01-31 14:02:24 -05:00
Orion Henry
a2e433348a mark encode/decode/serde 2022-01-31 14:02:24 -05:00
Orion Henry
b794f4803d rework marks as inserts between values 2022-01-31 14:02:24 -05:00
Orion Henry
e679c4f6a0 v0 wip 2022-01-31 14:02:23 -05:00
Orion Henry
7b3db2f15a clippy lint 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
Alex Good
1f0a1e4071 Correctly sort actor IDs when encoding changes
This is a port of a fix previously merged into `main`.

The javascript implementation of automerge sorts actor IDs
lexicographically when encoding changes. We were sorting actor IDs in
the order the appear in the change we're encoding. This meant that the
index that we assigned to operations in the encoded change was different
to that which the javascript implementation assigns, resulting in
mismatched head errors as the hashes we created did not match the
javascript implementation.

This change fixes the issue by sorting actor IDs lexicographically. We
make a pass over the operations in the change before encoding to collect
the actor IDs and sort them. This means we no longer need to pass a
mutable `Vec<ActorId>` to the various encode functions, which cleans
things up a little.
2022-01-04 15:28:03 -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
Orion Henry
e275334e72 remove dead code and pubs we don't need 2021-12-21 12:23:55 -05:00
Orion Henry
9c237c7f00 remove expanded_op and internal_op_type 2021-12-17 12:39:26 -05:00
Orion Henry
702117b996 move change_hash out of legacy, removing diff 2021-12-17 12:13:43 -05:00
Orion Henry
90244236c3 move important items out of legacy 2021-12-17 11:33:05 -05:00
Orion Henry
6b517b9894 move things we need out of legacy 2021-12-17 11:04:35 -05:00
Orion Henry
db3a43c5b6 import protocol into legacy 2021-12-16 20:39:08 -05:00
Orion Henry
850db4a35b objid vs opid was not useful as an external type 2021-12-13 10:45:43 -05:00
Orion Henry
670de06bdf rework op_set query system 2021-12-10 15:35:51 -05:00
Orion Henry
cde3ac95f1 more tests 2021-11-12 12:39:18 -05:00
Orion Henry
610ddef016 code cleanup 2021-11-09 17:49:56 -05:00
Orion Henry
db4456497f cleanup 2021-11-08 12:56:32 -05:00
Orion Henry
173aa8b97b progress on bin change import export 2021-11-08 10:15:23 -05:00
Orion Henry
2b9a0dbddc wip 2021-11-06 14:38:55 -04:00