The backend folder contains all our backend code 🤯. Theres a few important folders:
-
- Package contains all database specific code (basically just contexts + repositories)
- Repositories are repositories, just provide methods for interacting with the database
- Contexts are actual database connections, theres a
testing_context
and a normallive_context
, thetesting_context
wraps all SQL queries in a transaction and rolls them back once testing has finished andlive_context
does nothing special 🙁
-
- Contains all our HTTP handlers + methods for decorating those handlers, additionally provides methods for attaching handlers to a
http.ServeMux
- Contains all our HTTP handlers + methods for decorating those handlers, additionally provides methods for attaching handlers to a
-
- There are currently 3 different editor backends, once the OT backend is fully complete this will collapse down to just OT
- The OT folder contains our implementation of the operational transform algorithm, specifically Google WAVE OT
- The pessimistic editor is a lock based editor, instead of implementing an optimistic concurrency protocol it simply locks the editor while a conflicting client is using it
- The diffsync folder contains all the backend code for synchronisation (bit of a mess right now 😭). It is essentially just a big implementation for the differential sync algorithm and supports extension via the construction of
extensions
- The package allows multiple clients to be connected to the same document and ensures that each client sees the exact same document state (via a best effort diff + patch)
- Currently only works on strings with no inheret structure but in the future will work on JSON documents too 😀
- There are currently 3 different editor backends, once the OT backend is fully complete this will collapse down to just OT
-
- Methods/packages that can be used to retrieve information about the current environment and other internal utilities
-
- WIP TypeScript implementation of client server for operational transform
Most of the complexity of the CMS backend is within the editor, to aid with your tickets we have accumilated a few great resources that are worth a read.
- A survey of OT algorithms
- The Jupiter Operational Transform Algorithm
- Google Wave OT (Multi-client single server OT)
- Transformation algorithms for ordered n-ary trees
- Differental Synchronisation
If this is your first time using Go then the following resources might be of some use: