Back to problems

Design a Ring Buffer for Consistent Hashing

Object-Oriented Programming · DoorDash · Medium

Problem: Implement a Ring Buffer for Consistent Hashing Create a ring buffer, also called a hash ring, that assigns any arbitrary key to a backend node. Required APIs Implement a class or module with these operations: add_node(node_id: str): place a node on the hash ring. remove_node(node_id: str): take a node off the hash ring. get_node(key: str) -> str: return the node_id responsible for the supplied key. Consistent hashing rule Apply one common hash function to both…

Checking your access…