Milestone 1: Key-Value Store
Implement Get, Put, Delete with disk persistence. Handle concurrent access.
CS concepts: Hash maps, file I/O, serialization
80% scaffolded
Write real code. Watch your system improve across 5 milestones. Guided by AI, benchmarked against real implementations.
func (kv *KVStore) Put(key string, value []byte) error {
kv.mu.Lock()
defer kv.mu.Unlock()
kv.store[key] = value
return kv.flushToDisk(key, value)
} -> 25,412 inserts/sec
Implement Get, Put, Delete with disk persistence. Handle concurrent access.
CS concepts: Hash maps, file I/O, serialization
80% scaffolded
Add a write-ahead log for crash recovery. Implement compaction.
CS concepts: Write-ahead logging, crash recovery, log-structured storage
~60% scaffolded
Build a B-tree index. Implement node splits and range scans.
CS concepts: Tree data structures, disk-based indexing, range queries
40% scaffolded
Parse and execute SQL queries against your storage engine.
CS concepts: Lexing, parsing, query planning, abstract syntax trees
~20% scaffolded
Add transactional semantics with rollback and durability guarantees.
CS concepts: Concurrency control, isolation levels, write-ahead log recovery
~15% scaffolded
A key-value store that persists data to disk. You'll implement Get, Put, Delete, and a serialization layer that writes your data to a file and reads it back on startup.
type KVStore struct {
mu sync.Mutex
data map[string]string
filePath string
file *os.File
}
// ...
// Get retrieves the value associated with the given key.
// Returns the value and true if found, or an empty string and false if not.
//
// TODO: Implement this method.
// - Look up the key in s.data
// - Return the value and whether it was found
func (s *KVStore) Get(key string) (string, bool) {
s.mu.Lock()
defer s.mu.Unlock()
// TODO: implement Get
return "", false
}
// Put stores a key-value pair and persists the change to disk.
//
// TODO: Implement this method.
// - Store the key-value pair in s.data
// - Call s.saveToDisk() to persist
// - Return any error from saving
func (s *KVStore) Put(key, value string) error {
s.mu.Lock()
defer s.mu.Unlock()
// TODO: implement Put
return nil
}
// Delete removes a key from the store and persists the change to disk.
//
// TODO: Implement this method.
// - Remove the key from s.data
// - Call s.saveToDisk() to persist
// - Return any error from saving
func (s *KVStore) Delete(key string) error {
s.mu.Lock()
defer s.mu.Unlock()
// TODO: implement Delete
return nil
} 80% scaffolded. Your job: implement the TODO functions.
Results: 1,000 inserts, avg 39.12ms, 25,412 ops/sec