2022-07-25 05:00:22 +00:00
|
|
|
{
|
2022-11-18 13:16:29 +00:00
|
|
|
"cSpell.words": [
|
|
|
|
"arbtest",
|
2024-01-18 05:28:28 +00:00
|
|
|
"bolds",
|
2024-08-24 06:16:06 +00:00
|
|
|
"bools",
|
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 09:03:24 +00:00
|
|
|
"cids",
|
2022-11-21 04:50:15 +00:00
|
|
|
"clippy",
|
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 09:03:24 +00:00
|
|
|
"collab",
|
2024-08-30 03:44:34 +00:00
|
|
|
"curr",
|
2022-12-27 06:18:46 +00:00
|
|
|
"dhat",
|
2022-11-18 13:16:29 +00:00
|
|
|
"flate",
|
2024-03-08 08:40:06 +00:00
|
|
|
"fuzzer",
|
2022-12-27 06:18:46 +00:00
|
|
|
"gmax",
|
2024-09-03 06:04:43 +00:00
|
|
|
"GPUI",
|
2022-12-06 08:34:46 +00:00
|
|
|
"heapless",
|
2024-08-19 03:36:59 +00:00
|
|
|
"Helloii",
|
|
|
|
"Hoexllo",
|
Movable List (#293)
* bk: add move op content
* bk: add inner_movable_list diff and related stuff
* perf: high perf state
* fix: update old list item cache
* fix: should use id in del
* feat: two kinds of len for movable list state
* bk: add op index to movable list
* bk: make basic handler test pass
* refactor: add move_from to list event
* fix: make all existing tests pass
* bk: list move event hint into event
* bk: convert inner event into user event
Co-authored-by: Leon <leeeon233@gmail.com>
* fix: convert issue when inserting new value
* feat: add op group for movable list
* feat: diff calc
* feat: add mov support to tracker
* fix: when applying diff, state should be force update
* feat: encoded op
* feat: snapshot encode
* fix: pass basic sync
* fix: snapshot encode/decode
* fix: warnings
* feat: expose mov list to loro crate
* test: fuzz movable list
* test: fix fuzz integration
* fix: movable list basic move sync
* fix: movable list events
* fix: movable event err
* fix: register child container on movable list
* fix: should not return child index if the value is already overwritten
* fix: local event err in movable list
* fix: get elem at pos
* refactor: extract mut op that could break invariants
* fix: event err
* fix: child container to elem err
* fix: bringback event issue
* fix: event err
* fix: event emit
* fix: id to cursor iter issue
* chore: fix a few warnings
* fix: warnings
* fix: fix move in tracker
* test: add consistency check
* test: fix tracker
* refactor: simplify event conversion in docstate
* refactor: refine move event
* refactor: simplify the maintain of parent child links
* fix: revive err
* fix: warnings
* fix: it's possible that pos change but cannot find the respective list item
* fix: elem may be dropped after snapshot
* fix: warnings
* fix: richtext time travel issue
* fix: move op used wrong delete id on tracker
* fix: handle events created by concurrent moves correctly
* fix: event hint error, used op index for list event
* fix: move_from flag err
* fix: id to cursor get err
* test: add mov fuzz target
* fix: the pos of inserting new container
* fix: used wrong event hint index
* fix: del event hint
* fix: warnings
* fix: internal diff to event err
* fix: event's move flag error
This "move" flag does not actually mean that the insertion
is caused by the move op.
就算是 move 造成的它不一定就能是 true
它得是下游真的能在“前一个版本的 array 里找到“,才能是 true
* fix: remove redundant elements from the movable list
The Movable List is currently flawed; an element may not exist on the movable list state, yet there are operations that revive its corresponding list item. In such cases, the diff calculation does not send back the corresponding element state (this occurs when tracing back, which fuzz testing currently does not cover. It might only be exposed by randomly switching to a version and then checking for consistency; otherwise, as long as all elements are in memory, this problem does not arise).
Moreover, there is no need to store elements in the state that do not have a corresponding list item. They will be deleted during the Snapshot, and relying on "them still being in the state" is incorrect behavior. Such adjustments also eliminate the need to maintain the `pending_elements` field.
By allowing the opgroup to record the mapping from pos id to state id, we can ensure that the events sent to the movable list state will include the corresponding state.
Movable List 现在是有错的,elem 可能不存在 movable list state 上,但是又有操作把它对应的 list item 复活了,此时 diff calc 不会把对应 element 状态发送回来(往前回溯的时候会出现,fuzz 现在没覆盖到。得有随意切换一个版本然后 check consistency 才可能会暴露;否则现在大家 elements 都在内存,就没这个问题)
而且我们没有必要在状态中存储没有对应 list item 的 element。在 Snapshot 的时候它们都会被删掉,如果依赖了“它们还会在 state 内”就是错误的行为。这样的调整也让我们不需要去维护 pending_elements 这个 field 了
通过让 opgroup 记录了 pos id → state id 的映射,可以保证发给 movable list state 的事件中会带上对应的 state
* test: make fuzzer stricter
* test: test expectation error
* refactor: rename stable pos to cursor
* tests: chore list bench init
* test: add bench
* bench: add mov & set bench
* feat(wasm): movable list js api
* fix: make movablelist able to attach even if it's already attached & refine the type of subscribe
* fix: remove the loro doc param in .unsub
* refactor: refine ts types and export setContainer api
* chore: fix warnings
* chore: rm debug logs
* perf: reduce mem usage of opgroup
* bench: add list criterion bench
---------
Co-authored-by: Leon <leeeon233@gmail.com>
2024-04-26 04:08:53 +00:00
|
|
|
"idlp",
|
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 09:03:24 +00:00
|
|
|
"idspan",
|
2023-09-11 03:12:18 +00:00
|
|
|
"insta",
|
2024-01-11 14:49:18 +00:00
|
|
|
"Itertools",
|
2024-08-19 03:36:59 +00:00
|
|
|
"Kleppmann",
|
2024-01-21 11:51:27 +00:00
|
|
|
"lamports",
|
2022-11-18 13:16:29 +00:00
|
|
|
"Leeeon",
|
2024-08-19 03:36:59 +00:00
|
|
|
"Liangrun",
|
2022-11-18 13:16:29 +00:00
|
|
|
"LOGSTORE",
|
2023-02-07 02:24:25 +00:00
|
|
|
"napi",
|
2022-11-21 04:50:15 +00:00
|
|
|
"nextest",
|
2024-01-12 08:47:44 +00:00
|
|
|
"opgroup",
|
2023-06-29 08:09:42 +00:00
|
|
|
"oplog",
|
2024-01-12 08:47:44 +00:00
|
|
|
"opset",
|
2023-03-01 06:12:05 +00:00
|
|
|
"peekable",
|
2022-11-18 13:16:29 +00:00
|
|
|
"Peritext",
|
Movable List (#293)
* bk: add move op content
* bk: add inner_movable_list diff and related stuff
* perf: high perf state
* fix: update old list item cache
* fix: should use id in del
* feat: two kinds of len for movable list state
* bk: add op index to movable list
* bk: make basic handler test pass
* refactor: add move_from to list event
* fix: make all existing tests pass
* bk: list move event hint into event
* bk: convert inner event into user event
Co-authored-by: Leon <leeeon233@gmail.com>
* fix: convert issue when inserting new value
* feat: add op group for movable list
* feat: diff calc
* feat: add mov support to tracker
* fix: when applying diff, state should be force update
* feat: encoded op
* feat: snapshot encode
* fix: pass basic sync
* fix: snapshot encode/decode
* fix: warnings
* feat: expose mov list to loro crate
* test: fuzz movable list
* test: fix fuzz integration
* fix: movable list basic move sync
* fix: movable list events
* fix: movable event err
* fix: register child container on movable list
* fix: should not return child index if the value is already overwritten
* fix: local event err in movable list
* fix: get elem at pos
* refactor: extract mut op that could break invariants
* fix: event err
* fix: child container to elem err
* fix: bringback event issue
* fix: event err
* fix: event emit
* fix: id to cursor iter issue
* chore: fix a few warnings
* fix: warnings
* fix: fix move in tracker
* test: add consistency check
* test: fix tracker
* refactor: simplify event conversion in docstate
* refactor: refine move event
* refactor: simplify the maintain of parent child links
* fix: revive err
* fix: warnings
* fix: it's possible that pos change but cannot find the respective list item
* fix: elem may be dropped after snapshot
* fix: warnings
* fix: richtext time travel issue
* fix: move op used wrong delete id on tracker
* fix: handle events created by concurrent moves correctly
* fix: event hint error, used op index for list event
* fix: move_from flag err
* fix: id to cursor get err
* test: add mov fuzz target
* fix: the pos of inserting new container
* fix: used wrong event hint index
* fix: del event hint
* fix: warnings
* fix: internal diff to event err
* fix: event's move flag error
This "move" flag does not actually mean that the insertion
is caused by the move op.
就算是 move 造成的它不一定就能是 true
它得是下游真的能在“前一个版本的 array 里找到“,才能是 true
* fix: remove redundant elements from the movable list
The Movable List is currently flawed; an element may not exist on the movable list state, yet there are operations that revive its corresponding list item. In such cases, the diff calculation does not send back the corresponding element state (this occurs when tracing back, which fuzz testing currently does not cover. It might only be exposed by randomly switching to a version and then checking for consistency; otherwise, as long as all elements are in memory, this problem does not arise).
Moreover, there is no need to store elements in the state that do not have a corresponding list item. They will be deleted during the Snapshot, and relying on "them still being in the state" is incorrect behavior. Such adjustments also eliminate the need to maintain the `pending_elements` field.
By allowing the opgroup to record the mapping from pos id to state id, we can ensure that the events sent to the movable list state will include the corresponding state.
Movable List 现在是有错的,elem 可能不存在 movable list state 上,但是又有操作把它对应的 list item 复活了,此时 diff calc 不会把对应 element 状态发送回来(往前回溯的时候会出现,fuzz 现在没覆盖到。得有随意切换一个版本然后 check consistency 才可能会暴露;否则现在大家 elements 都在内存,就没这个问题)
而且我们没有必要在状态中存储没有对应 list item 的 element。在 Snapshot 的时候它们都会被删掉,如果依赖了“它们还会在 state 内”就是错误的行为。这样的调整也让我们不需要去维护 pending_elements 这个 field 了
通过让 opgroup 记录了 pos id → state id 的映射,可以保证发给 movable list state 的事件中会带上对应的 state
* test: make fuzzer stricter
* test: test expectation error
* refactor: rename stable pos to cursor
* tests: chore list bench init
* test: add bench
* bench: add mov & set bench
* feat(wasm): movable list js api
* fix: make movablelist able to attach even if it's already attached & refine the type of subscribe
* fix: remove the loro doc param in .unsub
* refactor: refine ts types and export setContainer api
* chore: fix warnings
* chore: rm debug logs
* perf: reduce mem usage of opgroup
* bench: add list criterion bench
---------
Co-authored-by: Leon <leeeon233@gmail.com>
2024-04-26 04:08:53 +00:00
|
|
|
"pointee",
|
2024-01-30 01:54:54 +00:00
|
|
|
"reparent",
|
2022-11-21 04:50:15 +00:00
|
|
|
"RUSTFLAGS",
|
2022-11-18 13:16:29 +00:00
|
|
|
"smstring",
|
2024-08-30 03:44:34 +00:00
|
|
|
"sstable",
|
2024-08-19 03:36:59 +00:00
|
|
|
"Stewen",
|
2022-11-18 13:16:29 +00:00
|
|
|
"thiserror",
|
2023-10-29 06:02:13 +00:00
|
|
|
"tinyvec",
|
2022-11-18 13:16:29 +00:00
|
|
|
"txns",
|
2024-01-18 05:28:28 +00:00
|
|
|
"typeparam",
|
2023-10-29 06:02:13 +00:00
|
|
|
"unbold",
|
2024-05-07 06:01:13 +00:00
|
|
|
"Uncreate",
|
2023-11-05 07:53:33 +00:00
|
|
|
"unexist",
|
2023-11-01 12:02:05 +00:00
|
|
|
"unmark",
|
2024-01-18 05:28:28 +00:00
|
|
|
"unmergeable",
|
2024-09-29 13:15:19 +00:00
|
|
|
"Unsubscriber",
|
2022-11-18 13:16:29 +00:00
|
|
|
"yspan"
|
|
|
|
],
|
2022-08-11 12:12:47 +00:00
|
|
|
"rust-analyzer.runnableEnv": {
|
2023-10-30 06:16:50 +00:00
|
|
|
"RUST_BACKTRACE": "full",
|
2024-09-12 12:07:57 +00:00
|
|
|
"DEBUG": "*"
|
2022-09-16 14:15:58 +00:00
|
|
|
},
|
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 09:03:24 +00:00
|
|
|
"rust-analyzer.cargo.features": [
|
2024-09-19 11:22:39 +00:00
|
|
|
"jsonpath",
|
2024-09-24 03:16:59 +00:00
|
|
|
"counter",
|
|
|
|
"test_utils"
|
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 09:03:24 +00:00
|
|
|
],
|
2022-10-08 18:04:41 +00:00
|
|
|
"editor.defaultFormatter": "rust-lang.rust-analyzer",
|
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 09:03:24 +00:00
|
|
|
"rust-analyzer.server.extraEnv": {
|
|
|
|
"RUSTUP_TOOLCHAIN": "stable"
|
|
|
|
},
|
2022-10-08 18:04:41 +00:00
|
|
|
"editor.formatOnSave": true,
|
2022-09-16 14:15:58 +00:00
|
|
|
"todo-tree.general.tags": [
|
|
|
|
"BUG",
|
|
|
|
"HACK",
|
|
|
|
"FIXME",
|
|
|
|
"TODO",
|
2022-10-15 02:26:58 +00:00
|
|
|
"FUTURE",
|
2024-03-02 11:10:33 +00:00
|
|
|
"PERF",
|
2022-09-16 14:15:58 +00:00
|
|
|
"XXX",
|
|
|
|
"[ ]",
|
|
|
|
"[x]"
|
2022-10-16 16:00:49 +00:00
|
|
|
],
|
|
|
|
"explorer.fileNesting.patterns": {
|
|
|
|
"*.rs": "${capture}.excalidraw"
|
|
|
|
},
|
2022-10-31 04:22:07 +00:00
|
|
|
"excalidraw.theme": "dark",
|
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 09:03:24 +00:00
|
|
|
"deno.enable": false,
|
2023-10-29 06:02:13 +00:00
|
|
|
"cortex-debug.variableUseNaturalFormat": true,
|
2024-03-29 22:53:22 +00:00
|
|
|
"[markdown]": {},
|
2024-01-30 01:54:54 +00:00
|
|
|
"[typescript]": {
|
2024-09-24 03:16:59 +00:00
|
|
|
"editor.defaultFormatter": "vscode.typescript-language-features"
|
2024-03-29 22:53:22 +00:00
|
|
|
},
|
2024-07-25 11:14:02 +00:00
|
|
|
"vitest.enable": true,
|
|
|
|
"[shellscript]": {
|
|
|
|
"editor.defaultFormatter": "foxundermoon.shell-format"
|
|
|
|
}
|
2022-07-25 05:00:22 +00:00
|
|
|
}
|