@@ -678,7 +678,7 @@ Loro uses a tagged value encoding system where each value is prefixed with a typ
678678| 4 | F64 | 64-bit floating point (big-endian) |
679679| 5 | Str | String value (LEB128 len + UTF-8 bytes) |
680680| 6 | Binary | Binary data (LEB128 len + bytes) |
681- | 7 | ContainerType | Container type marker (LEB128 index ) |
681+ | 7 | ContainerType | Container index (LEB128 unsigned ) |
682682| 8 | DeleteOnce | Single deletion marker |
683683| 9 | DeleteSeq | Sequence deletion |
684684| 10 | DeltaInt | Delta-encoded i32 (LEB128 signed) |
@@ -687,7 +687,7 @@ Loro uses a tagged value encoding system where each value is prefixed with a typ
687687| 13 | TreeMove | Tree node move operation |
688688| 14 | ListMove | List move operation |
689689| 15 | ListSet | List set operation |
690- | 16 | RawTreeMove | Raw tree move (internal ) |
690+ | 16 | RawTreeMove | Raw tree move (used for Tree ops in Change Blocks ) |
691691| 0x80+ | Future | Unknown/future value types |
692692
693693** Source** : ` crates/loro-internal/src/encoding/value.rs:39-161 `
@@ -788,6 +788,28 @@ Common patterns:
788788** Source** : ` crates/loro-internal/src/encoding/value.rs:480-485 ` (EncodedTreeMove struct)
789789** Source** : ` crates/loro-internal/src/encoding/value.rs:953-967 ` (read_tree_move)
790790
791+ #### RawTreeMove
792+
793+ This encoding is used by Change Blocks for Tree operations (Create/Move/Delete).
794+
795+ ```
796+ ┌──────────────────────────────────────────────────────────────────┐
797+ │ RawTreeMove Encoding │
798+ ├───────────────┬──────────────────────────────────────────────────┤
799+ │ LEB128 │ subject_peer_idx (index into peers) │
800+ │ LEB128 │ subject_cnt (TreeID counter) │
801+ │ LEB128 │ position_idx (index into positions) │
802+ │ 1 │ is_parent_null (u8 as bool) │
803+ │ LEB128 │ parent_peer_idx (only if !is_parent_null) │
804+ │ LEB128 │ parent_cnt (only if !is_parent_null) │
805+ └───────────────┴──────────────────────────────────────────────────┘
806+ ```
807+
808+ ** Source** : ` crates/loro-internal/src/encoding/value.rs:470-477 ` (RawTreeMove struct)
809+ ** Source** : ` crates/loro-internal/src/encoding/value.rs:969-987 ` (read_raw_tree_move)
810+ ** Source** : ` crates/loro-internal/src/encoding/value.rs:1122-1136 ` (write_raw_tree_move)
811+ ** Source** : ` crates/loro-internal/src/oplog/change_store/block_encode.rs:316-370 ` (TreeOp → RawTreeMove)
812+
791813#### ListMove
792814
793815```
@@ -1638,7 +1660,7 @@ To implement a complete Loro decoder/encoder, you need to handle:
16381660- [x] ContainerID encoding/decoding
16391661- [x] ContainerWrapper encoding/decoding
16401662- [x] Change Block full parsing
1641- - [x] ContainerArena encoding/decoding (serde_columnar )
1663+ - [x] ContainerArena encoding/decoding (postcard Vec )
16421664- [x] PositionArena encoding/decoding (prefix compression)
16431665- [x] Value encoding/decoding for all types
16441666- [x] serde_columnar compatible decoder
0 commit comments