You cannot erase a key from an immutable SSTable, so a delete has to be a write - a record that says "gone". Today you add Delete, which appends a tombstone record using the Delete kind you reserved in lesson 6.
Implement Delete by writing a tombstone record to the WAL and memtable.
Deleting from an LSM engine is counter-intuitive: you write to delete. SSTables
are immutable, so you cannot go remove a key from an old file - and even if you
could, an older SSTable might still hold a previous value that would then
resurface. The fix is a tombstone: a record marked kind = Delete that says
“as of now, this key is gone.” It shadows every older value the same way a newer
Put shadows an older one.
This is the moment kind has to flow everywhere, not just live in the record
format: the memtable’s entries carry it (a tombstone for "apple" is a real,
present entry that means absence), the iterators expose it, and a flush writes it
so a tombstone survives all the way to an SSTable. (Reserving the Delete kind back
in lesson 6 is what makes this a small change instead of a format break.) Wire the
tombstone through the same durable WAL path as any write - and have replay re-apply
it - so a delete survives a crash too. With the representation in place, the next
lessons just make reads and scans honor it.
func (d *DB) Delete(key string) error {// WAL.Append(Delete, key, nil) first (durable), then put a// tombstone into the memtable for that key.// the memtable entry must record KIND, not just a value, so a// tombstone is distinguishable from a real value.}