[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Add-if-not-present



> I need to implement a modify operation whose semantics is "add if not
> present", an add that only takes place if that attribute is not yet
> present in the entry.
> 
> I need it as an internal operation, so right now I wouldn't bother
> formalizing it as an extension of the semantics of the modify operation. 
> Something like the SLAP_MOD_SOFTADD, which in turn consists in adding an
> attribute value only if that value is not already present.
> 
> I'd introduce a SLAP_MOD_ADD_IF_NOT_PRESENT flag and add code to support
> it in all (well, most) backends/overlays that need to muck with modify
> operation type.
> 
> Comments?  Objections?  p.

It might be a good idea to have a SOFTDEL as well; both are useful for declarative modifications of data.  Think of them in terms of:

Soft Add: The attribute shall contain at least these values, but might have others
Soft Del: The attribute shall contain none of these values, but might have others

Ideally as modify sub-operations.

Matthew Backes
Symas Corporation
mbackes@symas.com