yangzh
(Kevin Yang)
June 26, 2020, 9:05pm
1
Will it simply return nil, or (like Txn.Get), return ErrKeyNotFound?
Thanks.
ibrahim
(Ibrahim Jarif)
June 27, 2020, 6:58am
2
Deletes in badger are logical deletes. We will insert a new key with the delete marker. So to answer your question, badger will return nil when you perform a delete.
// Delete deletes a key.
//
// This is done by adding a delete marker for the key at commit timestamp. Any
// reads happening before this timestamp would be unaffected. Any reads after
// this commit would see the deletion.
//
// The current transaction keeps a reference to the key byte slice argument.
// Users must not modify the key until the end of the transaction.
func (txn *Txn) Delete(key []byte) error {
e := &Entry{
Key: key,
meta: bitDelete,
}
return txn.modify(e)
}
yangzh
(Kevin Yang)
June 29, 2020, 4:14pm
3
thanks for the clarification!