directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Lecharny" <elecha...@gmail.com>
Subject [ChangeLog] Modify operation
Date Wed, 10 Oct 2007 08:48:39 GMT
Hi,

as I'm just trying to complete the code to provide a kind of
Snapshot/Rollback funtionality into the ChangeLog interceptor (to be
very clear : the idea is to store all the modification requests to be
able to play them in the opposite order to come back to the previous
sate of the server. This will be very usefull for tests, but it's
certainly not enough to get a full rollback system, as we don't handle
ongoing modifications while applying the anti-modifications)

I have a question regarding the modify operation :
we can have 3 kinds of modifications, ADD, REPLACE and REMOVE. All of
them have complex semantic, depending on the previous state of the
modified entry (ie, is the modified attribute exists, does it have
some values, etc).

Computing the perfect anti-modification is quite complex, and can lead
to a few hundreds of line of code, with potential bugs.

What if we simply store the previous entry and just restore it,
replacing the new entry ? It's just a matter of deleting the entry
first and then add the old one, to avoid errors when adding an
existing entry.

Here is the proposed solution

t0 : Entry(test) exists with some attributes

t1: modify Entry(test), adding attr1, replacing attr2, etc... :
  (1) : save the Entry(test) -> oldEntry(test)
  (2) : apply the mods to Entry(test)

t3: apply the rollback
  (1) delete Entry(test)
  (2) add oldEntry(test)

It seems to me much simplier than the optimal solution :

t0 : Entry(test) exists with some attributes

t1: modify Entry(test), adding attr1, replacing attr2, etc... :
  (1) : compute the anti-modification to get back Entry(test)
  (2) : apply the mods to Entry(test)

t3: apply the rollback
  (1) apply anti-modification to Entry(test)

wdyt ?

-- 
Regards,
Cordialement,
Emmanuel L├ęcharny
www.iktek.com

Mime
View raw message