# LeaP Refactor ## Concepts and assumptions * Holochain is a big [CRDT](https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type) -> you can only update an entry once * Update chains cannot have cycles * Original entry does not have link to the latest version of the entry (so it's slow to go through them all) ## Entries ```rust Entry "course" { Model: struct Course { timestamp: u64, teacher_address: Address, } Links: { course->student student->course teacher->course } } Entry "course_modules" { Model: struct CourseModules { course_address: Address, // Address of the anchor! title: String, modules: Vec<Address>, last_header_address: Option<Address>, } } Entry "module" { Model: struct Module { title: String, course_address: Address, // Address of the anchor! timestamp: u64 } Links: { module->contents } } Entry "content" { Model: struct Content { name: String, descritpion: String, url: String, timestamp: u64, module_address: Address } } ``` ## Entry relationship diagram ```mermaid graph LR subgraph Courses zome subgraph agent_id bob_id alice_id end subgraph anchors all_courses end subgraph courses Course1 end subgraph course_modules Course1 -->|last_version| CourseModules1v0 Course1 -->|last_version| CourseModules1v1 CourseModules1v0 ==>|replaced_by| CourseModules1v1 end subgraph modules Module1 end subgraph content Content1 end all_courses --> Course1 CourseModules1v0 -.->|modules| Module1 Module1 -.->|course_address| Course1 Course1 -.teacher.-> alice_id bob_id -->|student->courses| Course1 Course1 -->|course->students| bob_id alice_id -->|my_courses| Course1 Module1 -->|module->contents| Content1 Content1 -.->|module_address| Module1 end ```