Every request for a username is encoded as a message, and appended to a partition determined by the hash of the username. A stream processor sequentially reads the requests in the log, using a local database to keep track of which usernames are taken. For every request for a username that is available, it records the name as taken and emits a success message to an output stream. For every request for a username that is already taken, it emits a rejection message to an output stream. The client that requested the username watches the output stream and waits for a success or rejection message
...more