project_note
Clone
https://git.tahinli.com/Tahinli/project_note.git
0 watching0 forksRust3.6 MiBc49f5e7Tahinli1 month ago2 commits
Encoding Guidelines
This module owns Loro import/export formats. Read ../../../../context/internal-encoding.md for the verified map of supported modes, outdated modes, shallow snapshots, JSON schema, and validation entry points.
Local Entry Points
../encoding.rs:ExportMode,EncodeMode, 22-byteloroheader, checksum validation, top-level dispatch, anddecode_import_blob_meta.fast_snapshot.rs: currentFastSnapshotandFastUpdatesbody layouts.shallow_snapshot.rs:ShallowSnapshot,StateOnly, andSnapshotAt. Shallow exports null dead rich-text style values before the state KV is exported; read ../../../../context/shallow-snapshot-style-redaction.md before changing that pass or the surrounding branch structure.json_schema.rs: JSON updates, peer compression, validation, import/export, and redaction.outdated_encode_reordered.rs: legacy-named op/value columnar helpers still used by current fast paths; do not confuse this with unsupported top-level outdated blob modes.value.rs,value_register.rs,arena.rs: op/value encoding support.
Rules
- Current binary modes are
FastSnapshot = 3andFastUpdates = 4. - Top-level
OutdatedRle = 1andOutdatedSnapshot = 2are compatibility detections, not formats to extend. - Malformed bytes or JSON schema should return
Err, not partially import. - Snapshot import/export must preserve rollback and attached/detached state invariants.
- Unknown container types must block shallow/state snapshot export rather than producing a blob that cannot be decoded correctly.
Validation
cargo test -p loro-internal import_atomicitycargo test -p loro-internal decode_updates_rejects_truncated_blockcargo test -p loro-internal --test mergeable_containerwhen snapshot changes can affect mergeable child retention.- Root
pnpm testfor shared import/export semantic changes.