Commit graph

471 commits

Author SHA1 Message Date
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
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
Leon zhao
442f2561a1
Remove prelim feature (#215)
* chore: remove prelim temporarily
2023-12-13 10:25:00 +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
ab64881029
fix: text tracker error #211 (#212)
* fix: text tracker error #211

* chore: rm only

* fix: refine
2023-12-06 23:36:21 +08:00
Zixuan Chen
53a7196c52
fix: [LORO-337] Marking should have no effect when the target key value pair exists #204 (#209) 2023-12-05 11:57:58 +08:00
Leon zhao
47fea50dda
Refactor: use ValueOrContainer for diff event (#202)
* feat: use resolved diff as event

* feat: wasm ValueOrContainer event

* fix: cargo fix

* fix: avoid state clone

* chore: add resolve event bench

* test: add handler in event test

* refactor: use resolved as external diff

* chore: cargo fix

* fix: typescript loro value type

* fix: use Arc::new_cyclic

* refactor: bring back sub container
2023-12-05 11:57:41 +08:00
Zixuan Chen
bf1a792933
refactor: only need shared ref on loro doc now (#203) 2023-12-03 14:54:45 +08:00
Zixuan Chen
cccb4f3957
perf(wasm): reduce wasm size (#198) 2023-11-29 13:59:39 +08:00
Zixuan Chen
208c673b2d
refactor: list now use the same tracker as text (#197)
Resolve #122
2023-11-29 10:45:00 +08:00
Zixuan Chen
fddcf7a321
chore: publish v0.2.2 with refined doc 2023-11-28 23:23:07 +08:00
Zixuan Chen
cd8be80a6f
docs: refine rust api doc 2023-11-28 23:20:57 +08:00
Zixuan Chen
1eae5ea495
chore: bump loro rust to v0.2.1 2023-11-28 22:22:09 +08:00
Leon zhao
afc4bfaf62
feat: tree rust api (#194) 2023-11-28 21:32:04 +08:00
Zixuan Chen
564dde7703
chore: publish mvp rust api 2023-11-28 21:29:11 +08:00
Zixuan Chen
6ef1e12d71
chore: rm zerovec 2023-11-28 21:01:01 +08:00
Zixuan Chen
2ad7202e05
Feat-rust-api (#193) 2023-11-28 16:22:43 +08:00
Zixuan Chen
88218c10bd
(WASM )Refactor wasm interfaces on List and Map (#192)
* refactor: refine wasm interfaces

* docs: update wasm doc
2023-11-27 17:53:02 +08:00
Leon zhao
899270c6de
fix: remove compress feature (#184)
BREAKING CHANGE: encoding schema is changed
2023-11-21 21:48:25 +08:00
Zixuan Chen
8e901cf00c
fix: #181 importing should use inherent arena
otherwise, txn, oplog and app state may use different
arena.
2023-11-21 20:29:01 +08:00
Zixuan Chen
1ff1505933
feat: get sub container directly when getting value (#175) 2023-11-16 21:46:57 +08:00
leeeon233
c4b753dfd8 chore: add license 2023-11-12 23:23:12 +08:00
Zixuan Chen
505ad4275b
Fix encoding of oplog snapshot (#168) 2023-11-12 20:39:00 +08:00
Zixuan Chen
08e4ed9d40
feat: add from_checkout mark to event (#164) 2023-11-08 16:15:11 +08:00
Zixuan Chen
116190c817
chore: refine err msg 2023-11-08 14:18:01 +08:00
Zixuan Chen
9b18ff9847
fix: make encoding enhanced simpler 2023-11-08 14:17:43 +08:00
Zixuan Chen
93a52ba55e
fix: commit txn when dropping
it's less confusing
2023-11-08 14:16:10 +08:00
Zixuan Chen
7b855c88da
test: add out of bound test 2023-11-07 23:32:07 +08:00
Zixuan Chen
532eee09a4
fix: return Err when index out of bound 2023-11-07 22:48:53 +08:00
Zixuan Chen
83ae5930bc
Fix list get method (#158) 2023-11-07 19:48:16 +08:00
Zixuan Chen
cb8bbefb08
Fix incorrect deletion of emoji in wasm (#154)
This pull request fixes an issue where the emitted utf16 events were wrong when deleting an emoji in wasm. The problem was caused by incorrect calculation of the event range. This PR updates the code to use the correct range and adds a new test case to ensure the issue is fixed.
2023-11-05 16:13:40 +08:00
Zixuan Chen
7ccfd1e91d
feat: expose version and change inspect api to wasm (#156) 2023-11-05 16:06:34 +08:00
Leon zhao
acafc76aff
Feat: diff calc bring back & tree new event and value (#149)
* feat: new tree state

* fix: emit meta event

* fix: semantic tree event

* fix: diff calc bring_back

* chore: clear comments

* fix: merge

* fix: tree snapshot

* fix: filter empty bring back

* feat: tree add external diff

* fix: imported changes were not mergeable (#147)

* fix: imported changes were not mergeable
now the small encoding size is supported in example

* fix: stupid err in richtext checkout

* fix: rle oplog encode err
- support pending changes
- start counters were wrong

* fix: utf16 query err (#151)

* fix: tree movable node lamport

* fix: merge

* perf: bring back

* doc: add deep value meta doc

* refactor: bring back only when record diff

---------

Co-authored-by: Zixuan Chen <remch183@outlook.com>
2023-11-05 15:53:33 +08:00
Zixuan Chen
8bd953e396
refactor: extract text chunk (#153) 2023-11-04 20:03:43 +08:00
Zixuan Chen
b1895bba26
Update Quill editor to fix consistency issues (#152)
* chore: rm logs

* fix: richtext delta event

* fix(quill): move apply delta to editor part

* fix: consistency issue with Quill
- Quill assumes there is always a \n at the end of the line
- Quill assumes \n does not merge with other delta item
- Quill assumes there is no inline format inside {insert: '\n'} delta
  item
2023-11-04 20:03:15 +08:00
Zixuan Chen
5a9baebba0
fix: utf16 query err (#151) 2023-11-04 12:24:05 +08:00
Zixuan Chen
5b65963104
fix: imported changes were not mergeable (#147)
* fix: imported changes were not mergeable
now the small encoding size is supported in example

* fix: stupid err in richtext checkout

* fix: rle oplog encode err
- support pending changes
- start counters were wrong
2023-11-04 12:23:28 +08:00
Zixuan Chen
200a6dd39a
fix: warnings 2023-11-03 22:26:49 +08:00
Zixuan Chen
5cac1ed092
Refactor: make changes mergeable (#146)
- Allow changes to be merged when possible. This makes realtime collaboration more efficient with Loro.
- Refactor the code to make modifications of changes in oplog in one place
- Optimize the diff calculation so that it doesn't have to go back to the beginning of the change.

Note: we still keep the invariants that dependency pointers in Loro always point to the last op in a change
2023-11-03 21:40:34 +08:00
Zixuan Chen
7a19b49acb
Add richtext example using Quill (#145)
* feat: richtext example init

* fix: pass richtext event delta consistency check

* chore: debug history
2023-11-03 16:59:27 +08:00
Zixuan Chen
da16b8a99d
refactor: use better repr for container id (#144) 2023-11-02 17:13:08 +08:00
Zixuan Chen
a40b5c6e4a
feat: support richtext in wasm & mark text with arbitrary value (#142)
- Support mark text with custom value [LORO-299] Allow users to mark text with custom value #139
- Expose richtext in wasm
2023-11-02 14:20:34 +08:00
Zixuan Chen
95e6130d93
Fix: richtext event (#138)
Support rich text event. Now it will emit the delta event correctly in the Quill Delta format.
2023-11-01 20:02:05 +08:00
Zixuan Chen
a52549ea30
fix: g-btree bug, fixed by upgrade dep 2023-10-31 22:04:43 +08:00
Zixuan Chen
bcf81a45eb
fix: g-btree delete leaf err
upgrade generic-btree
2023-10-31 21:08:07 +08:00
Zixuan Chen
e1ab03f30f
feat: create doc from snapshot (#136) 2023-10-31 19:02:52 +08:00
Zixuan Chen
c9cf106338
fix: impl Fugue correctly (#133)
The original content has a reversed comparison for right parents, which causes the interleaving anomalies when inserting text in a backward order.
2023-10-31 17:59:24 +08:00
Zixuan Chen
8235eaaa9b
fix: snapshot encode err (#135)
- allow import snapshot when user has created empty handlers
- fix state snapshot encode err
2023-10-31 17:58:50 +08:00
Zixuan Chen
f72f812086
Refactor: replace collection with single op content in remote op (#132)
* refactor: remove rlevec inside remoteop

* refactor: remove the use of RleVec<[T; 0]> (#131)
2023-10-31 17:58:27 +08:00
Zixuan Chen
74138231aa
refactor: remove the use of RleVec<[T; 0]> (#131) 2023-10-31 17:54:37 +08:00
Zixuan Chen
bf2385efe0
Refactor: remove old encode method (#130)
* refactor: remove old encode method

* chore: rm file

* refactor: mv snapshot encode file
2023-10-31 10:36:21 +08:00
Zixuan Chen
2abc302344
chore: add pending test and new_auto_commit 2023-10-31 10:14:09 +08:00
Zixuan Chen
c1d732b57c
Fix event hint error (#129)
* fix: event hint err

* fix: delete event hint
2023-10-31 10:00:54 +08:00
Zixuan Chen
45490f3370
Perf: reduce mem usage when transaction is large (#128)
* perf: reduce mem usage when txn is large

* test: add diagnose info for id_to_cursor

* perf: make id span easier to merge
2023-10-30 21:56:33 +08:00
Zixuan Chen
8293347334
Feat: autocommit transaction (#127)
* feat: auto commit

* fix: make recursive single thread event work again
2023-10-30 18:32:36 +08:00
Zixuan Chen
734b832c00
Fix checkout event (#126)
* tests: add checkout err tests

* fix: checkout event err when create child
2023-10-30 14:16:50 +08:00
Leon zhao
e01e98411c
feat: movable tree support (#120)
* feat: tree state

* feat: tree value

* feat: tree handler

* fix: tree diff

* test: fuzz tree

* feat: tree snapshot

* fix: tree default value

* fix: test new node

* fix: tree diff

* fix: tree unresolved value

* fix: tree fuzz

* fix: tree fuzz move

* fix: sort by tree id

* fix: tree diff sorted by lamport

* fix: sort roots before tree converted to string

* fix: rebase main

* fix: tree fuzz

* fix: delete undo

* fix: tree to json children sorted

* fix: diff calculate

* fix: diff cycle move

* fix: tree old parent cache

* feat: cache

* fix: local op add tree cache

* fix: don't add same tree move to cache

* fix: need update cache

* feat: new cache

* bench: add checkout bench

* chore: clean

* fix: apply node uncheck

* perf: lamport bound

* fix: calc old parent

* feat: tree wasm

* fix: change tree diff

* fix: tree diff retreat

* fix: tree diff should not apply when add node

* feat: new tree loro value

* chore: typo

* fix: tree deep value

* fix: snapshot tree index -1

* fix: decode tree snapshot use state

* fix: release state lock when emit event

* fix: tree node meta container

* fix: need set map container when covert to local tree op

* fix: tree value add deleted

* fix: more then one op in a change

* fix: tree fuzz deleted equal

* fix: tree calc min lamport

* feat: tree encoding v2

* doc: movable tree

* fix: test tree meta

* test: remove import bytes check

* refactor: diff of text and map

* refactor: del span

* perf: tree state use deleted cache

* fix: some details

* fix: loro js tree create

* feat: add un exist tree node

* bench:  tree depth

* fix: check out should emit event

* refactor: event

* fix: fuzz err

* fix: pass all tests

* fix: fuzz err

* fix: list child cache err

* chore: rm debug code

* fix: encode enhanced err

* fix: encode enchanced

* fix: fix several richtext issue

* fix: richtext anchor err

* chore: rm debug code

* fix: richtext fuzz err

* feat: speedup text snapshot decode

* perf: optimize snapshot encoding

* perf: speed up decode & insert

* fix: fugue span merge err

* perf: speedup delete & id cursor map

* fix: fugue merge err

* chore: update utils

* fix: fix merge

* fix: return err apply op

* fix: fix merge

* fix: get map container as tree meta
2023-10-30 11:13:52 +08:00
Zixuan Chen
d942e3d7a2
Feat: Peritext-like rich text support (#123)
* feat: richtext wip

* feat: add insert to style range map wip

* feat: richtext state

* fix: fix style state inserting and style map

* fix: tiny vec merge err

* fix: comment err

* refactor: use new generic-btree & refine impl

* feat: fugue tracker

* feat: tracker

* feat: tracker

* fix: fix a few err in impl

* feat: init richtext content state

* feat: refactor arena

* feat: extract anchor_type info out of style flag

* refactor: state apply op more efficiently
we can now reuse the repr in state and op

* fix: new clippy errors

* refactor: use state chunk as delta item

* refactor: use two op to insert style start and style end

* feat: diff calc

* feat: handler

* fix: tracker checkout err

* fix: pass basic richtext handler tests

* fix: pass handler basic marking tests

* fix: pass all peritext criteria

* feat: snapshot encoding for richtext init

* refactor: replace Text with Richtext

* refacotr: rm text code

* fix: richtext checkout err

* refactor: diff of text and map

* refactor: del span

* refactor: event

* fix: fuzz err

* fix: pass all tests

* fix: fuzz err

* fix: list child cache err

* chore: rm debug code

* fix: encode enhanced err

* fix: encode enchanced

* fix: fix several richtext issue

* fix: richtext anchor err

* chore: rm debug code

* fix: richtext fuzz err

* feat: speedup text snapshot decode

* perf: optimize snapshot encoding

* perf: speed up decode & insert

* fix: fugue span merge err

* perf: speedup delete & id cursor map

* fix: fugue merge err

* chore: update utils

* perf: speedup text insert / del

* fix: cursor cache

* perf: reduce conversion by introducing InsertText

* perf: speed up by refined cursor cache

* chore: update gbtree dep

* refactor(wasm): use quill delta format

* chore: fix warnings
2023-10-29 14:02:13 +08:00
Zixuan Chen
fa1286af59
docs: diff calc special behavior 2023-09-25 16:49:17 +08:00
Leon zhao
b09fc48115
Merge pull request #113 from loro-dev/refator-delete-map
refactor: map delete value
2023-09-21 15:59:00 +08:00
leeeon233
d2b8941f06 fix: SnapshotOp map use u32 2023-09-21 08:26:54 +08:00
leeeon233
524ab9dabd chore: visibility & named 2023-09-21 08:04:22 +08:00
leeeon233
caaaa666ae chore: add pending bench 2023-09-20 09:24:46 +08:00
leeeon233
05dc62a31c fix: revert enhanced encoding 2023-09-18 21:42:42 +08:00
leeeon233
a77bf2fcb3 fix: encode enhanced pending changes 2023-09-18 20:36:24 +08:00
leeeon233
c294c61343 fix: op converter 2023-09-18 15:21:38 +08:00
leeeon233
3f3fcc11f3 refactor: map delete value 2023-09-15 13:53:30 +08:00
leeeon233
7b012dec00 fix: empty doc with pending decode snapshot 2023-09-15 11:30:43 +08:00
leeeon233
4a1f4e8647 fix: decode snapshot after pending 2023-09-13 21:23:38 +08:00
leeeon233
80a9d12ccc feat: pending remote changes, todo snapshot 2023-09-13 15:17:58 +08:00
leeeon233
fdacd62828 feat: pending bk 2023-09-12 21:40:56 +08:00
leeeon233
331dc6c994 feat: LoroValue Binary 2023-09-12 15:57:06 +08:00
leeeon233
eb8a07641f fix: decode remove unknown 2023-09-12 15:25:45 +08:00
leeeon233
dad768049e fix: new encode format 2023-09-12 14:11:28 +08:00
leeeon233
99c8529559 feat: remove gc 2023-09-12 14:11:28 +08:00
leeeon233
f1adc7d15d chore: use columnar 0.3.2 2023-09-11 14:54:54 +08:00
leeeon233
0b64a567ed fix: columnar iter name 2023-09-08 10:56:51 +08:00
leeeon233
8611509492 perf: snapshot OplogEncoded use iter 2023-09-08 09:17:26 +08:00
leeeon233
a1c3eea4f1 feat: use columnar iterable 2023-09-08 08:21:46 +08:00
leeeon233
5b0f3e3f50 feat: update columnar 2023-09-08 08:21:46 +08:00
Zixuan Chen
1ce5330828
bench: use worst case to bench in encode 2023-09-07 21:42:29 +08:00
Zixuan Chen
be63db444e
Merge branch 'main' into feat-encode-enhance 2023-09-05 17:08:41 +08:00
Zixuan Chen
9be8cad562
test: add more many_actors tests 2023-09-02 23:23:52 +08:00
Zixuan Chen
345b5bbcb9
perf: speedup when there are many peers 2023-09-02 18:19:34 +08:00
Zixuan Chen
4ecd850632
test: add import history data test 2023-08-30 17:27:22 +08:00
Zixuan Chen
1d3cd60873
fix: fix a few import panic 2023-08-30 16:41:04 +08:00
Zixuan Chen
b4b50b369d
refactor: refine internal config 2023-08-30 12:27:23 +08:00
Zixuan Chen
e196e23581
fix: sort change by ord
last commit contains error (not found yet)
2023-08-29 20:05:31 +08:00
Zixuan Chen
ca9325f5ed
perf: refine encode size (can be better) 2023-08-29 19:43:35 +08:00
Zixuan Chen
60201989ec
fix: speed up encode 2023-08-29 17:15:41 +08:00
Zixuan Chen
728002daf7
chore: add encode example to analysis perf 2023-08-29 15:19:01 +08:00
Zixuan Chen
f208744ec1
feat: encode/decode v2 2023-08-29 15:13:52 +08:00
Zixuan Chen
5b6cc28f6b
chore: add encode example to analysis perf 2023-08-28 16:16:40 +08:00
Zixuan Chen
902fe38570
chore: fix warnings and format 2023-08-28 09:41:23 +08:00
Zixuan Chen
8b8743e233 chore: fix deno dep 2023-08-16 14:54:05 +08:00
Zixuan Chen
17d1a9ea82
Feat: compressed rle update encode mode (#107)
* feat: add compressed rle update encode mode

* fix: type err

* chore: update string_cache

* chore: rm needless code
2023-08-16 11:33:55 +08:00
Zixuan Chen
ae730d2b8c fix: return err when changes should be queued 2023-08-12 23:35:49 +08:00
Zixuan Chen
05f802376e fix: checkout result err 2023-08-11 21:49:26 +08:00
Zixuan Chen
fd0cc63cb5 refactor: return result when checkout to a version
err when the specified version is not found
2023-08-11 09:32:34 +08:00
Zixuan Chen
273c0e9c78 test: add version checkout fuzzing test 2023-08-11 08:14:38 +08:00
Zixuan Chen
299f00d90f perf: fix a perf regression 2023-08-07 20:14:01 +08:00
Zixuan Chen
addadcdce5 perf: make map diff faster 2023-08-07 15:00:11 +08:00
Zixuan Chen
e15e207cab fix: diff calc err 2023-08-07 10:43:50 +08:00
Zixuan Chen
c31a4a0239 feat: get timestamp 2023-08-06 15:18:00 +08:00
Zixuan Chen
7d5ee5f6d0 perf: make import remote changes faster 2023-08-06 01:41:22 +08:00
Zixuan Chen
dc5159bf67 perf: speed up op converting 2023-08-06 01:07:08 +08:00
Zixuan Chen
a8b7d65f8a feat: import without state 2023-08-05 23:29:11 +08:00
Zixuan Chen
1b300fdc65 chore: clear logs 2023-08-05 19:51:08 +08:00
Zixuan Chen
3551bc4e99 fix: changes traveler bug
should iter every change between two version, even when
a and b are parallel to each other
2023-08-05 19:47:15 +08:00
Zixuan Chen
7ab8ccff64 refactor: return handler when inserting container 2023-08-05 16:25:31 +08:00
Zixuan Chen
f9764a2d4c
Fix DiffCalculator error when going back in history(#106) 2023-08-05 16:11:41 +08:00
Zixuan Chen
ccee201641 refactor: better interface 2023-08-05 12:44:31 +08:00
Zixuan Chen
a661b776c4
Allow commit with custom timestamp (#105) 2023-08-05 12:43:29 +08:00
Zixuan Chen
b22bd98f6b
feat: make getting child container handler simple (#104) 2023-08-05 10:23:14 +08:00
Zixuan Chen
72cc8c6ed5
fix: map version checkout err (#101) 2023-08-04 22:41:02 +08:00
Zixuan Chen
640828bf26 fix: should be readonly when doc is in detached mode 2023-08-04 14:45:22 +08:00
Zixuan Chen
db4eb64d42 refactor: oplog_frontiers & state_frontiers 2023-08-04 14:37:42 +08:00
Zixuan Chen
5ee860b74e chore: use serde 1 2023-08-04 11:09:32 +08:00
Zixuan Chen
08beb9f60b chore: rm serde requirement in append-only-bytes 2023-08-04 11:03:57 +08:00
Zixuan Chen
c105ff2220
Feat: checkout to target version & use unicode index by default (#98)
* feat: checkout to frontiers

* feat: record timestamp

* fix: use unicode len by default for text
now "你好" has length of 2 instead of 6

* chore: rm dbg!
2023-08-04 10:45:23 +08:00
Zixuan Chen
1e736df133
Refactor: rm legacy code (#97)
* refactor: rm legacy code

* chore: rm dead code

* refactor: mv refactored files outside

* refactor: rename files & methods

* chore: rm unused deps

* fix: compact bytes err

* chore: fix ci
2023-07-31 11:49:55 +08:00
Zixuan Chen
88003bdffe fix: get deep value & throw mismatched context err 2023-07-30 16:30:41 +08:00
Zixuan Chen
c461edd828 refactor: remove utf16 meta in text event
we will use utf16 index by default when feature=wasm
2023-07-29 22:24:09 +08:00
Zixuan Chen
15be521777 feat: event & wasm 2023-07-29 02:03:51 +08:00
Zixuan Chen
f63c346e5c refactor: make text fn explicit in index type 2023-07-28 13:40:08 +08:00
Zixuan Chen
f8d58ec379 refactor: use utf16 index in wasm mode 2023-07-28 13:38:52 +08:00
Zixuan Chen
fbebb5b8e8 feat: recursive emit events 2023-07-26 19:53:55 +08:00
Zixuan Chen
470d23a198 feat: subscribe for container events 2023-07-26 18:56:03 +08:00
Zixuan Chen
1ed8ad05be perf: reduce shared arena size
make it more compact and cache-friendly
2023-07-25 23:06:21 +08:00
Zixuan Chen
ef2de6f368 chore: fix a few warnings 2023-07-25 23:00:42 +08:00
Zixuan Chen
fa13d1d06f fix: list state err
update g-btree to use a get node with Option
return value
2023-07-23 00:11:46 +08:00
Zixuan Chen
b94274d8b9 fix: dead lock on list 2023-07-22 19:27:21 +08:00
Zixuan Chen
aa151a48f5 fix: typo on op -> diff 2023-07-22 19:19:11 +08:00
Zixuan Chen
b5c325b490 feat: event (buggy) 2023-07-22 19:02:22 +08:00
Zixuan Chen
874533e51a feat: add origin to doc state diff 2023-07-19 21:46:30 +08:00
Zixuan Chen
6abeba6849 refactor: rename *App to *Doc 2023-07-19 21:21:37 +08:00
Zixuan Chen
7f3bd5b0a4 feat: record diff in app state 2023-07-19 21:16:52 +08:00
Zixuan Chen
5ea68ac528 perf(encode): reduce snapshot size
it's experimental. need fuzzing
2023-07-19 12:31:49 +08:00
Zixuan Chen
9899a94f43 perf: opt encode/decode speed 2023-07-18 18:24:51 +08:00
Zixuan Chen
ac9a7e0631 perf: reduce snapshot size 2023-07-18 16:25:29 +08:00
Zixuan Chen
5beabc940b perf: reduce encoding size 2023-07-18 14:39:17 +08:00
Zixuan Chen
9d03fd787f chore: fix warnings 2023-07-18 10:10:52 +08:00
Zixuan Chen
3d3c54eb92 fix: get lamport by frontiers bug 2023-07-18 01:30:56 +08:00
Zixuan Chen
5a233501cc perf: speed up import by reducing dag nodes 2023-07-18 01:23:49 +08:00
Zixuan Chen
d03617ca26 feat: add bench 2023-07-17 23:18:18 +08:00
Zixuan Chen
20cf17e00b bench: refactored text 2023-07-17 21:24:02 +08:00
Zixuan Chen
5f5db10a6d fix: cache update in list diff calc 2023-07-17 21:02:26 +08:00
Zixuan Chen
0fac770309 fix: a few recursive bugs 2023-07-17 20:30:46 +08:00
Zixuan Chen
16ec59ddee fix: fix a few recursive_refactored bug 2023-07-17 19:09:18 +08:00
Zixuan Chen
f527de5a2f fix: fix lamport infer in change encode
lamport starts from 0 in the new version
2023-07-17 18:27:10 +08:00
Zixuan Chen
93252c9522 test: recursive fuzz test for refactored 2023-07-17 17:28:07 +08:00
Zixuan Chen
a3488c7088 feat: handlers 2023-07-17 16:04:02 +08:00
Zixuan Chen
ca977fcf39 test: text refactor fuzz 2023-07-17 15:00:40 +08:00
Zixuan Chen
e993f1b155 feat: basic snapshot encoding 2023-07-17 12:27:11 +08:00
Zixuan Chen
6983a2b00c refactor: mov loro value to loro_common 2023-07-15 00:47:47 +08:00
Zixuan Chen
fc49b4b3b4 refactor: mov important basic types into loro-common 2023-07-14 16:38:53 +08:00
Zixuan Chen
dde0152912 refactor: prepare for snapshot encoding 2023-07-14 16:05:06 +08:00
Zixuan Chen
3771566b9f refactor: integrate container type into container idx 2023-07-14 12:50:48 +08:00
Zixuan Chen
7cb6691cef test: update snapshot test 2023-07-12 21:35:06 +08:00
Zixuan Chen
d3f921bae0 refactor: replace latest_lamport with next_lamport 2023-07-12 21:34:56 +08:00
Zixuan Chen
097d86915a refactor: rm next lamport from app state diff 2023-07-12 21:29:21 +08:00
Zixuan Chen
6d2d28a721 refactor: reduce version conversion a little bit 2023-07-12 21:26:03 +08:00
Zixuan Chen
2a0f842fc5 fix: lamport issue 2023-07-12 18:47:04 +08:00
Zixuan Chen
3638e3d0ed fix: fix a encode/decode issue
exposed by fuzzing test
2023-07-12 18:17:57 +08:00
Zixuan Chen
2d47387882 refactor: txn should consume self after finished 2023-07-12 14:46:48 +08:00
Zixuan Chen
abec22cd22 fix: text sync issues 2023-07-12 12:30:36 +08:00
Zixuan Chen
f83837304e feat: basic import export pipeline 2023-07-12 03:49:11 +08:00
Zixuan Chen
8ebd41fa3d feat: connect diff calculator 2023-07-12 00:29:23 +08:00
Zixuan Chen
1f827f944e feat: basic pipeline for text 2023-07-10 23:17:39 +08:00
Zixuan Chen
a90218f229 chore: fix all warnings 2023-07-10 21:37:30 +08:00
Zixuan Chen
23a212e5f6 chore: fix warnings and rm some dead code 2023-07-10 18:35:31 +08:00
Zixuan Chen
de9a8cb9ad refactor: rm usage like Arc<LoroValue>
because LoroValue itself is cheap to clone now
2023-07-10 18:28:44 +08:00
Zixuan Chen
a90668abca refactor: make LoroValue cheap to clone 2023-07-10 18:26:49 +08:00
Zixuan Chen
4634f0ddbb feat: txn apply local op 2023-07-10 18:00:42 +08:00
Zixuan Chen
159cd9127f refactor: rename remote content to raw op content 2023-07-10 16:54:55 +08:00
Zixuan Chen
f6c7e7a8f4 refactor: rm AppStateDiff 2023-07-10 16:53:56 +08:00
Zixuan Chen
4744431ab7 refactor: move remote to local op convert to arena 2023-07-10 15:58:30 +08:00
Zixuan Chen
508ca4b5c6 refactor: use a new version of txn 2023-07-10 12:06:11 +08:00
Zixuan Chen
bdb0e26b93 refactor: use locks inside arena 2023-07-09 21:22:26 +08:00
Zixuan Chen
bc11f0a6d2 feat: init txn 2023-07-08 00:22:34 +08:00
Zixuan Chen
ba8de055b4 chore: fix warnings 2023-07-07 21:56:35 +08:00
Zixuan Chen
d2c3eead90 feat: list diff calculator 2023-07-07 21:54:47 +08:00
Zixuan Chen
179e67bd8a refactor: add a new event type for raw text event 2023-07-07 21:40:33 +08:00
Zixuan Chen
e72a97f6b7 chore: map diff calc 2023-07-07 19:12:41 +08:00
Zixuan Chen
cc4e1d02e4 feat: readonly arena 2023-07-07 15:36:19 +08:00
Zixuan Chen
fd588beee2 feat: support txn abort for states 2023-07-05 23:13:39 +08:00
Zixuan Chen
8f6a6e1cc2 feat: convert remote change to local change in oplog 2023-07-05 22:07:45 +08:00
Zixuan Chen
a0a7dc1080 test: fix fuzz test err 2023-07-05 19:08:27 +08:00
Zixuan Chen
bd4060c591 refactor: make remoteOp a borrowed type 2023-07-05 18:20:50 +08:00
Zixuan Chen
b99276ddce refactor: make local change mergeable
when they are not exposed outside
2023-07-05 15:07:05 +08:00
Zixuan Chen
f0f82fb581 refactor: seal change exp impl 2023-07-05 14:43:58 +08:00
Zixuan Chen
336bd1e497 feat: convert frontiers to version vector 2023-07-04 18:25:33 +08:00
Zixuan Chen
4a8ce16ff1 feat: new map diff and map state 2023-07-04 14:31:50 +08:00
Zixuan Chen
b747452ced refactor: replace containerIdx with ContainerID
in refactor module
2023-07-04 12:35:34 +08:00