Commit graph

1648 commits

Author SHA1 Message Date
Zixuan Chen
51c9b40022
fix: fork error (#493)
* fix: fork error
fixed #490

* chore: fix warnings
2024-10-03 21:08:05 +08:00
Leon Zhao
b1e03d914e
fix: do not set peer id with max (#491) 2024-10-03 21:07:11 +08:00
Zixuan Chen
a93efd5f51
refactor!: better event api (#489)
- (js) Refactor subscription mechanism to return unsubscribe function
- (rust) Implement must-use struct for subscriptions in Rust
- Enhance API ergonomics for JavaScript-like environments
- Improve resource cleanup and prevent potential memory leaks
2024-10-03 15:14:21 +08:00
Zixuan Chen
de93d34a9c
fix: return err if snapshot container has unknown container (#488) 2024-10-02 14:24:57 +08:00
Zixuan Chen
09a004e365
refactor: Loro import function should return LoroEncodeError (#487)
* refactor: Loro import function should return LoroEncodeError

- Change return type
- Add support for handling potential errors:
  - Invalid or non-existent frontiers
  - Exporting old snapshot format from trimmed snapshot doc
- Improve compatibility with trimmed docs

* fix: add tests and fix a few places that need to return err
2024-10-02 11:11:08 +08:00
Zixuan Chen
31bc451fbf
Refactor rename new snapshot mode (#486)
* refactor: rename gc snapshot to trimmed snapshot

* refactor: mv
2024-10-01 16:49:38 +08:00
Zixuan Chen
c8a60977c1
Refactor!: List state snapshot schema for v1.0 (#485)
* refactor!: change how we encode list state for fast-snapshot

* perf: speedup tree decode

* test: add movable list state snapshot test

* chore: add state encoding overhead test

* fix: error about invalid tree node creation

* chore: update example

---------

Co-authored-by: Leon Zhao <leeeon233@gmail.com>
2024-10-01 16:11:53 +08:00
Zixuan Chen
6d04066cd0
refactor: avoid footgun of impl ord for cid 2024-09-30 18:09:49 +08:00
Zixuan Chen
37ed452bc5
fix: checkout diff-calc cache issue 2024-09-30 16:39:27 +08:00
Zixuan Chen
5688a017d6
Fix warnings (#484)
* fix: warnings

* fix: warnings
2024-09-29 21:15:19 +08:00
东灯
df0e061dbf
feat: add dag allocation tree algorithm (#415)
* feat: add allocation algorithm

* test: add test

* perf: split struct for effective multiplex

* perf: code style

* test: add dfs check

* fix: rename gen to gen_graph

* fix: problem of multiple starting points

* perf: use fast log

* chore: rename `gen` to `generate`

* perf: use fxhash

* feat: lamport split algorithm

* feat: lamport split done

* fix: remove min import

* feat: add dfs test

* feat: dag

* feta: fix fuzz

* feat: add test_alloc_fuzz

* feat: add bfs algorithm

* feat: bfs

* test: add fuzz

* test: chang fuzz rule

* chore: clean up

---------

Co-authored-by: Zixuan Chen <remch183@outlook.com>
2024-09-29 14:19:19 +08:00
Zixuan Chen
a66dbd6fe6
pref: optimize diff calc cache use (#475)
* pref: optimize diff calc cache use

* fix: type err
2024-09-29 14:01:27 +08:00
Leon Zhao
4414053a82
feat: add FFI for Loro (#420)
* chore: init ffi

* feat: impl doc and LoroList

* feat: impl containers

* feat: unknown container

* feat: event ffi

* chore: clean

* feat: ffi undo manager

* chore: cargo fix

* chore: cargo fix

* fix: ffi value or container

* fix: ffi arc

* fix: is attached for movable list

* bk

* feat: all LoroDoc func

* feat: refine vv

* feat: ffi frontiers

* feat: ffi awareness

* fix: merge
2024-09-29 07:41:59 +08:00
Zixuan Chen
5e3f269c8c
refactor!: don't wait for commit to update version info 2024-09-27 03:58:06 +08:00
Zixuan Chen
0c8402ed70
refactor: rm compact state store
it may introduce weird bug
2024-09-27 02:44:33 +08:00
Zixuan Chen
812de54ad0
refactor: replace all .lock() with .try_lock()
to avoid deadlock when using Loro with multi-thread
2024-09-27 02:43:00 +08:00
Zixuan Chen
6e645bff19
feat: compact state store 2024-09-26 22:48:14 +08:00
Zixuan Chen
25fc083da9
perf: optimize tree cache find children speed 2024-09-26 17:13:08 +08:00
Zixuan Chen
8252a5ae97
feat: travel change's ancestors (#483) 2024-09-26 12:15:42 +08:00
Zixuan Chen
95931ba238
perf: make shrink frontiers faster when the peer num is large (#482) 2024-09-26 11:44:17 +08:00
Zixuan Chen
fe85805327
refactor: provide all version info for diff calc instance
This can avoid the use of shrink_frontiers
2024-09-26 10:14:27 +08:00
Zixuan Chen
e25b93c491
chore: use cached diff calc 2024-09-26 00:25:39 +08:00
Zixuan Chen
35854743f0
fix: checkout into middle of marks 2024-09-25 23:00:01 +08:00
Zixuan Chen
672062c9d1
fix: gc snapshot error (#481)
it should retain all containers created after the `from` version
2024-09-25 22:35:29 +08:00
Zixuan Chen
f1bb4f1020
test: make awareness more robust 2024-09-25 20:54:49 +08:00
Zixuan Chen
cec99f8f7e
feat: add clear methods (#478)
* feat: add clear method

* feat: expose clear fn to wasm and rust
2024-09-25 20:50:55 +08:00
Zixuan Chen
66047f7909
feat: update text by line (#480) 2024-09-25 20:50:36 +08:00
Zixuan Chen
78aaa4080d
Fix tree cache checkout issue and add a few invariance checks (#479)
* test: test failed if use non-cached diff calc

* fix: tree diff calc retreat cache current vv

* feat(wasm): commit message & get pending ops length

* bk

* chore: add tree one doc fuzz

* fix: fix the problem and added a few checks

* chore: rm debugging code

* fix: encode snapshot when detached

---------

Co-authored-by: leeeon233 <leeeon233@gmail.com>
2024-09-25 20:50:10 +08:00
Leon Zhao
261cdda674
fix: get correct tree_cache current vv when retreating (#476)
* test: test failed if use non-cached diff calc

* fix: tree diff calc retreat cache current vv

* fix: better tree cache current vv

---------

Co-authored-by: Zixuan Chen <remch183@outlook.com>
2024-09-25 20:38:26 +08:00
Zixuan Chen
6bb424d65f
feat(wasm): commit message & get pending ops length (#477) 2024-09-25 20:38:10 +08:00
Zixuan Chen
18855bafd3
chore: bump version 2024-09-24 18:10:02 +08:00
Zixuan Chen
c6f1a4c0ae
fix(wasm): type err 2024-09-24 18:08:29 +08:00
Zixuan Chen
bef39ce6b5
Feat: allow editing on detached mode (#473)
* refactor: add detached editing config and prepare the architecture for editing detached doc

* feat: subscribe for peer id change

* fix: undo after checkout & add tests for detached editing

* test: add fuzzer for detached editing

* feat: expose detached editing configure to wasm

* test: add wasm test for detached editing
2024-09-24 11:16:59 +08:00
Zixuan Chen
88e9ec9595
Fix: should not emit event when exporting gc-snapshot (#471)
* test: add no event test

* fix: should not emit event when exporting gc snapshot

* fix: not emitting events when exporting state only snapshot

* fix: type error
2024-09-24 10:38:00 +08:00
Zixuan Chen
2016f31f54
fix: cursor behavior when using gc-snapshot (#472) 2024-09-24 10:28:16 +08:00
Zixuan Chen
1082af0d46
Fix: get tree's alive children correctly (#474)
* test: add a failed case

* fix: get tree's alive children correctly
2024-09-24 10:27:57 +08:00
Zixuan Chen
082a9c1ab8
chore: make tree parent id pub on loro crate 2024-09-23 11:40:02 +08:00
Zixuan Chen
9294648c8e
chore: 1.0-alpha.2 2024-09-23 10:20:28 +08:00
Zixuan Chen
bdf006ed2e
feat: fork doc at the target version (#469) 2024-09-23 09:51:07 +08:00
Leon Zhao
3fe619bc81
refactor: use hierarchy value for tree value (#470)
* refactor: use hierarchy value for tree value

* fix: get_container_deep_value_with_id

* feat: get tree nodes by flat format
2024-09-23 09:05:12 +08:00
Zixuan Chen
bb494df230
chore: bump version to v1.0.0-alpha.1 2024-09-20 18:16:49 +08:00
Leon Zhao
aab6730b4d
fix: tree undo when converting movement to creation, new target id should be used (#468)
* test: a checkout event err

* fix: tree undo convert moving to creating should use new target tree id

---------

Co-authored-by: Zixuan Chen <remch183@outlook.com>
2024-09-20 16:51:37 +08:00
Zixuan Chen
d460346585
feat: jsonpath experimental support (#466)
* feat: jsonpath experimental support

* fix: add support for negative index unionindex and unionkey

* chore: export lorodoc in loro-js and fix a few tests related to map's entries order

* chore: fix type err
2024-09-19 19:22:39 +08:00
Leon Zhao
7f9bfa8a85
refactor: tree contains & isDeleted (#467) 2024-09-19 11:21:54 +08:00
Zixuan Chen
1ea2a24d74
fix: export snapshot error on a gc doc 2024-09-19 11:08:34 +08:00
Zixuan Chen
e592d4f830
fix: raise error if moving a deleted node 2024-09-17 16:04:00 +08:00
Zixuan Chen
76803506b6
feat: add new cid method to js binding 2024-09-17 13:05:06 +08:00
Zixuan Chen
8dcb619147
fix: raise error if perform action on a deleted container (#465)
- Add ContainerDeleted error variant to LoroError
- Implement is_deleted() method for container handlers
- Check for deleted containers before applying operations
- Add dead_containers_cache to DocState to track deleted containers
- Update apply_diff to optionally clear dead container cache
- Add tests for handling operations on deleted containers
- Implement checkout to reset container deleted cache
- Minor code cleanup and typo fixes
2024-09-17 12:09:20 +08:00
Zixuan Chen
2f38708a50
Fix a tree checkout issue on GcSnapshot (#464)
* test: a failed test case

* fix: tree checkout init err

* fix: export from

* chore: add cov

* fix: movable list undo/redo apply delta err

* refactor: refactor by o1-preview 🤯

* refactor: extract arguments

* test: add cov

* fix: use correct method to get was_alive for tree node

* fix: tree event was alive err

---------

Co-authored-by: Leon Zhao <leeeon233@gmail.com>
2024-09-17 00:19:29 +08:00
Zixuan Chen
0f1df49b9e
feat: add state only snapshot & refine check slow test 2024-09-13 22:35:43 +08:00