SPrevayler

Marco Paga mail at marco-paga.de
Fri Feb 28 12:48:04 UTC 2003


I wrote a little Proxy that does the things you wanted. Here an example:

| p c base proxy|
base_ FileDirectory on: (FileDirectory default pathName , FileDirectory 
slash , 'testBase').
p := Prevayler withSystem: (MPTestSystem value: 0) on: base.
proxy_ PrevalenceProxy prevayler: p.
proxy addValue: 17.

every message that goes to the proxy is handeld by the prevalence layer.
You have to pay attention in the case of creating a new prevayler 
because then you have to create a new proxy too.

Regards
Marco


Avi Bryant wrote:

>On Fri, 28 Feb 2003, Marco Paga wrote:
>
>  
>
>>You want me to create a porxy that stands before the system. The proxy
>>gets all the messages that should be send to system and serializes these
>>to disk. What you mean is just writing the Object>>perform:
>>withArguments: to the log files? Do I have to put the logic into
>>doesNotUnderstand: of the proxy class?
>>    
>>
>
>Yes, it'll need to go in #doesNotUnderstand:.
>
>  
>
>>But in fact it stays the same. The prevalence layer is just used behind
>>the scenes. If using the above the prevayler would write the system as
>>usual just the commands are created hidden. We would have a command like
>>PerformCommand that keeps track of the sent commands.
>>    
>>
>
>That's right.
>
>  
>
>>>ids to any object that passes through this proxy as a parameter, so that
>>>these ids can be written into the log instead of the objects themselves -
>>>you only need to fully serialize the object into the log when the id is
>>>first assigned (and, of course, you should replace any objects that
>>>already have ids during this serialization, with an id marker).
>>>
>>>      
>>>
>>This is not very useful in my mind. The outputs I use have a built in
>>mechnism for this.
>>    
>>
>
>Hm.  Do they?  Something like ReferenceStream will maintain object
>identity during a single serialization, but I don't think in your current
>implementation you maintain identity across multiple commands.  That is,
>if you save the same object as part of two commands, and you read them
>back from the log later, will the two commands you recreate actually have
>the same object, or two similar but different ones?  I'm pretty sure it'll
>be the latter, and that's what I'm trying to avoid.
>
>To put it another way, my understanding is that currently Command objects
>should only contain Strings, Numbers, etc, that can be easily serialized
>and restored.  I'd like them to be able to contain any domain object, and
>this means assigning ids so you can maintain identity.
>
>This might be too different from the Prevayler idea for you to want to
>implement it, but I think it would be a useful system - maybe I'll work up
>a prototype this weekend.
>
>Avi
>
>
>
>
>  
>



More information about the Squeak-dev mailing list