On Save of org buffer:
- Convert Org file text into AST (Indextree representation)
- DFS over the AST and update database if there's any change in the data
- If there's a change, update the last-updated timestamp in the table and reason as org
- Pull changes from vdirsyncer
- If any changes, run vdirsyncer entrypoint
- Do conflict management if there are conflicting changes. Conflict resolution will happen through last-updated timestamp.
On vdirsyncer hook:
- Parse ics file
- Find task with UUID and update if necessary
- Check for last-updated timestamp conflict. If org wins, skip
- Update last-updated timestamp and reason as caldav
- Confict resolution
On Org win conflict:
- Convert this AST into the respective ical representation.
- Overwrite the respective ics file
- Trigger vdirsyncer to push the changes to the caldav server
On ical win conflict:
- Convert JSON back to AST
- Create ORG file from AST
- Generate ORG text and overwrite the respective file
Read org file to indextree Convert indextree to custom struct convert custom struct to ics
Read ics Convert ics into custom struct Read org file into indextree diff the tasks that need to change and maniuplate using arena mut save to org file