Commit graph

37 commits

Author SHA1 Message Date
Zixuan Chen
479c2268f3
feat: UndoManager's onPush now can access the change event (#588)
Include `origin` and `commitMessage` in the UndoManager's onPush and onPop #584
2024-12-23 11:49:35 +08:00
Zixuan Chen
01fccc5a7d
feat: return import status in import_batch method (#573)
Some checks are pending
Release WASM / Release (push) Waiting to run
Test All / build (push) Waiting to run
* feat: return import status in import_batch method

* feat(wasm): add importUpdateBatch returned status support

* chore: add changeset update

* chore: update ffi return type
2024-12-09 16:31:21 +08:00
Zixuan Chen
0325061476
fix: dead loop when importing updates (#570)
Fix the dead loop issue here: https://gist.github.com/sunflowerdeath/c0e2b46b6f5d2e32d368f8e04f730237

# Reason for the Dead Loop in `find_common_ancestor`

### Original Assumptions

1. **Dependency Assumption**

   If a DagNode is depended upon by other nodes, the direction of this dependency will only point to before the end of the node. This assumption is used in system design.

2. **Node Overlap Assumption**

   DagNodes do not overlap with each other. When retrieving DagNodes from two different positions:
   - They are either completely identical
   - Or they do not overlap at all
   - If there is overlap, it means they are the same node

### Current Issues

1. **Issues Caused by Lazy Loading**

   Due to the use of lazy loading, new situations have arisen. Initially:
   - A certain DagNode is not depended upon by other DagNodes
   - Therefore, the initially retrieved form is complete

2. **Impact of Subsequent Loading**

   After loading additional DagNodes:
   - The newly loaded DagNode may depend on the internal position of the previously complete DagNode
   - This causes the originally complete DagNode to be split into multiple smaller DagNodes

3. **Violation of Original Assumptions**

   In this case, when retrieving the content of the original DagNode again:
   - Other DagNode dependencies may appear in the middle
   - There may be overlaps on the DagNode
   - This violates the original design assumptions

# Fix Approach

Remove the assumption in the original implementation that "overlapping DagNodes will not occur." When overlapping DagNodes are found, retain the shorter one and remove the longer one.
2024-11-29 13:01:15 +08:00
leeeon233
a6f3ddfcd9
fix: miss an export mode in ffi
Some checks failed
Release WASM / Release (push) Has been cancelled
Test All / build (push) Has been cancelled
2024-11-28 15:03:05 +08:00
leeeon233
67f7fa54d2 chore: clean 2024-11-28 14:49:54 +08:00
leeeon233
5855bf0ebc fix: ffi export mode 2024-11-28 14:49:54 +08:00
Leon Zhao
76c630027a feat: update loro-ffi to v1.1.3
Some checks are pending
Release WASM / Release (push) Waiting to run
Test All / build (push) Waiting to run
2024-11-27 16:35:41 +08:00
Zixuan Chen
4f0d499d4b
perf: use a priority-queue-based search for updating text (#544)
* perf: use a priority-queue-based search for updating text

It tends to produce diffs with more continuous edits,
which is more efficient when we need to apply them to CRDTs

* fix: use better text diff calc

* refactor: add text update options struct

* chore: update text.update comments

* chore: fix warnings

* fix: rm a dumb optimization
2024-11-09 16:35:15 +08:00
Zixuan Chen
8486234aba
fix: get correct encode blob info (#545)
* fix: get correct encode blob info

* fix: is_snapshot

* test: fix test case

* test: update ts tests

* chore: add change file

* chore: fix warnings
2024-11-09 15:43:11 +08:00
Zixuan Chen
715bf759c3
refactor!: reduce footguns when using for_each(fn) on rust (#540)
Some checks are pending
Release WASM / Release (push) Waiting to run
Test All / build (push) Waiting to run
2024-11-09 01:07:38 +08:00
Zixuan Chen
f78e1da8a0
refactor(rust): extract LoroStringValue, LoroMapValue, LoroBinaryValue, LoroListValue (#535)
* refactor: extract LoroStringValue LoroMapValue LoroListValue LoroBinaryValue

* chore: clippy fix

* chore: fix warning
2024-11-04 17:03:14 +08:00
Zixuan Chen
d872ac6488
fix: avoid auto unsubscribe (due to gc) in js env (#516)
* fix: avoid auto unsubscribe (due to gc) in js env

* fix: drop subscription if the subscriber is dropped

* perf: use manually drop

* fix: rm once_cell dep

* fix: should call unsubscribe
2024-10-17 13:33:29 +08:00
Zixuan Chen
e14f81aa37
perf: optimize high concurrency performance (#514)
* perf: optimize high concurrency performance

* fix: err

* chore: fix warnings
2024-10-16 12:01:31 +08:00
Leon Zhao
9680be4103
fix: ffi remove try unwrap (#506) 2024-10-10 20:13:59 +08:00
Leon Zhao
5914d32b38
fix: ffi Subscription (#505) 2024-10-10 15:14:39 +08:00
Zixuan Chen
c8f776f018
Refactor rename trimmed snapshot to shallow snapshot (#499)
* refactor: rename trimmed snapshot to shallow snapshot

* refactor: rename trimmed_vv and trimmed_frontiers

* refactor: rename rest of trimmed* into shallow*

* chore: rename cov message

* chore: fix warnings
2024-10-08 13:15:14 +08:00
Leon Zhao
f598b0e1e7
fix: ffi new sub import status (#497) 2024-10-06 10:28:55 +08:00
Leon Zhao
405cbe047c
feat: add import status (#494) 2024-10-05 08:18:12 +08:00
Zixuan Chen
e3a7757610
refactor: change the first param of travel change from id to ids (#492)
* refactor: change the first param of travel change from id to ids

* fix: fix all warnings and refine the impl of subscription

* chore: use pnpm
2024-10-03 21:09:18 +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
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
5688a017d6
Fix warnings (#484)
* fix: warnings

* fix: warnings
2024-09-29 21:15:19 +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
454b4088a6
chore(rs): bump versions of rust crates 2024-04-09 16:23:48 +08:00
Zixuan Chen
2ad7202e05
Feat-rust-api (#193) 2023-11-28 16:22:43 +08:00
leeeon233
c4b753dfd8 chore: add license 2023-11-12 23:23:12 +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
23a212e5f6 chore: fix warnings and rm some dead code 2023-07-10 18:35:31 +08:00
Zixuan Chen
ba8de055b4 chore: fix warnings 2023-07-07 21:56:35 +08:00
Zixuan Chen
f0f82fb581 refactor: seal change exp impl 2023-07-05 14:43:58 +08:00
leeeon233
271250ba05 feat: add java bindgen 2023-01-29 17:48:37 +08:00
leeeon233
8f739178e7 feat: add go bindgen 2023-01-29 17:48:37 +08:00
leeeon233
c10b1237e0 chore: rebase main 2023-01-29 17:48:37 +08:00
leeeon233
c56d5327da chore: add readme.md 2023-01-29 17:48:37 +08:00
leeeon233
95309db710 feat: impl C ffi 2023-01-29 17:48:37 +08:00
leeeon233
a26d4b0122 feat: init ffi 2023-01-29 17:48:37 +08:00