Design a Locking Key-Value Store with Batch Writes
Design and implement a single-process key-value store whose individual and batched mutations remain atomic under concurrency.
For this exercise, assume a single-process in-memory store maps non-empty string keys to string values. It exposes get, put, delete, and writeBatch. A batch is an ordered list of Put and Delete operations; repeated keys are allowed and are applied in list order.
Validate the entire batch before changing state: an empty key makes the batch invalid, and an empty batch is rejected. A valid batch is one atomic, linearizable mutation: concurrent readers and writers observe either all of its effects or none, never a partial prefix.
Get returns an explicit NotFound result for a missing key, while deleting a missing key is a successful no-op. The store maintains a monotonically increasing revision; each successful put or delete advances it once, and a successful batch advances it once for the whole batch.
Design the object model, interfaces, locking boundaries, interactions, and a bounded implementation of writeBatch. Persistence, distribution, TTL, range scans, watches, and transactions spanning multiple client requests are outside scope.