Commit graph

1180 commits

Author SHA1 Message Date
Zixuan Chen
fd7c37c94e
chore: bump version to 0.10.1 2024-01-24 10:01:30 +08:00
Zixuan Chen
d01c03eb77
fix: rm checking after checkout 2024-01-24 10:00:00 +08:00
Zixuan Chen
af893d2431
docs: refine apply delta doc 2024-01-22 16:00:32 +08:00
Zixuan Chen
e304af05f4
chore: bump loro-crdt 2024-01-22 13:00:42 +08:00
Leon Zhao
f6cc5da0f1
refactor: Optimizing Encoding Representation for Child Container Creation to Reduce Document Size (#247)
* refactor: encoding container id

* fix: container indexing when merged ops in encoding

* chore: add compress encode size for draw example

* fix: do not need cids in encoding

* chore: change name containerIdx to containerType in encoding
2024-01-22 12:19:09 +08:00
Zixuan Chen
680041f3a9
feat: compare frontiers causal order (#257) 2024-01-22 12:03:50 +08:00
Zixuan Chen
0998342001
docs: update docs about rich text style (#258) 2024-01-22 12:03:35 +08:00
Zixuan Chen
dbef6b0a38
chore: bump loro-crdt version 2024-01-21 20:04:31 +08:00
Zixuan Chen
9e57ccbc00
Fix avoid rich text apply diff err when time travel (#256)
* fix: avoid enter invalid richtext state

* fix: only include the style when the doc contains both style start and style end

* fix: iter_range err in richtext state

* fix: richtext state iter range

* fix: iter range err

* fix: iter range

* chore: rm log

* fix: iter range

* fix: get affected range

* fix: return err if given checkout target is invalid
2024-01-21 19:51:27 +08:00
Zixuan Chen
bbea78b9bf
chore: bump version 2024-01-20 00:59:07 +08:00
Zixuan Chen
adf0d54ba6
feat(wasm): get change at lamport (#255) 2024-01-20 00:56:03 +08:00
Zixuan Chen
3573d96a31
refactor: make it more conservative about pub 2024-01-19 23:30:41 +08:00
Zixuan Chen
982a521864
fix: js method should use camel case 2024-01-19 22:26:02 +08:00
Zixuan Chen
2b86783467
chore: bump loro-crdt version 2024-01-19 22:23:24 +08:00
Zixuan Chen
77eb6853b8
fix: time travel back should be able to nullify rich text span (#254) 2024-01-19 22:20:27 +08:00
Zixuan Chen
f2d9152f2d
fix: formalize apply delta method (#252) 2024-01-19 22:20:13 +08:00
Zixuan Chen
b5aa622554
fix: how to find best insert pos for richtext & expand type reverse behavior (#250)
* chore: bump loro-crdt version

* fix: find best insert pos

* fix: style anchors' ExpandType's reverse behavior
2024-01-19 22:19:56 +08:00
Zixuan Chen
3a2c9523cd
chore: bump loro-crdt version 2024-01-18 13:30:26 +08:00
Zixuan Chen
1295ac6d61
(wasm) Extract VersionVector class and fix inconsistent PeerID repr (#249)
* refactor(wasm): extract VersionVector class and fix inconsistent PeerID in wasm

* fix: example type err

* fix: binding err

* fix: peer id repr should be consistent

* test: update tests
2024-01-18 13:28:28 +08:00
Zixuan Chen
ce1ac36b62
chore: bump loro-crdt version 2024-01-17 23:00:50 +08:00
Zixuan Chen
b4701a4de6
refactor: use rich text style config (#246)
* refactor: use rich text style config

* chore: rm log

* feat: support config text style in wasm

* feat: overlapped styles

* chore: add warning style key cannot contain ':'

* test: refine test case for richtext

* test: refine test
2024-01-17 22:55:46 +08:00
Leon Zhao
692c5e3436
feat: group ops (#243) 2024-01-12 16:47:44 +08:00
Leon Zhao
e111c519e3
refactor: setting parent only in state (#245)
* refactor: set parent in state
2024-01-12 16:46:31 +08:00
Zixuan Chen
b8cf4dc4c3
Refine the new encoding schema (#244)
* perf: refine the new encoding schema

* chore: rm auto derived fromprimitive and toprimitive from encode mode
2024-01-11 22:49:18 +08:00
Zixuan Chen
5f1353791d
Remove txn abort and reduce mem usage (#240)
* refactor: rm txn.abort and related undo behavior

* perf: simplify richtext state when there is not styles

* perf: reduce text cost when there is no style

* chore: refine logs

* perf: remove cid in states to reduce mem overhead

* refactor: reduce mem overhead by using a compacter mapvalue

* refactor: rm the box inside richtext state
2024-01-08 17:29:11 +08:00
Zixuan Chen
e2cf29f3a8
Fix time travel issue (#241)
* fix: time travel issue

* docs: refine comment

* fix: fix start vv in diff_calc apply change
2024-01-08 17:02:32 +08:00
Zixuan Chen
08390cb0de
chore: loro-crdt v0.8.0 2024-01-05 16:11:09 +08:00
Zixuan Chen
a30abf7af1
chore: upgrade debug-log to fix type issue 2024-01-05 16:07:47 +08:00
Zixuan Chen
aaec64a503
Update debug-log (#236)
* chore: use new version of debug-log

* fix: rm group_end
2024-01-05 12:12:04 +08:00
Zixuan Chen
92305f8917
chore: add checks for tracker (#238) 2024-01-05 12:10:50 +08:00
Leon Zhao
76e3f97ff9
feat: use string as peer type in wasm (#234) 2024-01-05 12:06:13 +08:00
Zixuan Chen
bf3b442e97
Fix time travel issue in Tracker (#235)
This pull request fixes an issue in the Tracker module where only the target span was forwarded during forwarding instead of forwarding all content from vv to the target opid. This resulted in errors in current_vv. The issue is resolved by updating the forward function in the Tracker module to include the entire range of content to be forwarded.

It also fixed the inconsistent issue in richtext between style anchors and style ranges.

---------

Co-authored-by: leeeon233 <leeeon233@gmail.com>
2024-01-05 12:05:39 +08:00
Zixuan Chen
00f158c0df
Update loro_value! macro and add binary support (#231)
* docs: update loro_value! doc

* fix: type errors
2024-01-04 22:58:21 +08:00
Zixuan Chen
13a3078408
Refactor container states and add consistency checks (#237)
* refactor: make container states can get their ids

* test: add utils to test consistency between the current states and diff calc

* test: add state diff calc consistency check
2024-01-03 21:57:31 +08:00
Zixuan Chen
8be7cf0412
fix: tracker delete err when the update is partially included (#232) 2024-01-02 20:11:36 +08:00
Zixuan Chen
a6be7d2ea6
refactor: make InternalString an internal struct (#233) 2024-01-02 20:11:22 +08:00
Leon zhao
a4c30f7a4b
test: add richtext fuzz (#224)
This PR adds fuzz for richtext, adding new tests covering checkout, event, and time machine
2024-01-02 17:13:18 +08:00
Zixuan Chen
bc27a47531
feat: stabilizing encoding (#219)
This PR implements a new encode schema that is more extendible and more compact. It’s also simpler and takes less binary size and maintaining effort. It is inspired by the [Automerge Encoding Format](https://automerge.org/automerge-binary-format-spec/).

The main motivation is the extensibility. When we integrate a new CRDT algorithm, we don’t want to make a breaking change to the encoding or keep multiple versions of the encoding schema in the code, as it will make our WASM size much larger. We need a stable and extendible encoding schema for our v1.0 version.

This PR also exposes the ops that compose the current container state. For example, now you can make a query about which operation a certain character quickly. This behavior is required in the new snapshot encoding, so it’s included in this PR.

# Encoding Schema

## Header

The header has 22 bytes.

- (0-4 bytes) Magic Bytes: The encoding starts with `loro` as magic bytes.
- (4-20 bytes) Checksum: MD5 checksum of the encoded data, including the header starting from 20th bytes. The checksum is encoded as a 16-byte array. The `checksum` and `magic bytes` fields are trimmed when calculating the checksum.
- (20-21 bytes) Encoding Method (2 bytes, big endian): Multiple encoding methods are available for a specific encoding version.

## Encode Mode: Updates

In this approach, only ops, specifically their historical record, are encoded, while document states are excluded.

Like Automerge's format, we employ columnar encoding for operations and changes.

Previously, operations were ordered by their Operation ID (OpId) before columnar encoding. However, sorting operations based on their respective containers initially enhance compression potential.

## Encode Mode: Snapshot

This mode simultaneously captures document state and historical data. Upon importing a snapshot into a new document, initialization occurs directly from the snapshot, bypassing the need for CRDT-based recalculations.

Unlike previous snapshot encoding methods, the current binary output in snapshot mode is compatible with the updates mode. This enhances the efficiency of importing snapshots into non-empty documents, where initialization via snapshot is infeasible. 

Additionally, when feasible, we leverage the sequence of operations to construct state snapshots. In CRDTs, deducing the specific ops constituting the current container state is feasible. These ops are tagged in relation to the container, facilitating direct state reconstruction from them. This approach, pioneered by Automerge, significantly improves compression efficiency.
2024-01-02 17:03:24 +08:00
Zixuan Chen
727b5c2518
Add benchmark utils that simulate drawing workflow (#229)
* chore: add benchmark utils that simulate drawing workflow

* chore: use markdown as table default style

* chore: init sheet simulating
2023-12-28 18:00:34 +08:00
Zixuan Chen
6a2d0f8fef
test: fix fuzz test config 2023-12-26 18:09:55 +08:00
Zixuan Chen
9477717e3e
chore: bump loro-crdt versions to v0.7.1 2023-12-26 18:01:14 +08:00
Leon zhao
012abe97c3
fix: richtext undo item merge error (#227) 2023-12-26 11:06:27 +08:00
Zixuan Chen
612745aa8c
Fix issue with richtext's applyDelta() behavior (#226)
* fix: [LORO-371] The behavior of richtext's `applyDelta()` is not entirely correct #225

* test: add corresponding test

Fixes #225
2023-12-21 11:40:39 +08:00
Zixuan Chen
c2877e8468
chore: bump version 2023-12-14 10:38:54 +08:00
Leon zhao
442f2561a1
Remove prelim feature (#215)
* chore: remove prelim temporarily
2023-12-13 10:25:00 +08:00
Zixuan Chen
546cadf26c
refactor(wasm): invoke setPanicHook when starting 2023-12-08 16:58:41 +08:00
Zixuan Chen
ce36f8adbd
chore: bump version 2023-12-07 15:27:22 +08:00
Zixuan Chen
699c2c73a5
Fix partial inclusion bug in Tracker (#214)
* fix: partial inclusion bug in Tracker

* fix: rm redundant logs
2023-12-07 15:25:33 +08:00
Zixuan Chen
33d06d5cd8
chore: add a few assert msg #210 2023-12-07 14:23:16 +08:00
Zixuan Chen
b689f5b1cd
chore: bump version 2023-12-06 23:39:55 +08:00