Needs to be able to reason about both our own local state, and a possibly-out-of-sync global state. Reading/writing actions is primary, caching resolved state is secondary.
There are two places to save actions:
- Locally: assumed to always exist, and always be accessable, first thing we'll try to write to
- Globally: possibly exists, possibly accesable. Might contain actions not found in local store, and might be missing actions found in the local store.
There is also a cache of state, but this is very much viewed as a suggestion rather than a rule
- Check to make sure Local and Global actions match, if not, make sure they do
- Read current state cache
- Read current action hash
- Generate an action
- Save it localy,
- Try to save it globally
readCache(atAction): stateSnapshot
writeCache(atAction, state)
- localActions
writeAction(id, action)
readAction(id): action
listActions(): [id]
- globalActions
writeAction(id, action)
readAction(id): action
listActions(): [id]