@sghemawat: Are you planning on implementing atomic CAS operations?
bool CAS(db, key, oldvalue, newvalue) {
lock some mutex;
read key's value from db;
bool result = (value == oldvalue);
if (result) write key=>newvalue to db;
unlock;
return result;
}
This should be not much slower than any hard-wired CAS we could provide from inside leveldb.