Tutorial example HelloPersistent

Files

In tutorial example HelloPersistent the contents of a Node are made persistent by adding it to a Store. Note that Store.add returns the Node for assignment to the nodeStore variable.

Making Nodes persistent requires the following steps

Remark 1: Although not stricktly needed, an explicit key is supplied as a second parameter to Store.add. This allows existing Nodes to be left out and new Nodes to be introduced at changing program versions. If new nodes are stored using new keys, Store files written by previous program versions can still be loaded. Implicit keys of newly introduced Nodes on the other hand, may clash with implicit keys of Nodes that were left out, but whose values are still in the store.

Remark 2: Use of multiple Stores is permitted. In fact views exhibiting a layout state have their own Store, to which they are implicitly added. It is persisted to views.store by default.