Hi Dave, thanks for the great questions.
On Fri, Jun 11, 2010 at 1:12 PM, Dave Woodward davewoodward@promedmedical.net wrote:
I'm wondering if it is possible to directly materialize the objects in a MaCommitLogRecord instance.
You can materialize the CommitPackage which was applied for that commit. The CommitPackage contains the serialized first-class Buffers which could be used to materialize the domain objects.
So, the domain objects are three-materializations removed from existence. These levels of abstraction are necessary for Magma to handle HA functionality generically; i.e., it never has to deal with specific classes of domain objects.
It seems that the commit log records are used exclusively for "advancing" the repository.
That is their primary purpose, yes.
However I'm wondering if I can use the commit log as a sort of poor-man's audit log and if I'd be able to manually extract objects from specific commit log records.
Interesting. Now, you probably noticed already that you have easy-access to a Magma-provided timestamp and commitNumber for each record. Those would seem to be useful for an "audit log".
As far as getting at the objects, it is not difficult. You would just need to open the repository to establish the proper class-map, and then use that serializer to materialize the "objects" instVar of the MaCommitPackage contained within the MaCommitLogRecord.
Right now when I try to materialize a record in Pharo 1.0, I get an error because the serializer tries to call basicNew: on the MagmaLocalLocation class. I'm not sure if this is even a good path to take, so fell free to tell me I'm crazy or that I shouldn't go there :)
Not sure.. :) Why are you inclined to do this?
I'm also wondering if the commits could be "rolled back" so as to be able to rewind the database back to a specific commit? I see how one can restore up to a certain point in time, but I'm just wondering if there is any more specific way to "un-apply" the commit records.
Only a partial commit can be rolled back, the last one, and Magma does it automatically only if necessary.
Beyond that, Magma only supports rolling forward to a point in time. Domain objects that are updated in the client are replaced "in-place" on the hard-disk by the server.
Even if you never made a fullBackup, but you have all of the commit log files from the beginning of time, you can apply them to the "seed" repository that was automatically created and resides inside the magma directory. It is just one of several things Magma does to go out of its way to protect the users persistent model (another is the SHA verification of every single commit-record ever applied to any db).
Regards, Chris
-- Dave Woodward
Magma mailing list Magma@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/magma