💾 Archived View for jb55.com › ward.asia.wiki.org › three-layer-storage captured on 2022-01-08 at 13:48:20. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-04)
-=-=-=-=-=-=-
I have improved some code paths in pageHandler but there are many opportunities for simplification remaining. I have worked slowly here because many cases have order sensitivities due to the compounding of function. github
Note. This analysis predates the siteAdapter abstraction so should not be considered guidance until revisited.
I would like to separate these functions into several layers where they can be inspected for correctness and more easily accommodate extension. These layers might be:
handles storage and dom journal actions
handles gets and puts
handles explicit and implicit forks
handles successful and failed puts
handles origin (ajax) and local storage
exposes permissions and login state
The page data could move smoothly up and down this stack. However there is some situational awareness and some exception handing that must move up and down the stack too. I've yet to find the inspiration that would keep the one layer we already have from becoming three layers of equally brittle code. Accumulating experience can help. Auto-quoting the BBC is one more case to think about.
save ⇒ editor ⇒ policy ⇒ store
link ⇒ policy ⇒ store ⇒ policy ⇒ refresh
add ⇒ editor ⇒ policy ⇒ store ⇒ ⇒ refresh
See Page Storage Abstraction for earlier thinking.