At some point I will want to keep all Prevayler
commands as historical logs so that one can see exactly what happened to an object (Account/User/etc) since the beginning of time. Granted, the commands would have to have additional information added to them (like user, etc), but this would be a really nice "freebie" that is quite inconvenient to implement with an RDBMS
Keeping Commands that throw expected or unexpected exceptions would probably not be desirable since they shouldn't have changed anything, but maybe that could be beneficial information too when trying to monitor issues with the system.
This may be a feature that each project would need to implement by themselves, but maybe there could be a reference implementation that users could download.
Another thing to consider in this vein of thought: if commands are to store the old values as well as new values, this would require an option to execute the command _before_ storing it.
Granted, it would sometimes be possible to index the commands in such a way that you can easily find the old value in a previous command, but that won't work when accessing data that was loaded en-masse by one big huge command.
Executing commands before they are written to disk would require us to block all queries while the command is executing AND while it is being written to disk. @:(
Today, queries to the PrevalentSystem
are never blocked by Prevayler. It is up to the BusinessObjects
to take care of fine-grained synchronization. Their task is greatly simplified by the fact that Prevayler guarantees the execution of only one command at a time. @;)
Do you not have enough RAM to keep all your commands as BusinessObjects
in your PrevalentSystem
, instead of just in history logs?
Even if you don't, I think I have a design solution for your need and I agree:
"This may be a feature that each project would need to implement..."
"...there could be a reference implementation that users could download."
Please describe your application a little more.
I don't think that you need to pre-execute the command to store the old values. Before any commando your system is empty, and any change will appear just after a command, so you just have to save the state of your objects after the command.
I read the GelernterArticle
and thought it very interesting. I will post here the ideas that I am having to implement that. One thing that KlausWuestefeld
and I were discussing is that the command could implement the interface of the objects that it is changing, so you would have a stack of commands that you could navigate through and having the values in any time.
I'd like to point out that HistoryLogging
can be a quite nice feature in Prevayler
, but I think that it was not given good attention, yet. Does anyone want to experiment with me in that area?
Describing an implementation of some concepts from the GelernterArticle
I couldn't figure out a good name for this concept. So, by now I will call it CommandHistoryObject
. Please, read the description and help me with a better name.