Commit graph

79 commits

Author SHA1 Message Date
Orion Henry
50cea87c82 wasm-pack v0.1.6 2022-08-22 14:30:01 -05: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
Andrew Jeffery
6ea5982c16 Change parents to return result if objid is not an object
There is easy confusion when calling parents with the id of a scalar,
wanting it to get the parent object first but that is not implemented.
To get the parent object of a scalar id would mean searching every
object for the OpId which may get too expensive when lots of objects are
around, this may be reconsidered later but the result would still be
useful to indicate when the id doesn't exist in the document vs has no
parents.
2022-07-12 18:36:47 +01:00
Orion Henry
72c09c3cb9 clean up warnings/clippy/fmt 2022-06-14 15:25:03 -04:00
Peter van Hardenberg
8982b96c41 first build since merge 2022-06-14 11:44:52 -07:00
Jerome Gravel-Niquet
7acb9ed0e2
don't remove last actor when there are none 2022-05-16 10:56:10 -04:00
Orion Henry
a728b8216b range -> map_range(), added list_range() values() works on both 2022-05-03 19:27:51 -04:00
Andrew Jeffery
9788cd881d Add debug impls 2022-04-23 11:14:07 +01:00
Andrew Jeffery
af951f324a Run cargo fix 2022-04-23 11:06:39 +01:00
Andrew Jeffery
48e397e82f Add lints 2022-04-23 11:05:43 +01:00
Orion Henry
d0b34a7dde Merge branch 'main' into marks 2022-04-20 22:03:29 -04: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
Andrew Jeffery
b6fd7ac26e Add op_observer to documents and transactions
This replaces the built-in patches with a more generic mechanism, and
includes a convenience observer which uses the old patches.
2022-04-19 17:30:05 +01:00
Orion Henry
6872e3fa9b
Merge pull request #338 from jeffa5/experiment-double-ended-range
Add double ended iterator for Range and Values
2022-04-18 17:28:03 -04:00
Andrew Jeffery
a65838076d Add parents iterator
This allows users to have the convenience of getting all of the parents
of an object, whilst allowing them to terminate early when they have
found what they need.
2022-04-18 16:15:29 +01:00
Orion Henry
bce30fa9b2 Merge branch 'experiment' into marks 2022-04-17 09:00:02 -04:00
Andrew Jeffery
fb3b740a57 Make range just be over maps 2022-04-15 15:01:28 +01:00
Andrew Jeffery
07553195fa Update wasm and js with new names 2022-04-08 18:23:56 +01:00
Andrew Jeffery
679b3d20ce Add range_at and values_at to transactable 2022-04-08 18:19:03 +01:00
Andrew Jeffery
decd03a5d7 Add values iterator 2022-04-08 18:18:47 +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
842797f3aa Use Unicode Scalars instead of graphemes in text 2022-04-08 09:35:59 +01:00
Andrew Jeffery
06d2306d54 Add path_to_object 2022-04-07 15:04:00 +01:00
Andrew Jeffery
a88d49cf45 Fixup builds 2022-04-07 14:32:17 +01:00
Andrew Jeffery
48ce85dbfb Add ref to treequery to allow borrowing ops 2022-04-04 11:55:22 +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
1a66dc7ab1 Use full names for delete and increment 2022-04-01 13:36:00 +01:00
Andrew Jeffery
3039efca9b Use pending_ops rather than direct len of operations 2022-03-30 12:18:44 +01:00
Orion Henry
979b9fd362 Merge branch 'experiment' into marks 2022-03-29 12:04:12 -04:00
Andrew Jeffery
ed244d980a Make start_op be nonzero to prevent bad loads 2022-03-24 16:42:46 +00:00
Orion Henry
25afa0b12b unmark() - 0.0.21 2022-03-21 13:36:01 -04:00
Orion Henry
99b1127f5c Merge branch 'experiment' into marks 2022-03-17 14:42:35 -04:00
Andrew Jeffery
a4e8d20266 Optimise getting number of ops when applying tx or changes 2022-03-11 12:25:34 +00:00
Andrew Jeffery
ac18f7116f And fixup IntoIterator 2022-03-11 12:25:18 +00:00
Andrew Jeffery
67251f4d53 Have splice take IntoIterator 2022-03-11 12:24:02 +00:00
Andrew Jeffery
2e49561ab2 Make splice take iterator instead of vec 2022-03-11 12:13:11 +00:00
Andrew Jeffery
488df55385 Remove change field on Op as unused
This field was never read from.
2022-03-11 11:40:42 +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
Orion Henry
ee116bb5d7 object_type returns an option 2022-03-09 19:42:58 -05:00
Orion Henry
a0f78561c4 Merge branch 'paths' into marks 2022-03-09 19:28:10 -05:00
Orion Henry
c51073c150 add paths/materialize to api 2022-03-09 17:53:30 -05:00
Andrew Jeffery
aad4852e30 Misc API updates
- Commit now returns just a single hash rather than a vec. Since the
  change we create from committing has all of the heads as deps there
  can only be one hash/head after committing.
- Apply changes now takes a Vec rather than a slice. This avoids having
  to clone them inside.
- transact_with now passes the result of the closure to the commit
  options function
- Remove patch struct
- Change receive_sync_message to return a () instead of the
  `Option<Patch>`
- Change `Transaction*` structs to just `*` and use the transaction
  module
- Make CommitOptions fields public
2022-03-09 15:14:22 -05:00
Andrew Jeffery
d02737ad12 Fix del missing key in map 2022-03-09 15:14:22 -05:00
Andrew Jeffery
d00cee1637 Misc API updates
- Commit now returns just a single hash rather than a vec. Since the
  change we create from committing has all of the heads as deps there
  can only be one hash/head after committing.
- Apply changes now takes a Vec rather than a slice. This avoids having
  to clone them inside.
- transact_with now passes the result of the closure to the commit
  options function
- Remove patch struct
- Change receive_sync_message to return a () instead of the
  `Option<Patch>`
- Change `Transaction*` structs to just `*` and use the transaction
  module
- Make CommitOptions fields public
2022-03-09 12:33:20 +00:00
Andrew Jeffery
a9737a6815 Fix del missing key in map 2022-03-09 10:31:25 +00:00
Orion Henry
cbf1ac03b2 added attribute2() - janky version 2022-03-08 12:00:02 -05:00
Orion Henry
42446fa5c2 blame -> attribute 2022-03-07 13:45:56 -05:00