English | 한국어
This project demonstrates an implementation of the CRDT (Conflict-free Replicated Data Type) called RGA (Replicated-Growable Array), along with a simple demo page that showcases its functionality.
- Goal: Utilize the RGA package to build a simple document-editing feature
- Key Components:
src/components/editor.tsx: Text editor UIsrc/hooks/use-rga-document.ts: Hook that imports and manages RGA logic in the local statelib/mock-socket.ts,event-bus.ts: Simplified network simulation to send and receive operations across multiple tabs (windows)
- Start the development server by running the following command in the root directory:
pnpm dev:demo
- Then open the provided local address in your browser to view the demo.
-
Implementation Details:
- Core CRDT RGA algorithm logic (
doc.ts,node.ts,operation-token.ts, etc.) - Includes Lamport Clock, node linking, and
Tombstone(deleted node) handling for concurrent editing
- Core CRDT RGA algorithm logic (
-
Tests:
- The
__test__folder contains various test files to validate the logic - Examples:
doc.test.ts,node.test.ts,operation-token.test.ts,lamport-clock.test.ts, etc.
- The
- To run the test scripts for the RGA package:
pnpm test:rga
- This command executes the unit tests for the RGA logic.