I have Write Once Read Many (WORM) semantics for my use case, where I have certain keys as editable, but the majority as Write Once.
Ideally I would like to have the functionality work like this:
entry := badger.NewEntry(factKey, value).WithWriteOnce(true)
err = txn.SetEntry(entry)
if err != nil {
return err
}
This would return an error if someone attempted to write a new value to the same key later. For example: ErrWriteOnce
This would have saved me some headaches and wasting other people’s time when my new ID algorithm was not as unique as I thought.