Feature: AgentStorage resetToDefault

#1

It would be a good addition to the AgentStorage library to allow you to reset an entry back to its default.

The flow would be:

  1. db.setDefault("user",{<>})
  2. db.write("user",{<>}
  3. Application initiated soft reset. We still want the object's form to be there, right?

Currently the alternatives are to remove the entry entirely & deal with the consequences or save the default seperately & write it back during a soft reset.

== Doc Example ==
resetToDefault(key)
The resetToDefault() method returns the data to what was set by a previous call to setDefault(key, data). If setDefault was never called for this key, the data will be set to null.
http.onrequest(function(req, resp) { local path = req.path.tolower(); if (path == "/resetUser") { db.resetToDefault("user"); } resp.send(200, "OK"); });

#2

To be clear, this could also be useful for simple objects that require some sort of starting point, like a state machine.