Closed clux closed 10 years ago
Yeah, ultimately neither serialization mode worked for database storage (without giving up on upgrading tournament). The current implementation is the best for passing state between client and browser, but we need a proper, immutable system to deal with match scoring, construction and piping.
Made preservative for this purpose. It can help keeping track of construction and score calls so we can fully recreate any state, and even interactively play through different states. No more one giant state to store; using preservative, state is push only.
Note that state from preservative is just a list of objects. Serialize them using JSON.stringify or keep them in a JSON store somewhere. The list is monotonically increasing, but elements already in the list will never change.
There are too many moving parts inside a class to sensibly serialize anything and expect to always be able to upgrade versions without sometimes screwing up already serialized versions.
Ideally, what we need is a simple way to just remember all the successful:
By pushing them onto something. That way you also have complete revision history, and everything is immutable. This is a must in the long run.