Version locks

Hi,

This is an implementation of Optimistic Locking through version fields, as discussed on the mailing list.

Cheers,
Aurélien