This question evaluates a candidate's understanding of system design concepts such as real-time event ingestion, handling out-of-order and duplicate events, scalable storage and indexing, and consistency and conflict-resolution trade-offs.
Your server receives a stream of events from clients. Each event contains:
user_id
device_id
timestamp
(event time)
A device may be associated with different users over time (e.g., shared device, logout/login, resale).
Build a backend service that supports:
get_device_owner(device_id) -> user_id
Assume “current owner” means the user_id from the latest event by timestamp for that device_id.