Proximity request routing
You're tasked to build a request routing system for a global payment processing platform that handles transactions for millions of merchants worldwide. Your infrastructure spans multiple datacenters across continents to ensure low latency and high availability for payment processing.
You're tasked to build a request routing system. Your router must select the optimal datacenter based on geographic proximity, health status, and capacity constraints.
Input/Output Format
Your program reads commands from stdin and writes results to stdout. Each command is on a separate line.
Output Format Rules
SUCCESS: Commands return
OK
复制代码
or structured data as specified
ERROR: Commands return
ERROR
复制代码
(no additional message)
Lists: Comma-separated with no spaces (e.g.,
dc1,dc2,dc3
复制代码
)
Boolean values:
true
复制代码
or
false
复制代码
(lowercase)
Part 1: Datacenter Registry and Health Management
Build the foundational data structures and APIs for managing datacenter registration and health status.
Re