[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"$apiParty6fBuHLCPZ1LTYs42XHdVbjpSDOYYPYzyxeAGwSN5Tp8":3,"$apiParty4oTwWPqHXsXtpLy1t_2jwX3m3LO_M5THSVvtK06KvEc":563,"$apiParty4oTwWPqHXsXtpLy1t_2jwX3m3LO_M5THSVvtK06KvEc$H93EERW16b":563},{"product_data":4,"scene_data":21,"task_data":407,"modality_data":441,"domain_data":478},[5,9,12,15,18],{"name":6,"value":7,"add_value":8,"describe":8},"Rivo","1","",{"name":10,"value":11,"add_value":8,"describe":8},"Cubo","2",{"name":13,"value":14,"add_value":8,"describe":8},"Moye","3",{"name":16,"value":17,"add_value":8,"describe":8},"Juro","4",{"name":19,"value":20,"add_value":8,"describe":8},"Ordo","5",[22,73,135,197,232,267,302,337,372],{"name":23,"value":7,"add_value":24,"describe":25,"children":26},"Home & Indoor","sofa","AI enhances everyday home life. Our datasets cover real indoor scenes to support smart devices, robotics, and home intelligence.",[27,29,31,33,35,37,40,43,46,49,52,55,58,61,64,67,70],{"name":28,"value":7},"Living Room",{"name":30,"value":11},"Bedroom",{"name":32,"value":14},"Kitchen",{"name":34,"value":17},"Dining Area",{"name":36,"value":20},"Bathroom",{"name":38,"value":39},"Entrance \u002F Foyer","6",{"name":41,"value":42},"Corridor \u002F Hallway","7",{"name":44,"value":45},"Staircase","8",{"name":47,"value":48},"Home Office","9",{"name":50,"value":51},"Hobby \u002F Game Room","10",{"name":53,"value":54},"Worship Space","11",{"name":56,"value":57},"Garage","12",{"name":59,"value":60},"Utility \u002F Laundry Room","13",{"name":62,"value":63},"Pantry","14",{"name":65,"value":66},"Basement","15",{"name":68,"value":69},"Garden","16",{"name":71,"value":72},"Balcony","17",{"name":74,"value":11,"add_value":75,"describe":76,"children":77},"Office & Educational","workshop","AI is reshaping work and learning. Our datasets capture offices and classrooms to power automation and next-generation productivity tools.",[78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132],{"name":79,"value":80},"Open Office","18",{"name":82,"value":83},"Private Office","19",{"name":85,"value":86},"Co-working Space","20",{"name":88,"value":89},"Reception \u002F Lobby","21",{"name":91,"value":92},"Conference Room","22",{"name":94,"value":95},"Huddle Room \u002F Booth","23",{"name":97,"value":98},"Lecture Hall \u002F Auditorium","24",{"name":100,"value":101},"Classroom","25",{"name":103,"value":104},"Science Laboratory","26",{"name":106,"value":107},"Library","27",{"name":109,"value":110},"Design Studio","28",{"name":112,"value":113},"Pantry \u002F Breakroom","29",{"name":115,"value":116},"Cafeteria \u002F Canteen","30",{"name":118,"value":119},"Restroom (Commercial)","31",{"name":121,"value":122},"Gymnasium \u002F Sports Hall","32",{"name":124,"value":125},"Server Room","33",{"name":127,"value":128},"Mailroom \u002F Logistics","34",{"name":130,"value":131},"Janitorial Closet","35",{"name":133,"value":134},"Corridor \u002F Elevators","36",{"name":136,"value":14,"add_value":137,"describe":138,"children":139},"Healthcare & Medical","love-and-help","AI is advancing modern healthcare. Our datasets include clinics and hospitals to enable clinical insights and medical automation.",[140,143,146,149,152,155,158,161,164,167,170,173,176,179,182,185,188,191,194],{"name":141,"value":142},"Operating Theatre \u002F OR","37",{"name":144,"value":145},"Consultation Room","38",{"name":147,"value":148},"Treatment Room","39",{"name":150,"value":151},"Dental Clinic","40",{"name":153,"value":154},"Inpatient Ward","41",{"name":156,"value":157},"Nurse Station","42",{"name":159,"value":160},"ICU","43",{"name":162,"value":163},"NICU (Neonatal ICU)","44",{"name":165,"value":166},"Emergency Room (ER)","45",{"name":168,"value":169},"Hospital Corridor","46",{"name":171,"value":172},"Waiting Area","47",{"name":174,"value":175},"CT\u002FMRI","48",{"name":177,"value":178},"Medical Laboratory","49",{"name":180,"value":181},"Phlebotomy Room","50",{"name":183,"value":184},"Rehabilitation Gym","51",{"name":186,"value":187},"Assisted Living Room","52",{"name":189,"value":190},"Pharmacy","53",{"name":192,"value":193},"Sterile Processing Dept","54",{"name":195,"value":196},"Medical Storage","55",{"name":198,"value":17,"add_value":199,"describe":200,"children":201},"Business & Public Service","business","AI is elevating commercial and public services. Our datasets span retail, dining, and service centers to improve intelligent operations.",[202,205,208,211,214,217,220,223,226,229],{"name":203,"value":204},"Shopping Mall Atrium","86",{"name":206,"value":207},"Supermarket Shelf","87",{"name":209,"value":210},"Self-Checkout Counter","88",{"name":212,"value":213},"Restaurant Dining Hall","89",{"name":215,"value":216},"Commercial Kitchen","90",{"name":218,"value":219},"Hotel Lobby","91",{"name":221,"value":222},"Subway Platform","92",{"name":224,"value":225},"Security Checkpoint","93",{"name":227,"value":228},"Underground Parking","94",{"name":230,"value":231},"Bank Teller Zone","95",{"name":233,"value":20,"add_value":234,"describe":235,"children":236},"Industrial & Manufacturing","robot-arm","AI is modernizing industry. Our datasets capture factories and logistics spaces to support robotics and intelligent manufacturing.",[237,240,243,246,249,252,255,258,261,264],{"name":238,"value":239},"Final Assembly Line","96",{"name":241,"value":242},"Quality Control Station","97",{"name":244,"value":245},"Robotic Welding Cell","98",{"name":247,"value":248},"CNC Machining Center","99",{"name":250,"value":251},"Cleanroom","100",{"name":253,"value":254},"Automated Warehouse","101",{"name":256,"value":257},"Loading Dock","102",{"name":259,"value":260},"Sorting Center","103",{"name":262,"value":263},"Chemical Plant","104",{"name":265,"value":266},"Power Substation","105",{"name":268,"value":39,"add_value":269,"describe":270,"children":271},"Transportation & Driving","car","AI is revolutionizing mobility. Our datasets capture road networks, vehicle dynamics and traffic scenarios to support autonomous driving and intelligent transportation systems.",[272,275,278,281,284,287,290,293,296,299],{"name":273,"value":274},"Urban Intersection","56",{"name":276,"value":277},"Highway \u002F Expressway","57",{"name":279,"value":280},"Tunnel","58",{"name":282,"value":283},"Roundabout","59",{"name":285,"value":286},"School \u002F Hospital Zone","60",{"name":288,"value":289},"Toll Station","61",{"name":291,"value":292},"Construction Zone","62",{"name":294,"value":295},"Parking Garage","63",{"name":297,"value":298},"Driver Cabin","64",{"name":300,"value":301},"Adverse Weather","65",{"name":303,"value":42,"add_value":304,"describe":305,"children":306},"Outdoor & Construction","tent-tree","AI is optimizing outdoor operations. Our datasets capture construction sites, open-air work zones and outdoor infrastructure to support smart construction and autonomous outdoor machinery.",[307,310,313,316,319,322,325,328,331,334],{"name":308,"value":309},"Excavation Site","66",{"name":311,"value":312},"Scaffolding Area","67",{"name":314,"value":315},"Material Storage Yard","68",{"name":317,"value":318},"Site Entrance","69",{"name":320,"value":321},"Roadwork Zone","70",{"name":323,"value":324},"Bridge Infrastructure","71",{"name":326,"value":327},"Transmission Line","72",{"name":329,"value":330},"Open-pit Mine","73",{"name":332,"value":333},"Tunneling Site","74",{"name":335,"value":336},"Post-Disaster Rubble","75",{"name":338,"value":45,"add_value":339,"describe":340,"children":341},"Nature, Aerial & Aquatic","global-loop","AI is exploring the natural world. Our datasets capture terrestrial landscapes, aerial vistas and aquatic ecosystems to support environmental monitoring and autonomous exploration systems.",[342,345,348,351,354,357,360,363,366,369],{"name":343,"value":344},"Deep Forest","76",{"name":346,"value":347},"Farmland \u002F Crops","77",{"name":349,"value":350},"River \u002F Lake","78",{"name":352,"value":353},"Open Ocean","79",{"name":355,"value":356},"Underwater Coral Reef","80",{"name":358,"value":359},"Fish Farm","81",{"name":361,"value":362},"Mountain Terrain","82",{"name":364,"value":365},"Urban Low Altitude","83",{"name":367,"value":368},"Fire Scene","84",{"name":370,"value":371},"Desert \u002F Gobi","85",{"name":373,"value":48,"add_value":374,"describe":375,"children":376},"Virtul & Digital","siri","AI is reshaping the virtual realm. Our datasets capture digital twins, virtual environments and simulated spaces to support metaverse development and intelligent digital interaction.",[377,380,383,386,389,392,395,398,401,404],{"name":378,"value":379},"VR Social Space","106",{"name":381,"value":382},"Synthetic Driving Sim","107",{"name":384,"value":385},"Digital Twin City","108",{"name":387,"value":388},"FPS \u002F MOBA Game","109",{"name":390,"value":391},"Robotics Gym","110",{"name":393,"value":394},"AR Navigation","111",{"name":396,"value":397},"Virtual Showroom","112",{"name":399,"value":400},"Code \u002F IDE Interface","113",{"name":402,"value":403},"App GUI Screen","114",{"name":405,"value":406},"Synthetic Face\u002FID","115",[408,411,414,417,420,423,426,429,432,435,438],{"name":409,"value":7,"add_value":410,"describe":8},"Classification","rubric",{"name":412,"value":11,"add_value":413,"describe":8},"Detection","radar",{"name":415,"value":14,"add_value":416,"describe":8},"Segmentation","segmentation",{"name":418,"value":17,"add_value":419,"describe":8},"Tacking","crosshairs",{"name":421,"value":20,"add_value":422,"describe":8},"Estimation","streamline",{"name":424,"value":39,"add_value":425,"describe":8},"QA","qa",{"name":427,"value":42,"add_value":428,"describe":8},"Recognition","finger-scan",{"name":430,"value":45,"add_value":431,"describe":8},"Control","control",{"name":433,"value":48,"add_value":434,"describe":8},"Extraction","extraction",{"name":436,"value":51,"add_value":437,"describe":8},"Retrieval","retrieval",{"name":439,"value":54,"add_value":440,"describe":8},"Forecast","forecast",[442,445,448,451,454,457,460,463,466,469,472,475],{"name":443,"value":7,"add_value":444,"describe":8},"Audio","audio",{"name":446,"value":11,"add_value":447,"describe":8},"Image","image",{"name":449,"value":14,"add_value":450,"describe":8},"Text","text",{"name":452,"value":17,"add_value":453,"describe":8},"Video","video",{"name":455,"value":20,"add_value":456,"describe":8},"Multi","multi",{"name":458,"value":39,"add_value":459,"describe":8},"Document","document",{"name":461,"value":42,"add_value":462,"describe":8},"Time-Series","time-series",{"name":464,"value":45,"add_value":465,"describe":8},"3D cloud","cloud",{"name":467,"value":48,"add_value":468,"describe":8},"Code","code",{"name":470,"value":51,"add_value":471,"describe":8},"Event","event",{"name":473,"value":54,"add_value":474,"describe":8},"Motion","motion",{"name":476,"value":57,"add_value":477,"describe":8},"Interaction","interaction",[479,482,487,491,494,499,504,509,514,519,524,528,532,536,540,544,548,552,556,559],{"id":480,"value":480,"name":233,"intro":481,"add_value":234,"describe":481},2,"智能质检：利用图像识别、多模态模型对产品外观或声音、振动等数据进行分析，自动识别缺陷，提高质量控制效率。\n工业知识问答与文档理解：通过大模型理解和总结技术文档、操作手册，实现快速问答、知识检索和培训支持。\n安全监测与风险预警：实时分析视频、传感器和操作日志，识别潜在危险行为或异常状态，提前预警，保障人员和设备安全。",{"id":483,"value":483,"name":484,"intro":485,"add_value":486,"describe":485},3,"Finance & Insurance","风险评估与预测：分析大量客户数据，评估信用风险、市场风险等，预测违约概率、股价走势等，辅助金融机构决策。\n智能投顾：根据客户风险偏好、资产状况等，提供个性化投资组合建议，实时调整投资策略。\n反欺诈检测：通过分析交易数据、用户行为，识别异常交易和欺诈行为，保障金融安全。","funds",{"id":488,"value":488,"name":489,"intro":490,"add_value":269,"describe":490},1,"Transport & Automotive","智能座舱：打造多模态交互的 AI 座舱，通过语音、手势、面部识别等实现人机交互，如语音控制导航、音乐播放。\n驾驶员状态监测：识别疲劳、分心、抽烟、打电话等行为，通过大模型判断危险等级，触发相应提醒或干预机制。\n智能驾驶：AI 用于环境感知、路径规划与决策控制，使车辆能识别道路、行人、障碍物等，实现自适应巡航、自动泊车、车道保持等功能，提升驾驶安全性与便利性。",{"id":492,"value":492,"name":136,"intro":493,"add_value":137,"describe":493},4,"医学影像诊断：分析 CT、MRI 等影像，辅助医生检测疾病、识别病灶，如 AI 系统可快速发现肺部结节。\n医患对话助手：通过自然语言处理理解患者问题，提供初步健康建议或就诊指导，缓解医生接诊压力。\n智能健康管理：根据用户健康数据，提供个性化健康建议、疾病预警，如智能手环结合 AI 分析用户运动、睡眠、心率等数据。",{"id":495,"value":495,"name":496,"intro":497,"add_value":498,"describe":497},6,"Smart Devices","多模态交互：支持语音、手势、眼神等多种交互方式，如 AI 眼镜可通过语音指令实现翻译、搜索功能。\n智能感知与处理：使设备能感知环境、理解用户需求，如智能音箱根据环境噪音自动调节音量。\n个性化服务：根据用户使用习惯和偏好，提供个性化功能与服务，如智能手表为用户定制运动健身计划。","microscope",{"id":500,"value":500,"name":501,"intro":502,"add_value":503,"describe":502},8,"Law & Government","智能法律问答：面向公众或企业用户，提供合规、劳动法、婚姻继承、知识产权等常见法律问题的智能解答。\n合同审查与风险识别：利用大模型分析合同内容，识别潜在风险条款、漏洞或不合理约定，提升合同审核质量。\n法律知识图谱构建：自动梳理法规、案例、条文之间的引用关系，构建语义化知识图谱，支持智能分析和推理。","hammer",{"id":505,"value":505,"name":506,"intro":507,"add_value":508,"describe":507},7,"Education & Training","个性化学习：根据学生学习进度、能力和知识掌握情况，推送个性化学习内容与练习，如智能辅导系统为学生制定专属学习计划。\n智能教学辅助：AI 助教协助教师进行作业批改、答疑解惑，还可分析教学数据，为教师提供教学反馈，优化教学方法。\n虚拟学习环境：利用 AI 创建虚拟实验、历史场景等，让学生沉浸式学习，如在虚拟化学实验室中进行实验操作。","degree-hat",{"id":510,"value":510,"name":511,"intro":512,"add_value":513,"describe":512},5,"Agriculture & Food","作物病虫害识别与防治：通过图像识别分析农作物叶片、果实等症状，识别病虫害类型，给出防治建议，减少产量损失。\n农产品质量检测：利用图像和传感器数据，识别果蔬等农产品的成熟度、外观缺陷，进行自动分级，提高市场竞争力。\n农情监测与预测：利用卫星遥感、气象和传感器数据，结合大模型预测作物长势、干旱、洪涝等农情变化。","ph-farm",{"id":515,"value":515,"name":516,"intro":517,"add_value":518,"describe":517},9,"Retail & E-commerce","智能客服：通过自然语言对话理解用户需求，提供产品推荐、订单查询、退换货支持等服务，提升客户满意度。\n个性化营销推荐：基于用户浏览、购买、偏好等行为数据，生成个性化推荐内容与优惠策略，提高转化率和客单价。\n商品内容生成：自动撰写商品标题、卖点描述、使用说明等内容，适用于海量SKU的内容生产与多语言发布。","buy",{"id":520,"value":520,"name":521,"intro":522,"add_value":523,"describe":8},10,"Security & Protection",null,"safe-shield-line",{"id":525,"value":525,"name":526,"intro":522,"add_value":527,"describe":8},11,"Environment & Climate","weather",{"id":529,"value":529,"name":530,"intro":522,"add_value":531,"describe":8},12,"Energy & Resource","energy-leaf",{"id":533,"value":533,"name":534,"intro":522,"add_value":535,"describe":8},13,"Express & Logistics","speed-outline",{"id":537,"value":537,"name":538,"intro":522,"add_value":539,"describe":8},15,"Sports","baseball-outline",{"id":541,"value":541,"name":542,"intro":522,"add_value":543,"describe":8},16,"General Data","daily-booth",{"id":545,"value":545,"name":546,"intro":522,"add_value":547,"describe":8},17,"Content & Media","media",{"id":549,"value":549,"name":550,"intro":522,"add_value":551,"describe":8},18,"Construction","construction",{"id":553,"value":553,"name":554,"intro":522,"add_value":555,"describe":8},19,"IT & Telecom","tech",{"id":557,"value":557,"name":558,"intro":522,"add_value":498,"describe":8},20,"Science & Research",{"id":560,"value":560,"name":561,"intro":522,"add_value":562,"describe":8},21,"Language & Culture","lang",{"id":564,"unique_code":565,"title":566,"icon":8,"intro":567,"cate":483,"detail":568,"create_time":569,"update_time":570,"price":571,"view_count":541,"download_count":572,"unit":572,"amount":573,"is_create_order":572,"enterprise_id":488,"seo_keywords":574,"seo_description":575,"data_format":576,"file_size":577,"apply_scene":578,"training_task":579,"version":580,"dataset_type_id":510,"dataset_scene_id":553,"sample_file":581,"banner":8,"unit_name":8,"cate_name":449,"icon_url":8,"banner_url":8,"sample_file_url":8,"data_dict":582,"qa_list":630,"sample_metadatas":647,"text_sample_content":690,"enterprise_name":691,"enterprise_logo":692,"data_distribution":693},1209,"69a48ba5ca21993b40324debf34d9692","Cache Shard Routing Dependency Reasoning Dataset","Train models to trace how cache requests move from keys to destination nodes using source code and structured reasoning annotations.","\u003Cp>This dataset focuses on source code for distributed cache routing, including hash sharding, slot mapping, node selection, redirection, and shard migration, paired with structured reasoning annotations. Examples identify routing data structures, execution control flow, and dependencies among variables, functions, and branches, then analyze request routes and the effects of node or mapping changes. It supports training and evaluation of code understanding, dependency tracing, and change-impact reasoning for cache routing.\u003C\u002Fp>","2026-10-14 16:39:14","2026-10-19 17:18:39","0.00",0,5000,"cache routing dataset,distributed cache code reasoning,hash sharding analysis,slot mapping,node selection logic,code dependency analysis,routing control flow,shard migration analysis","A source code reasoning dataset for distributed cache routing, covering hash sharding, slot mapping, node selection, control flow dependencies, and changeImpact","JSON","0.3GB","distributed cache management, cache request routing, source code analysis","code understanding, dependency tracing, logical reasoning","V1.0","rivo\u002Fsample-packages\u002Fef5427d2-fd25-4fe0-9f37-b9401a29fb34\u002F20261014.zip",[583,588,593,599,604,609,615,620,625],{"id":572,"name":584,"field":585,"intro":586,"type":587},"File Name","file_name","File name","string",{"id":589,"name":590,"field":591,"intro":592,"type":587},8783,"Source Code","source_code","Source code containing logic for hash sharding, slot mapping, node selection, redirection, or shard migration.",{"id":594,"name":595,"field":596,"intro":597,"type":598},8784,"Routing Control Flow","control_flow","Steps in execution order, from processing the request key through node selection and any redirection or migration handling.","array",{"id":600,"name":601,"field":602,"intro":603,"type":598},8785,"Change Impact Analysis","change_impact","Inferred effects of changes to nodes, slot mappings, or migration state on request paths and routing outcomes.",{"id":605,"name":606,"field":607,"intro":608,"type":598},8786,"Code Evidence Spans","evidence_spans","Source code locations that support identification of routing data structures, control flow explanations, and impact inferences.",{"id":610,"name":611,"field":612,"intro":613,"type":614},8787,"Routing Decision","route_decision","The inferred route for a single request, from its key to the final node, based on the source code.","object",{"id":616,"name":617,"field":618,"intro":619,"type":598},8788,"Dependency Graph","dependency_graph","Dependencies among variables, functions, data structures, and control branches involved in routing decisions.",{"id":621,"name":622,"field":623,"intro":624,"type":587},8789,"Inference Summary","inference_summary","An overall summary of routing dependencies, request paths, and the effects of node or mapping changes.",{"id":626,"name":627,"field":628,"intro":629,"type":614},8790,"Routing Data Structures","routing_data_structures","Routing-related data structures identified and summarized from the source code.",[631,635,639,643],{"id":632,"question":633,"answer":634},6287,"What does the dataset contain?","Examples include source code for cache shard routing and structured annotations for routing data structures, control flow, dependencies, individual request outcomes, change impacts, and supporting code evidence.",{"id":636,"question":637,"answer":638},6288,"Which capabilities can it support?","It can support training or evaluation for code understanding, variable and function dependency tracing, routing control flow analysis, and inference about request paths after changes to nodes, slot mappings, or migration states.",{"id":640,"question":641,"answer":642},6289,"Is the dataset limited to a particular programming language or cache product?","The title and field definitions do not specify a programming language or cache product. Before use, check the delivered examples for their languages, coding styles, routing implementations, and coverage to confirm they match your target system.",{"id":644,"question":645,"answer":646},6290,"How can I obtain the dataset, and what are the licensing terms?","Access methods, file formats, and licensing terms should be confirmed on the dataset product page or in the delivery agreement. Review the applicable terms before training, evaluation, or redistribution, and comply with any licenses that apply to code in the samples.",[648,664,677],{"id":649,"relate_table":650,"relate_id":651,"file_size":572,"file_name":652,"path":8,"duration":572,"cate":483,"file_format":653,"audio_rate":8,"audio_channel":522,"audio_bit_depth":522,"quality":8,"annotation":654,"cate_name":655,"source_code":656,"control_flow":657,"change_impact":658,"evidence_spans":659,"route_decision":660,"dependency_graph":661,"inference_summary":662,"routing_data_structures":663},15027,"union_cubo",353575875,"样例_3.json","json","{\"source_code\": \"const SLOT_COUNT = 32;\\nconst slotOwner = Array.from({ length: SLOT_COUNT }, (_, slot) =>\\n  slot \u003C 16 ? \\\"cache-a\\\" : \\\"cache-b\\\"\\n);\\nconst nodes = {\\n  \\\"cache-a\\\": { endpoint: \\\"cache-a.internal:6379\\\", state: \\\"up\\\" },\\n  \\\"cache-b\\\": { endpoint: \\\"cache-b.internal:6379\\\", state: \\\"up\\\" },\\n  \\\"cache-c\\\": { endpoint: \\\"cache-c.internal:6379\\\", state: \\\"migrating\\\" }\\n};\\nconst migration = { active: true, slots: new Set([12]), from: \\\"cache-a\\\", to: \\\"cache-c\\\" };\\nfunction hashKey(key) {\\n  return [...key].reduce((h, c) => h + c.charCodeAt(0), 0) >>> 0;\\n}\\nfunction route(key, localNode = \\\"cache-a\\\") {\\n  const keyHash = hashKey(key);\\n  const slot = keyHash % SLOT_COUNT;\\n  const source = slotOwner[slot];\\n  if (migration.active && migration.slots.has(slot)) {\\n    const target = migration.to;\\n    return { node: target, redirect: localNode !== target, target, migration: \\\"read-source-on-miss\\\" };\\n  }\\n  return { node: source, redirect: localNode !== source, target: source };\\n}\", \"control_flow\": \"[{\\\"step_index\\\": 1, \\\"operation\\\": \\\"Compute character accumulation hash\\\", \\\"condition\\\": \\\"route receives the request key\\\", \\\"reads\\\": [\\\"key\\\", \\\"hashKey\\\"], \\\"writes\\\": [\\\"keyHash\\\"], \\\"branch_effect\\\": \\\"Provides an integer representation of the request key for slot calculation.\\\"}, {\\\"step_index\\\": 2, \\\"operation\\\": \\\"Execute slot modulo\\\", \\\"condition\\\": \\\"keyHash has been generated\\\", \\\"reads\\\": [\\\"keyHash\\\", \\\"SLOT_COUNT\\\"], \\\"writes\\\": [\\\"slot\\\"], \\\"branch_effect\\\": \\\"Places the request into one of 32 slots.\\\"}, {\\\"step_index\\\": 3, \\\"operation\\\": \\\"Read original slot owner\\\", \\\"condition\\\": \\\"slotOwner[slot] exists\\\", \\\"reads\\\": [\\\"slotOwner\\\", \\\"slot\\\"], \\\"writes\\\": [\\\"source\\\"], \\\"branch_effect\\\": \\\"Obtains the source node responsible for the slot before migration.\\\"}, {\\\"step_index\\\": 4, \\\"operation\\\": \\\"Detect migrating slot\\\", \\\"condition\\\": \\\"migration.active && migration.slots.has(slot)\\\", \\\"reads\\\": [\\\"migration.active\\\", \\\"migration.slots\\\", \\\"slot\\\"], \\\"writes\\\": [\\\"target\\\"], \\\"branch_effect\\\": \\\"When migration hits, does not return source; instead selects migration.to as the target node.\\\"}, {\\\"step_index\\\": 5, \\\"operation\\\": \\\"Generate forwarding result\\\", \\\"condition\\\": \\\"localNode !== target or localNode === target\\\", \\\"reads\\\": [\\\"localNode\\\", \\\"target\\\", \\\"source\\\"], \\\"writes\\\": [\\\"redirect\\\", \\\"routeResult\\\"], \\\"branch_effect\\\": \\\"During migration, requests entering from the source node are forwarded to the target node; when migration does not hit, directly accesses the slot owner.\\\"}]\", \"change_impact\": \"[{\\\"change_type\\\": \\\"Migration completed\\\", \\\"changed_component\\\": \\\"migration.active, migration.slots, and slotOwner[12]\\\", \\\"affected_slot_range\\\": \\\"12\\\", \\\"original_node\\\": \\\"cache-a\\\", \\\"new_node\\\": \\\"cache-c\\\", \\\"request_path_before\\\": \\\"The request enters from cache-a and is forwarded to cache-c after hitting the migration set.\\\", \\\"request_path_after\\\": \\\"slotOwner[12] is updated to cache-c; after the migration state is cleared, the request directly accesses cache-c.\\\", \\\"path_changed\\\": true, \\\"impact_explanation\\\": \\\"After migration completes, the owner of slot 12 should be updated to cache-c, and the migration marker should be removed. The hash and slot remain unchanged, but the request no longer depends on the migration.to branch and no longer uses cache-a as the source node, so both the control flow and the actual access path change.\\\"}]\", \"evidence_spans\": \"[{\\\"line_start\\\": 1, \\\"line_end\\\": 4, \\\"code_excerpt\\\": \\\"const SLOT_COUNT = 32;\\\\nconst slotOwner = Array.from({ length: SLOT_COUNT }, (_, slot) =>\\\\n  slot \u003C 16 ? \\\\\\\"cache-a\\\\\\\" : \\\\\\\"cache-b\\\\\\\"\\\\n);\\\", \\\"evidence_role\\\": \\\"Defines the 32-slot space and the range owner mapping before migration.\\\"}, {\\\"line_start\\\": 10, \\\"line_end\\\": 10, \\\"code_excerpt\\\": \\\"const migration = { active: true, slots: new Set([12]), from: \\\\\\\"cache-a\\\\\\\", to: \\\\\\\"cache-c\\\\\\\" };\\\", \\\"evidence_role\\\": \\\"Directly provides dependencies for whether migration is active, migrating slots, source node, and target node.\\\"}, {\\\"line_start\\\": 15, \\\"line_end\\\": 23, \\\"code_excerpt\\\": \\\"const slot = keyHash % SLOT_COUNT;\\\\nconst source = slotOwner[slot];\\\\nif (migration.active && migration.slots.has(slot)) {\\\\n  const target = migration.to;\\\\n  return { node: target, redirect: localNode !== target, target, migration: \\\\\\\"read-source-on-miss\\\\\\\" };\\\", \\\"evidence_role\\\": \\\"Supports slot calculation, source node reading, migration condition check, and the path where the target node overrides the original owner.\\\"}]\", \"route_decision\": \"{\\\"request_key\\\": \\\"acct:7\\\", \\\"key_hash\\\": 524, \\\"selected_slot\\\": 12, \\\"candidate_nodes\\\": [\\\"cache-a\\\", \\\"cache-c\\\"], \\\"selected_node\\\": \\\"cache-c\\\", \\\"redirect\\\": {\\\"redirect_required\\\": true, \\\"redirect_type\\\": \\\"migration target forwarding\\\", \\\"redirect_target\\\": \\\"cache-c\\\"}, \\\"migration_handling\\\": {\\\"migration_detected\\\": true, \\\"handling_strategy\\\": \\\"During migration of slot 12, keep cache-a as the source node and forward matching requests to target node cache-c; on a miss, it can fall back to read the source node.\\\", \\\"fallback_node\\\": \\\"cache-a\\\"}, \\\"decision_explanation\\\": \\\"The character code sum of acct:7 is 524, and 524 % 32 gives slot 12. slotOwner marks the original owner of this slot as cache-a, but the migration state covers slot 12, and migration.to is cache-c, so the actual target becomes cache-c. The current entry node is cache-a, so one migration target forward is required.\\\"}\", \"dependency_graph\": \"[{\\\"source_symbol\\\": \\\"key\\\", \\\"target_symbol\\\": \\\"hashKey\\\", \\\"dependency_kind\\\": \\\"call\\\", \\\"dependency_reason\\\": \\\"The character code sum of the request key determines the hash value.\\\"}, {\\\"source_symbol\\\": \\\"keyHash\\\", \\\"target_symbol\\\": \\\"slot\\\", \\\"dependency_kind\\\": \\\"write\\\", \\\"dependency_reason\\\": \\\"The hash value determines the slot through modulo 32.\\\"}, {\\\"source_symbol\\\": \\\"slot\\\", \\\"target_symbol\\\": \\\"slotOwner[slot]\\\", \\\"dependency_kind\\\": \\\"mapping lookup\\\", \\\"dependency_reason\\\": \\\"The slot is used to obtain the source node before migration.\\\"}, {\\\"source_symbol\\\": \\\"migration.slots\\\", \\\"target_symbol\\\": \\\"migration.slots.has(slot)\\\", \\\"dependency_kind\\\": \\\"conditional check\\\", \\\"dependency_reason\\\": \\\"The migrating slot set determines whether to override the original slot owner.\\\"}, {\\\"source_symbol\\\": \\\"migration.to\\\", \\\"target_symbol\\\": \\\"target\\\", \\\"dependency_kind\\\": \\\"read\\\", \\\"dependency_reason\\\": \\\"When migration hits, the target node is provided by the to field of the migration state.\\\"}, {\\\"source_symbol\\\": \\\"localNode\\\", \\\"target_symbol\\\": \\\"redirect\\\", \\\"dependency_kind\\\": \\\"conditional check\\\", \\\"dependency_reason\\\": \\\"Forwarding is required when the current node is not the migration target.\\\"}]\", \"inference_summary\": \"This implementation first maps the request key to 32 slots, then obtains the pre-migration source node through slotOwner. acct:7 maps to slot 12, whose original owner is cache-a; because slot 12 is migrating from cache-a to cache-c, the migration branch overrides the normal owner and forwards the request to cache-c. After migration completes, the slot owner needs to be updated and the migration set cleared, so the same request changes from the migration forwarding path to directly accessing cache-c.\", \"routing_data_structures\": \"{\\\"hashing_strategy\\\": \\\"Accumulate Unicode code values character by character for the request key and convert to an unsigned integer.\\\", \\\"slot_space\\\": {\\\"slot_count\\\": 32, \\\"slot_range\\\": \\\"Valid slots are 0 to 31; slot = keyHash % 32.\\\"}, \\\"slot_mapping\\\": {\\\"mapping_type\\\": \\\"Range owner mapping generated from an array; slots 0 to 15 initially belong to cache-a, and slots 16 to 31 belong to cache-b.\\\", \\\"hash_to_slot_rule\\\": \\\"slot = hashKey(key) % SLOT_COUNT.\\\", \\\"slot_to_node_rule\\\": \\\"Look up the source node through slotOwner[slot]; if the migration state covers the slot, use the target node migration.to as the actual request node.\\\"}, \\\"node_registry\\\": [{\\\"node_id\\\": \\\"cache-a\\\", \\\"endpoint\\\": \\\"cache-a.internal:6379\\\", \\\"node_state\\\": \\\"available\\\", \\\"weight\\\": 1}, {\\\"node_id\\\": \\\"cache-b\\\", \\\"endpoint\\\": \\\"cache-b.internal:6379\\\", \\\"node_state\\\": \\\"available\\\", \\\"weight\\\": 1}, {\\\"node_id\\\": \\\"cache-c\\\", \\\"endpoint\\\": \\\"cache-c.internal:6379\\\", \\\"node_state\\\": \\\"migrating\\\", \\\"weight\\\": 1}], \\\"migration_state\\\": {\\\"migration_active\\\": true, \\\"migrating_slots\\\": [12], \\\"source_node\\\": \\\"cache-a\\\", \\\"target_node\\\": \\\"cache-c\\\"}}\"}","文本","const SLOT_COUNT = 32;\nconst slotOwner = Array.from({ length: SLOT_COUNT }, (_, slot) =>\n  slot \u003C 16 ? \"cache-a\" : \"cache-b\"\n);\nconst nodes = {\n  \"cache-a\": { endpoint: \"cache-a.internal:6379\", state: \"up\" },\n  \"cache-b\": { endpoint: \"cache-b.internal:6379\", state: \"up\" },\n  \"cache-c\": { endpoint: \"cache-c.internal:6379\", state: \"migrating\" }\n};\nconst migration = { active: true, slots: new Set([12]), from: \"cache-a\", to: \"cache-c\" };\nfunction hashKey(key) {\n  return [...key].reduce((h, c) => h + c.charCodeAt(0), 0) >>> 0;\n}\nfunction route(key, localNode = \"cache-a\") {\n  const keyHash = hashKey(key);\n  const slot = keyHash % SLOT_COUNT;\n  const source = slotOwner[slot];\n  if (migration.active && migration.slots.has(slot)) {\n    const target = migration.to;\n    return { node: target, redirect: localNode !== target, target, migration: \"read-source-on-miss\" };\n  }\n  return { node: source, redirect: localNode !== source, target: source };\n}","[{\"step_index\": 1, \"operation\": \"Compute character accumulation hash\", \"condition\": \"route receives the request key\", \"reads\": [\"key\", \"hashKey\"], \"writes\": [\"keyHash\"], \"branch_effect\": \"Provides an integer representation of the request key for slot calculation.\"}, {\"step_index\": 2, \"operation\": \"Execute slot modulo\", \"condition\": \"keyHash has been generated\", \"reads\": [\"keyHash\", \"SLOT_COUNT\"], \"writes\": [\"slot\"], \"branch_effect\": \"Places the request into one of 32 slots.\"}, {\"step_index\": 3, \"operation\": \"Read original slot owner\", \"condition\": \"slotOwner[slot] exists\", \"reads\": [\"slotOwner\", \"slot\"], \"writes\": [\"source\"], \"branch_effect\": \"Obtains the source node responsible for the slot before migration.\"}, {\"step_index\": 4, \"operation\": \"Detect migrating slot\", \"condition\": \"migration.active && migration.slots.has(slot)\", \"reads\": [\"migration.active\", \"migration.slots\", \"slot\"], \"writes\": [\"target\"], \"branch_effect\": \"When migration hits, does not return source; instead selects migration.to as the target node.\"}, {\"step_index\": 5, \"operation\": \"Generate forwarding result\", \"condition\": \"localNode !== target or localNode === target\", \"reads\": [\"localNode\", \"target\", \"source\"], \"writes\": [\"redirect\", \"routeResult\"], \"branch_effect\": \"During migration, requests entering from the source node are forwarded to the target node; when migration does not hit, directly accesses the slot owner.\"}]","[{\"change_type\": \"Migration completed\", \"changed_component\": \"migration.active, migration.slots, and slotOwner[12]\", \"affected_slot_range\": \"12\", \"original_node\": \"cache-a\", \"new_node\": \"cache-c\", \"request_path_before\": \"The request enters from cache-a and is forwarded to cache-c after hitting the migration set.\", \"request_path_after\": \"slotOwner[12] is updated to cache-c; after the migration state is cleared, the request directly accesses cache-c.\", \"path_changed\": true, \"impact_explanation\": \"After migration completes, the owner of slot 12 should be updated to cache-c, and the migration marker should be removed. The hash and slot remain unchanged, but the request no longer depends on the migration.to branch and no longer uses cache-a as the source node, so both the control flow and the actual access path change.\"}]","[{\"line_start\": 1, \"line_end\": 4, \"code_excerpt\": \"const SLOT_COUNT = 32;\\nconst slotOwner = Array.from({ length: SLOT_COUNT }, (_, slot) =>\\n  slot \u003C 16 ? \\\"cache-a\\\" : \\\"cache-b\\\"\\n);\", \"evidence_role\": \"Defines the 32-slot space and the range owner mapping before migration.\"}, {\"line_start\": 10, \"line_end\": 10, \"code_excerpt\": \"const migration = { active: true, slots: new Set([12]), from: \\\"cache-a\\\", to: \\\"cache-c\\\" };\", \"evidence_role\": \"Directly provides dependencies for whether migration is active, migrating slots, source node, and target node.\"}, {\"line_start\": 15, \"line_end\": 23, \"code_excerpt\": \"const slot = keyHash % SLOT_COUNT;\\nconst source = slotOwner[slot];\\nif (migration.active && migration.slots.has(slot)) {\\n  const target = migration.to;\\n  return { node: target, redirect: localNode !== target, target, migration: \\\"read-source-on-miss\\\" };\", \"evidence_role\": \"Supports slot calculation, source node reading, migration condition check, and the path where the target node overrides the original owner.\"}]","{\"request_key\": \"acct:7\", \"key_hash\": 524, \"selected_slot\": 12, \"candidate_nodes\": [\"cache-a\", \"cache-c\"], \"selected_node\": \"cache-c\", \"redirect\": {\"redirect_required\": true, \"redirect_type\": \"migration target forwarding\", \"redirect_target\": \"cache-c\"}, \"migration_handling\": {\"migration_detected\": true, \"handling_strategy\": \"During migration of slot 12, keep cache-a as the source node and forward matching requests to target node cache-c; on a miss, it can fall back to read the source node.\", \"fallback_node\": \"cache-a\"}, \"decision_explanation\": \"The character code sum of acct:7 is 524, and 524 % 32 gives slot 12. slotOwner marks the original owner of this slot as cache-a, but the migration state covers slot 12, and migration.to is cache-c, so the actual target becomes cache-c. The current entry node is cache-a, so one migration target forward is required.\"}","[{\"source_symbol\": \"key\", \"target_symbol\": \"hashKey\", \"dependency_kind\": \"call\", \"dependency_reason\": \"The character code sum of the request key determines the hash value.\"}, {\"source_symbol\": \"keyHash\", \"target_symbol\": \"slot\", \"dependency_kind\": \"write\", \"dependency_reason\": \"The hash value determines the slot through modulo 32.\"}, {\"source_symbol\": \"slot\", \"target_symbol\": \"slotOwner[slot]\", \"dependency_kind\": \"mapping lookup\", \"dependency_reason\": \"The slot is used to obtain the source node before migration.\"}, {\"source_symbol\": \"migration.slots\", \"target_symbol\": \"migration.slots.has(slot)\", \"dependency_kind\": \"conditional check\", \"dependency_reason\": \"The migrating slot set determines whether to override the original slot owner.\"}, {\"source_symbol\": \"migration.to\", \"target_symbol\": \"target\", \"dependency_kind\": \"read\", \"dependency_reason\": \"When migration hits, the target node is provided by the to field of the migration state.\"}, {\"source_symbol\": \"localNode\", \"target_symbol\": \"redirect\", \"dependency_kind\": \"conditional check\", \"dependency_reason\": \"Forwarding is required when the current node is not the migration target.\"}]","This implementation first maps the request key to 32 slots, then obtains the pre-migration source node through slotOwner. acct:7 maps to slot 12, whose original owner is cache-a; because slot 12 is migrating from cache-a to cache-c, the migration branch overrides the normal owner and forwards the request to cache-c. After migration completes, the slot owner needs to be updated and the migration set cleared, so the same request changes from the migration forwarding path to directly accessing cache-c.","{\"hashing_strategy\": \"Accumulate Unicode code values character by character for the request key and convert to an unsigned integer.\", \"slot_space\": {\"slot_count\": 32, \"slot_range\": \"Valid slots are 0 to 31; slot = keyHash % 32.\"}, \"slot_mapping\": {\"mapping_type\": \"Range owner mapping generated from an array; slots 0 to 15 initially belong to cache-a, and slots 16 to 31 belong to cache-b.\", \"hash_to_slot_rule\": \"slot = hashKey(key) % SLOT_COUNT.\", \"slot_to_node_rule\": \"Look up the source node through slotOwner[slot]; if the migration state covers the slot, use the target node migration.to as the actual request node.\"}, \"node_registry\": [{\"node_id\": \"cache-a\", \"endpoint\": \"cache-a.internal:6379\", \"node_state\": \"available\", \"weight\": 1}, {\"node_id\": \"cache-b\", \"endpoint\": \"cache-b.internal:6379\", \"node_state\": \"available\", \"weight\": 1}, {\"node_id\": \"cache-c\", \"endpoint\": \"cache-c.internal:6379\", \"node_state\": \"migrating\", \"weight\": 1}], \"migration_state\": {\"migration_active\": true, \"migrating_slots\": [12], \"source_node\": \"cache-a\", \"target_node\": \"cache-c\"}}",{"id":665,"relate_table":650,"relate_id":666,"file_size":572,"file_name":667,"path":8,"duration":572,"cate":483,"file_format":653,"audio_rate":8,"audio_channel":522,"audio_bit_depth":522,"quality":8,"annotation":668,"cate_name":655,"source_code":669,"control_flow":670,"change_impact":671,"evidence_spans":672,"route_decision":673,"dependency_graph":674,"inference_summary":675,"routing_data_structures":676},15026,1972267992,"样例_2.json","{\"source_code\": \"const SLOT_RANGES = [\\n  { start: 0, end: 5, primary: \\\"cache-a\\\", replica: \\\"cache-b\\\" },\\n  { start: 6, end: 11, primary: \\\"cache-b\\\", replica: \\\"cache-a\\\" },\\n  { start: 12, end: 15, primary: \\\"cache-c\\\", replica: \\\"cache-a\\\" }\\n];\\nconst registry = {\\n  \\\"cache-a\\\": { state: \\\"up\\\" },\\n  \\\"cache-b\\\": { state: \\\"up\\\" },\\n  \\\"cache-c\\\": { state: \\\"up\\\" }\\n};\\nfunction hashKey(key) {\\n  return key.split(\\\"\\\").reduce((h, c) => (h * 31 + c.charCodeAt(0)) >>> 0, 7);\\n}\\nfunction route(key, localNode = \\\"cache-b\\\") {\\n  const keyHash = hashKey(key);\\n  const slot = keyHash % 16;\\n  const range = SLOT_RANGES.find(item => slot >= item.start && slot \u003C= item.end);\\n  const target = registry[range.primary].state === \\\"up\\\" ? range.primary : range.replica;\\n  if (target !== localNode) {\\n    return { node: target, redirect: true, target, reason: \\\"owner-mismatch\\\" };\\n  }\\n  return { node: target, redirect: false, target };\\n}\", \"control_flow\": \"[{\\\"step_index\\\": 1, \\\"operation\\\": \\\"Execute rolling hash\\\", \\\"condition\\\": \\\"Request key is passed into route\\\", \\\"reads\\\": [\\\"key\\\", \\\"hashKey\\\"], \\\"writes\\\": [\\\"keyHash\\\"], \\\"branch_effect\\\": \\\"Generates an unsigned key hash for range mapping.\\\"}, {\\\"step_index\\\": 2, \\\"operation\\\": \\\"Compute slot\\\", \\\"condition\\\": \\\"keyHash has been generated\\\", \\\"reads\\\": [\\\"keyHash\\\"], \\\"writes\\\": [\\\"slot\\\"], \\\"branch_effect\\\": \\\"Normalizes the hash value into the slot space from 0 to 15.\\\"}, {\\\"step_index\\\": 3, \\\"operation\\\": \\\"Find slot range\\\", \\\"condition\\\": \\\"There exists a range satisfying start \u003C= slot \u003C= end\\\", \\\"reads\\\": [\\\"SLOT_RANGES\\\", \\\"slot\\\"], \\\"writes\\\": [\\\"range\\\"], \\\"branch_effect\\\": \\\"Determines the primary node and replica node for the slot.\\\"}, {\\\"step_index\\\": 4, \\\"operation\\\": \\\"Check primary node state and select target\\\", \\\"condition\\\": \\\"registry[range.primary].state === \\\\\\\"up\\\\\\\"\\\", \\\"reads\\\": [\\\"registry\\\", \\\"range.primary\\\", \\\"range.replica\\\"], \\\"writes\\\": [\\\"target\\\"], \\\"branch_effect\\\": \\\"Accesses the primary node when it is available; otherwise switches to the replica node.\\\"}, {\\\"step_index\\\": 5, \\\"operation\\\": \\\"Determine whether local node matches\\\", \\\"condition\\\": \\\"target !== localNode\\\", \\\"reads\\\": [\\\"target\\\", \\\"localNode\\\"], \\\"writes\\\": [\\\"redirect\\\"], \\\"branch_effect\\\": \\\"Produces node ownership forwarding when the local node is not the target node; processes the request directly when they match.\\\"}]\", \"change_impact\": \"[{\\\"change_type\\\": \\\"Node offline\\\", \\\"changed_component\\\": \\\"registry.cache-c.state\\\", \\\"affected_slot_range\\\": \\\"12-15\\\", \\\"original_node\\\": \\\"cache-c\\\", \\\"new_node\\\": \\\"cache-a\\\", \\\"request_path_before\\\": \\\"The request is forwarded from cache-b to the available primary node cache-c.\\\", \\\"request_path_after\\\": \\\"After detecting that cache-c is unavailable, the request falls back and is forwarded from cache-b to replica cache-a.\\\", \\\"path_changed\\\": true, \\\"impact_explanation\\\": \\\"The range mapping and hash slot remain unchanged, but the result of the primary node state check changes. Because the code selects replica when the primary node is unavailable, the final target for slot 13 changes from cache-c to cache-a, and the redirect target also changes.\\\"}]\", \"evidence_spans\": \"[{\\\"line_start\\\": 1, \\\"line_end\\\": 5, \\\"code_excerpt\\\": \\\"const SLOT_RANGES = [\\\\n  { start: 0, end: 5, primary: \\\\\\\"cache-a\\\\\\\", replica: \\\\\\\"cache-b\\\\\\\" },\\\\n  { start: 6, end: 11, primary: \\\\\\\"cache-b\\\\\\\", replica: \\\\\\\"cache-a\\\\\\\" },\\\\n  { start: 12, end: 15, primary: \\\\\\\"cache-c\\\\\\\", replica: \\\\\\\"cache-a\\\\\\\" }\\\\n];\\\", \\\"evidence_role\\\": \\\"Defines contiguous slot ranges and the primary and replica nodes for each range.\\\"}, {\\\"line_start\\\": 11, \\\"line_end\\\": 14, \\\"code_excerpt\\\": \\\"const keyHash = hashKey(key);\\\\nconst slot = keyHash % 16;\\\\nconst range = SLOT_RANGES.find(item => slot >= item.start && slot \u003C= item.end);\\\", \\\"evidence_role\\\": \\\"Supports the mapping from hash value to slot and from slot to range configuration.\\\"}, {\\\"line_start\\\": 14, \\\"line_end\\\": 19, \\\"code_excerpt\\\": \\\"const target = registry[range.primary].state === \\\\\\\"up\\\\\\\" ? range.primary : range.replica;\\\\nif (target !== localNode) {\\\\n  return { node: target, redirect: true, target, reason: \\\\\\\"owner-mismatch\\\\\\\" };\\\", \\\"evidence_role\\\": \\\"Explains the control flow for primary node health check, failover fallback, and node mismatch redirect.\\\"}]\", \"route_decision\": \"{\\\"request_key\\\": \\\"k1\\\", \\\"key_hash\\\": 10093, \\\"selected_slot\\\": 13, \\\"candidate_nodes\\\": [\\\"cache-c\\\", \\\"cache-a\\\"], \\\"selected_node\\\": \\\"cache-c\\\", \\\"redirect\\\": {\\\"redirect_required\\\": true, \\\"redirect_type\\\": \\\"node ownership forwarding\\\", \\\"redirect_target\\\": \\\"cache-c\\\"}, \\\"migration_handling\\\": {\\\"migration_detected\\\": false, \\\"handling_strategy\\\": \\\"There are no migrating slots currently; select the primary or replica based on the range primary node state.\\\", \\\"fallback_node\\\": \\\"cache-a\\\"}, \\\"decision_explanation\\\": \\\"Executing a rolling hash on k1 with initial value 7 gives 10093, and 10093 % 16 is 13. Slot 13 falls in the range 12 to 15. The primary node cache-c for this range is currently available, so cache-c is selected. The request is currently at cache-b, and the target does not match, so the router needs to forward the request to cache-c.\\\"}\", \"dependency_graph\": \"[{\\\"source_symbol\\\": \\\"key\\\", \\\"target_symbol\\\": \\\"hashKey\\\", \\\"dependency_kind\\\": \\\"call\\\", \\\"dependency_reason\\\": \\\"The input to the rolling hash determines the key hash value.\\\"}, {\\\"source_symbol\\\": \\\"keyHash\\\", \\\"target_symbol\\\": \\\"slot\\\", \\\"dependency_kind\\\": \\\"write\\\", \\\"dependency_reason\\\": \\\"The key hash modulo 16 becomes the slot number.\\\"}, {\\\"source_symbol\\\": \\\"slot\\\", \\\"target_symbol\\\": \\\"SLOT_RANGES.find\\\", \\\"dependency_kind\\\": \\\"mapping lookup\\\", \\\"dependency_reason\\\": \\\"The slot number determines which contiguous range configuration to use.\\\"}, {\\\"source_symbol\\\": \\\"range.primary\\\", \\\"target_symbol\\\": \\\"registry[range.primary].state\\\", \\\"dependency_kind\\\": \\\"read\\\", \\\"dependency_reason\\\": \\\"The primary node state determines whether the primary node can continue to be accessed.\\\"}, {\\\"source_symbol\\\": \\\"registry[range.primary].state\\\", \\\"target_symbol\\\": \\\"target\\\", \\\"dependency_kind\\\": \\\"conditional check\\\", \\\"dependency_reason\\\": \\\"When the primary node is unavailable, the replica node is written into the target variable.\\\"}, {\\\"source_symbol\\\": \\\"target\\\", \\\"target_symbol\\\": \\\"redirect\\\", \\\"dependency_kind\\\": \\\"conditional check\\\", \\\"dependency_reason\\\": \\\"A redirect is triggered when the target node differs from the current node.\\\"}]\", \"inference_summary\": \"This implementation uses a rolling hash and contiguous slot range mapping. The hash of request k1 is 10093, falling into slot 13 and the range 12 to 15, which is normally served by cache-c. Because the request enters from cache-b, the code produces a forward to cache-c; if cache-c goes offline, the same slot falls back to cache-a according to the replica configuration in the range, indicating that node state changes the final path without changing the hash slot.\", \"routing_data_structures\": \"{\\\"hashing_strategy\\\": \\\"Rolling hash starting with 7 and performing h * 31 + charCode per character, truncated to an unsigned integer.\\\", \\\"slot_space\\\": {\\\"slot_count\\\": 16, \\\"slot_range\\\": \\\"Valid slots are 0 to 15, and the slot is calculated by keyHash % 16.\\\"}, \\\"slot_mapping\\\": {\\\"mapping_type\\\": \\\"Contiguous slot range mapping; each range is configured with a primary node and a replica node.\\\", \\\"hash_to_slot_rule\\\": \\\"slot = hashKey(key) % 16.\\\", \\\"slot_to_node_rule\\\": \\\"Find the range containing slot; when the primary node state is up, select primary, otherwise fall back to replica.\\\"}, \\\"node_registry\\\": [{\\\"node_id\\\": \\\"cache-a\\\", \\\"endpoint\\\": \\\"cache-a.internal:6379\\\", \\\"node_state\\\": \\\"available\\\", \\\"weight\\\": 1}, {\\\"node_id\\\": \\\"cache-b\\\", \\\"endpoint\\\": \\\"cache-b.internal:6379\\\", \\\"node_state\\\": \\\"available\\\", \\\"weight\\\": 1.5}, {\\\"node_id\\\": \\\"cache-c\\\", \\\"endpoint\\\": \\\"cache-c.internal:6379\\\", \\\"node_state\\\": \\\"available\\\", \\\"weight\\\": 1}], \\\"migration_state\\\": {\\\"migration_active\\\": false, \\\"migrating_slots\\\": [], \\\"source_node\\\": \\\"\\\", \\\"target_node\\\": \\\"\\\"}}\"}","const SLOT_RANGES = [\n  { start: 0, end: 5, primary: \"cache-a\", replica: \"cache-b\" },\n  { start: 6, end: 11, primary: \"cache-b\", replica: \"cache-a\" },\n  { start: 12, end: 15, primary: \"cache-c\", replica: \"cache-a\" }\n];\nconst registry = {\n  \"cache-a\": { state: \"up\" },\n  \"cache-b\": { state: \"up\" },\n  \"cache-c\": { state: \"up\" }\n};\nfunction hashKey(key) {\n  return key.split(\"\").reduce((h, c) => (h * 31 + c.charCodeAt(0)) >>> 0, 7);\n}\nfunction route(key, localNode = \"cache-b\") {\n  const keyHash = hashKey(key);\n  const slot = keyHash % 16;\n  const range = SLOT_RANGES.find(item => slot >= item.start && slot \u003C= item.end);\n  const target = registry[range.primary].state === \"up\" ? range.primary : range.replica;\n  if (target !== localNode) {\n    return { node: target, redirect: true, target, reason: \"owner-mismatch\" };\n  }\n  return { node: target, redirect: false, target };\n}","[{\"step_index\": 1, \"operation\": \"Execute rolling hash\", \"condition\": \"Request key is passed into route\", \"reads\": [\"key\", \"hashKey\"], \"writes\": [\"keyHash\"], \"branch_effect\": \"Generates an unsigned key hash for range mapping.\"}, {\"step_index\": 2, \"operation\": \"Compute slot\", \"condition\": \"keyHash has been generated\", \"reads\": [\"keyHash\"], \"writes\": [\"slot\"], \"branch_effect\": \"Normalizes the hash value into the slot space from 0 to 15.\"}, {\"step_index\": 3, \"operation\": \"Find slot range\", \"condition\": \"There exists a range satisfying start \u003C= slot \u003C= end\", \"reads\": [\"SLOT_RANGES\", \"slot\"], \"writes\": [\"range\"], \"branch_effect\": \"Determines the primary node and replica node for the slot.\"}, {\"step_index\": 4, \"operation\": \"Check primary node state and select target\", \"condition\": \"registry[range.primary].state === \\\"up\\\"\", \"reads\": [\"registry\", \"range.primary\", \"range.replica\"], \"writes\": [\"target\"], \"branch_effect\": \"Accesses the primary node when it is available; otherwise switches to the replica node.\"}, {\"step_index\": 5, \"operation\": \"Determine whether local node matches\", \"condition\": \"target !== localNode\", \"reads\": [\"target\", \"localNode\"], \"writes\": [\"redirect\"], \"branch_effect\": \"Produces node ownership forwarding when the local node is not the target node; processes the request directly when they match.\"}]","[{\"change_type\": \"Node offline\", \"changed_component\": \"registry.cache-c.state\", \"affected_slot_range\": \"12-15\", \"original_node\": \"cache-c\", \"new_node\": \"cache-a\", \"request_path_before\": \"The request is forwarded from cache-b to the available primary node cache-c.\", \"request_path_after\": \"After detecting that cache-c is unavailable, the request falls back and is forwarded from cache-b to replica cache-a.\", \"path_changed\": true, \"impact_explanation\": \"The range mapping and hash slot remain unchanged, but the result of the primary node state check changes. Because the code selects replica when the primary node is unavailable, the final target for slot 13 changes from cache-c to cache-a, and the redirect target also changes.\"}]","[{\"line_start\": 1, \"line_end\": 5, \"code_excerpt\": \"const SLOT_RANGES = [\\n  { start: 0, end: 5, primary: \\\"cache-a\\\", replica: \\\"cache-b\\\" },\\n  { start: 6, end: 11, primary: \\\"cache-b\\\", replica: \\\"cache-a\\\" },\\n  { start: 12, end: 15, primary: \\\"cache-c\\\", replica: \\\"cache-a\\\" }\\n];\", \"evidence_role\": \"Defines contiguous slot ranges and the primary and replica nodes for each range.\"}, {\"line_start\": 11, \"line_end\": 14, \"code_excerpt\": \"const keyHash = hashKey(key);\\nconst slot = keyHash % 16;\\nconst range = SLOT_RANGES.find(item => slot >= item.start && slot \u003C= item.end);\", \"evidence_role\": \"Supports the mapping from hash value to slot and from slot to range configuration.\"}, {\"line_start\": 14, \"line_end\": 19, \"code_excerpt\": \"const target = registry[range.primary].state === \\\"up\\\" ? range.primary : range.replica;\\nif (target !== localNode) {\\n  return { node: target, redirect: true, target, reason: \\\"owner-mismatch\\\" };\", \"evidence_role\": \"Explains the control flow for primary node health check, failover fallback, and node mismatch redirect.\"}]","{\"request_key\": \"k1\", \"key_hash\": 10093, \"selected_slot\": 13, \"candidate_nodes\": [\"cache-c\", \"cache-a\"], \"selected_node\": \"cache-c\", \"redirect\": {\"redirect_required\": true, \"redirect_type\": \"node ownership forwarding\", \"redirect_target\": \"cache-c\"}, \"migration_handling\": {\"migration_detected\": false, \"handling_strategy\": \"There are no migrating slots currently; select the primary or replica based on the range primary node state.\", \"fallback_node\": \"cache-a\"}, \"decision_explanation\": \"Executing a rolling hash on k1 with initial value 7 gives 10093, and 10093 % 16 is 13. Slot 13 falls in the range 12 to 15. The primary node cache-c for this range is currently available, so cache-c is selected. The request is currently at cache-b, and the target does not match, so the router needs to forward the request to cache-c.\"}","[{\"source_symbol\": \"key\", \"target_symbol\": \"hashKey\", \"dependency_kind\": \"call\", \"dependency_reason\": \"The input to the rolling hash determines the key hash value.\"}, {\"source_symbol\": \"keyHash\", \"target_symbol\": \"slot\", \"dependency_kind\": \"write\", \"dependency_reason\": \"The key hash modulo 16 becomes the slot number.\"}, {\"source_symbol\": \"slot\", \"target_symbol\": \"SLOT_RANGES.find\", \"dependency_kind\": \"mapping lookup\", \"dependency_reason\": \"The slot number determines which contiguous range configuration to use.\"}, {\"source_symbol\": \"range.primary\", \"target_symbol\": \"registry[range.primary].state\", \"dependency_kind\": \"read\", \"dependency_reason\": \"The primary node state determines whether the primary node can continue to be accessed.\"}, {\"source_symbol\": \"registry[range.primary].state\", \"target_symbol\": \"target\", \"dependency_kind\": \"conditional check\", \"dependency_reason\": \"When the primary node is unavailable, the replica node is written into the target variable.\"}, {\"source_symbol\": \"target\", \"target_symbol\": \"redirect\", \"dependency_kind\": \"conditional check\", \"dependency_reason\": \"A redirect is triggered when the target node differs from the current node.\"}]","This implementation uses a rolling hash and contiguous slot range mapping. The hash of request k1 is 10093, falling into slot 13 and the range 12 to 15, which is normally served by cache-c. Because the request enters from cache-b, the code produces a forward to cache-c; if cache-c goes offline, the same slot falls back to cache-a according to the replica configuration in the range, indicating that node state changes the final path without changing the hash slot.","{\"hashing_strategy\": \"Rolling hash starting with 7 and performing h * 31 + charCode per character, truncated to an unsigned integer.\", \"slot_space\": {\"slot_count\": 16, \"slot_range\": \"Valid slots are 0 to 15, and the slot is calculated by keyHash % 16.\"}, \"slot_mapping\": {\"mapping_type\": \"Contiguous slot range mapping; each range is configured with a primary node and a replica node.\", \"hash_to_slot_rule\": \"slot = hashKey(key) % 16.\", \"slot_to_node_rule\": \"Find the range containing slot; when the primary node state is up, select primary, otherwise fall back to replica.\"}, \"node_registry\": [{\"node_id\": \"cache-a\", \"endpoint\": \"cache-a.internal:6379\", \"node_state\": \"available\", \"weight\": 1}, {\"node_id\": \"cache-b\", \"endpoint\": \"cache-b.internal:6379\", \"node_state\": \"available\", \"weight\": 1.5}, {\"node_id\": \"cache-c\", \"endpoint\": \"cache-c.internal:6379\", \"node_state\": \"available\", \"weight\": 1}], \"migration_state\": {\"migration_active\": false, \"migrating_slots\": [], \"source_node\": \"\", \"target_node\": \"\"}}",{"id":678,"relate_table":650,"relate_id":679,"file_size":572,"file_name":680,"path":8,"duration":572,"cate":483,"file_format":653,"audio_rate":8,"audio_channel":522,"audio_bit_depth":522,"quality":8,"annotation":681,"cate_name":655,"source_code":682,"control_flow":683,"change_impact":684,"evidence_spans":685,"route_decision":686,"dependency_graph":687,"inference_summary":688,"routing_data_structures":689},15025,1740428496,"样例_1.json","{\"source_code\": \"const SLOT_COUNT = 16;\\nconst slots = { 3: { primary: \\\"cache-a\\\", replica: \\\"cache-b\\\" } };\\nconst migrating = new Set([3]);\\nfunction hashKey(key) {\\n  return [...key].reduce((h, c) => h + c.charCodeAt(0), 0) >>> 0;\\n}\\nfunction route(key, localNode = \\\"cache-a\\\") {\\n  const keyHash = hashKey(key);\\n  const slot = keyHash % SLOT_COUNT;\\n  const owner = slots[slot];\\n  if (!owner) throw new Error(\\\"unassigned slot\\\");\\n  if (migrating.has(slot)) {\\n    const target = owner.replica;\\n    return { node: target, redirect: localNode !== target, target, migration: \\\"forward-to-replica\\\" };\\n  }\\n  const target = owner.primary;\\n  return { node: target, redirect: localNode !== target, target };\\n}\", \"control_flow\": \"[{\\\"step_index\\\": 1, \\\"operation\\\": \\\"Compute request key hash\\\", \\\"condition\\\": \\\"Request enters the route function\\\", \\\"reads\\\": [\\\"key\\\", \\\"hashKey\\\"], \\\"writes\\\": [\\\"keyHash\\\"], \\\"branch_effect\\\": \\\"Provides a deterministic integer hash value for subsequent slot calculation.\\\"}, {\\\"step_index\\\": 2, \\\"operation\\\": \\\"Compute slot number\\\", \\\"condition\\\": \\\"keyHash has been generated\\\", \\\"reads\\\": [\\\"keyHash\\\", \\\"SLOT_COUNT\\\"], \\\"writes\\\": [\\\"slot\\\"], \\\"branch_effect\\\": \\\"Maps the request to a slot between 0 and 15.\\\"}, {\\\"step_index\\\": 3, \\\"operation\\\": \\\"Read slot ownership\\\", \\\"condition\\\": \\\"slots[slot] exists\\\", \\\"reads\\\": [\\\"slots\\\", \\\"slot\\\"], \\\"writes\\\": [\\\"owner\\\"], \\\"branch_effect\\\": \\\"Obtains the primary node and replica node for the slot; if it does not exist, throws an unassigned slot error.\\\"}, {\\\"step_index\\\": 4, \\\"operation\\\": \\\"Detect migration state\\\", \\\"condition\\\": \\\"migrating.has(slot) is true\\\", \\\"reads\\\": [\\\"migrating\\\", \\\"slot\\\", \\\"owner.replica\\\"], \\\"writes\\\": [\\\"target\\\"], \\\"branch_effect\\\": \\\"Skips the direct primary path and sends the migrating slot request to the replica target node.\\\"}, {\\\"step_index\\\": 5, \\\"operation\\\": \\\"Generate routing result\\\", \\\"condition\\\": \\\"The migration branch or normal branch completes target selection\\\", \\\"reads\\\": [\\\"localNode\\\", \\\"target\\\"], \\\"writes\\\": [\\\"redirect\\\", \\\"routeResult\\\"], \\\"branch_effect\\\": \\\"Marks a redirect when the local node is not the target node; otherwise directly accesses the selected node.\\\"}]\", \"change_impact\": \"[{\\\"change_type\\\": \\\"Migration completed\\\", \\\"changed_component\\\": \\\"migrating set and node ownership of slots[3]\\\", \\\"affected_slot_range\\\": \\\"3\\\", \\\"original_node\\\": \\\"cache-a\\\", \\\"new_node\\\": \\\"cache-b\\\", \\\"request_path_before\\\": \\\"The request enters cache-a and is forwarded to cache-b after hitting the migration branch.\\\", \\\"request_path_after\\\": \\\"The request directly accesses cache-b according to the slot table and no longer executes the migration forwarding branch.\\\", \\\"path_changed\\\": true, \\\"impact_explanation\\\": \\\"After migration completes, the migration marker for slot 3 should be removed and its primary node should be updated to cache-b. The hash and slot for the same request remain unchanged, but the control flow changes from the migration branch to normal primary node access, and the actual target and intermediate forwarding behavior change.\\\"}]\", \"evidence_spans\": \"[{\\\"line_start\\\": 1, \\\"line_end\\\": 3, \\\"code_excerpt\\\": \\\"const SLOT_COUNT = 16;\\\\nconst slots = { 3: { primary: \\\\\\\"cache-a\\\\\\\", replica: \\\\\\\"cache-b\\\\\\\" } };\\\\nconst migrating = new Set([3]);\\\", \\\"evidence_role\\\": \\\"Defines the total slot count, the static mapping from slots to primary\u002Freplica nodes, and the set of slots being migrated.\\\"}, {\\\"line_start\\\": 8, \\\"line_end\\\": 14, \\\"code_excerpt\\\": \\\"const keyHash = hashKey(key);\\\\nconst slot = keyHash % SLOT_COUNT;\\\\nconst owner = slots[slot];\\\\nif (migrating.has(slot)) {\\\\n  const target = owner.replica;\\\", \\\"evidence_role\\\": \\\"Supports the control-flow dependency from request key to slot, and then to the migration target node.\\\"}, {\\\"line_start\\\": 14, \\\"line_end\\\": 17, \\\"code_excerpt\\\": \\\"return { node: target, redirect: localNode !== target, target, migration: \\\\\\\"forward-to-replica\\\\\\\" };\\\\n}\\\\nconst target = owner.primary;\\\", \\\"evidence_role\\\": \\\"Explains that the migration branch selects the replica and produces a redirect, while the normal branch selects the primary node.\\\"}]\", \"route_decision\": \"{\\\"request_key\\\": \\\"ab\\\", \\\"key_hash\\\": 195, \\\"selected_slot\\\": 3, \\\"candidate_nodes\\\": [\\\"cache-a\\\", \\\"cache-b\\\"], \\\"selected_node\\\": \\\"cache-b\\\", \\\"redirect\\\": {\\\"redirect_required\\\": true, \\\"redirect_type\\\": \\\"forwarded during migration\\\", \\\"redirect_target\\\": \\\"cache-b\\\"}, \\\"migration_handling\\\": {\\\"migration_detected\\\": true, \\\"handling_strategy\\\": \\\"During migration of slot 3, forward from source node cache-a to replica and target node cache-b.\\\", \\\"fallback_node\\\": \\\"cache-a\\\"}, \\\"decision_explanation\\\": \\\"The character code sum of string ab is 195, and 195 % 16 gives slot 3. This slot is in the migrating set. The static table shows cache-a is the source primary node and cache-b is the replica target, so the request does not take the normal primary path; instead, it is forwarded from the current routing node cache-a to cache-b.\\\"}\", \"dependency_graph\": \"[{\\\"source_symbol\\\": \\\"key\\\", \\\"target_symbol\\\": \\\"hashKey\\\", \\\"dependency_kind\\\": \\\"call\\\", \\\"dependency_reason\\\": \\\"The request key serves as input to the hash function and determines the subsequent slot.\\\"}, {\\\"source_symbol\\\": \\\"hashKey(key)\\\", \\\"target_symbol\\\": \\\"slot\\\", \\\"dependency_kind\\\": \\\"write\\\", \\\"dependency_reason\\\": \\\"The hash value generates the slot number through modulo.\\\"}, {\\\"source_symbol\\\": \\\"slot\\\", \\\"target_symbol\\\": \\\"slots[slot]\\\", \\\"dependency_kind\\\": \\\"mapping lookup\\\", \\\"dependency_reason\\\": \\\"The slot number is used to obtain the primary node and replica node.\\\"}, {\\\"source_symbol\\\": \\\"migrating\\\", \\\"target_symbol\\\": \\\"migrating.has(slot)\\\", \\\"dependency_kind\\\": \\\"conditional check\\\", \\\"dependency_reason\\\": \\\"The migration set determines whether the request bypasses the primary node and enters the migration branch.\\\"}, {\\\"source_symbol\\\": \\\"owner.replica\\\", \\\"target_symbol\\\": \\\"target\\\", \\\"dependency_kind\\\": \\\"read\\\", \\\"dependency_reason\\\": \\\"During migration, the replica node becomes the request forwarding target.\\\"}, {\\\"source_symbol\\\": \\\"localNode\\\", \\\"target_symbol\\\": \\\"redirect\\\", \\\"dependency_kind\\\": \\\"conditional check\\\", \\\"dependency_reason\\\": \\\"A redirect is required when the local node differs from the final target.\\\"}]\", \"inference_summary\": \"The router first computes a character-accumulation hash of the request key, then obtains the slot through modulo 16. Slot 3 has static ownership of primary node cache-a and replica node cache-b; because slot 3 is in the migration set, the control flow selects cache-b as the target and forwards when the local node does not match. After migration completes, the hash and slot remain unchanged, but slot ownership and the branch path change from migration forwarding to direct access to the new primary node.\", \"routing_data_structures\": \"{\\\"hashing_strategy\\\": \\\"Accumulate Unicode code values character by character for the request key, and use unsigned right shift to obtain a non-negative integer hash.\\\", \\\"slot_space\\\": {\\\"slot_count\\\": 16, \\\"slot_range\\\": \\\"Valid slots are 0 to 15, calculated as keyHash % 16.\\\"}, \\\"slot_mapping\\\": {\\\"mapping_type\\\": \\\"Static slot table; each slot records a primary node and a replica node.\\\", \\\"hash_to_slot_rule\\\": \\\"slot = hashKey(key) % SLOT_COUNT.\\\", \\\"slot_to_node_rule\\\": \\\"Read slots[slot] first; the normal path selects primary, and the migration path selects replica.\\\"}, \\\"node_registry\\\": [{\\\"node_id\\\": \\\"cache-a\\\", \\\"endpoint\\\": \\\"cache-a.internal:6379\\\", \\\"node_state\\\": \\\"available\\\", \\\"weight\\\": 1}, {\\\"node_id\\\": \\\"cache-b\\\", \\\"endpoint\\\": \\\"cache-b.internal:6379\\\", \\\"node_state\\\": \\\"available\\\", \\\"weight\\\": 1}], \\\"migration_state\\\": {\\\"migration_active\\\": true, \\\"migrating_slots\\\": [3], \\\"source_node\\\": \\\"cache-a\\\", \\\"target_node\\\": \\\"cache-b\\\"}}\"}","const SLOT_COUNT = 16;\nconst slots = { 3: { primary: \"cache-a\", replica: \"cache-b\" } };\nconst migrating = new Set([3]);\nfunction hashKey(key) {\n  return [...key].reduce((h, c) => h + c.charCodeAt(0), 0) >>> 0;\n}\nfunction route(key, localNode = \"cache-a\") {\n  const keyHash = hashKey(key);\n  const slot = keyHash % SLOT_COUNT;\n  const owner = slots[slot];\n  if (!owner) throw new Error(\"unassigned slot\");\n  if (migrating.has(slot)) {\n    const target = owner.replica;\n    return { node: target, redirect: localNode !== target, target, migration: \"forward-to-replica\" };\n  }\n  const target = owner.primary;\n  return { node: target, redirect: localNode !== target, target };\n}","[{\"step_index\": 1, \"operation\": \"Compute request key hash\", \"condition\": \"Request enters the route function\", \"reads\": [\"key\", \"hashKey\"], \"writes\": [\"keyHash\"], \"branch_effect\": \"Provides a deterministic integer hash value for subsequent slot calculation.\"}, {\"step_index\": 2, \"operation\": \"Compute slot number\", \"condition\": \"keyHash has been generated\", \"reads\": [\"keyHash\", \"SLOT_COUNT\"], \"writes\": [\"slot\"], \"branch_effect\": \"Maps the request to a slot between 0 and 15.\"}, {\"step_index\": 3, \"operation\": \"Read slot ownership\", \"condition\": \"slots[slot] exists\", \"reads\": [\"slots\", \"slot\"], \"writes\": [\"owner\"], \"branch_effect\": \"Obtains the primary node and replica node for the slot; if it does not exist, throws an unassigned slot error.\"}, {\"step_index\": 4, \"operation\": \"Detect migration state\", \"condition\": \"migrating.has(slot) is true\", \"reads\": [\"migrating\", \"slot\", \"owner.replica\"], \"writes\": [\"target\"], \"branch_effect\": \"Skips the direct primary path and sends the migrating slot request to the replica target node.\"}, {\"step_index\": 5, \"operation\": \"Generate routing result\", \"condition\": \"The migration branch or normal branch completes target selection\", \"reads\": [\"localNode\", \"target\"], \"writes\": [\"redirect\", \"routeResult\"], \"branch_effect\": \"Marks a redirect when the local node is not the target node; otherwise directly accesses the selected node.\"}]","[{\"change_type\": \"Migration completed\", \"changed_component\": \"migrating set and node ownership of slots[3]\", \"affected_slot_range\": \"3\", \"original_node\": \"cache-a\", \"new_node\": \"cache-b\", \"request_path_before\": \"The request enters cache-a and is forwarded to cache-b after hitting the migration branch.\", \"request_path_after\": \"The request directly accesses cache-b according to the slot table and no longer executes the migration forwarding branch.\", \"path_changed\": true, \"impact_explanation\": \"After migration completes, the migration marker for slot 3 should be removed and its primary node should be updated to cache-b. The hash and slot for the same request remain unchanged, but the control flow changes from the migration branch to normal primary node access, and the actual target and intermediate forwarding behavior change.\"}]","[{\"line_start\": 1, \"line_end\": 3, \"code_excerpt\": \"const SLOT_COUNT = 16;\\nconst slots = { 3: { primary: \\\"cache-a\\\", replica: \\\"cache-b\\\" } };\\nconst migrating = new Set([3]);\", \"evidence_role\": \"Defines the total slot count, the static mapping from slots to primary\u002Freplica nodes, and the set of slots being migrated.\"}, {\"line_start\": 8, \"line_end\": 14, \"code_excerpt\": \"const keyHash = hashKey(key);\\nconst slot = keyHash % SLOT_COUNT;\\nconst owner = slots[slot];\\nif (migrating.has(slot)) {\\n  const target = owner.replica;\", \"evidence_role\": \"Supports the control-flow dependency from request key to slot, and then to the migration target node.\"}, {\"line_start\": 14, \"line_end\": 17, \"code_excerpt\": \"return { node: target, redirect: localNode !== target, target, migration: \\\"forward-to-replica\\\" };\\n}\\nconst target = owner.primary;\", \"evidence_role\": \"Explains that the migration branch selects the replica and produces a redirect, while the normal branch selects the primary node.\"}]","{\"request_key\": \"ab\", \"key_hash\": 195, \"selected_slot\": 3, \"candidate_nodes\": [\"cache-a\", \"cache-b\"], \"selected_node\": \"cache-b\", \"redirect\": {\"redirect_required\": true, \"redirect_type\": \"forwarded during migration\", \"redirect_target\": \"cache-b\"}, \"migration_handling\": {\"migration_detected\": true, \"handling_strategy\": \"During migration of slot 3, forward from source node cache-a to replica and target node cache-b.\", \"fallback_node\": \"cache-a\"}, \"decision_explanation\": \"The character code sum of string ab is 195, and 195 % 16 gives slot 3. This slot is in the migrating set. The static table shows cache-a is the source primary node and cache-b is the replica target, so the request does not take the normal primary path; instead, it is forwarded from the current routing node cache-a to cache-b.\"}","[{\"source_symbol\": \"key\", \"target_symbol\": \"hashKey\", \"dependency_kind\": \"call\", \"dependency_reason\": \"The request key serves as input to the hash function and determines the subsequent slot.\"}, {\"source_symbol\": \"hashKey(key)\", \"target_symbol\": \"slot\", \"dependency_kind\": \"write\", \"dependency_reason\": \"The hash value generates the slot number through modulo.\"}, {\"source_symbol\": \"slot\", \"target_symbol\": \"slots[slot]\", \"dependency_kind\": \"mapping lookup\", \"dependency_reason\": \"The slot number is used to obtain the primary node and replica node.\"}, {\"source_symbol\": \"migrating\", \"target_symbol\": \"migrating.has(slot)\", \"dependency_kind\": \"conditional check\", \"dependency_reason\": \"The migration set determines whether the request bypasses the primary node and enters the migration branch.\"}, {\"source_symbol\": \"owner.replica\", \"target_symbol\": \"target\", \"dependency_kind\": \"read\", \"dependency_reason\": \"During migration, the replica node becomes the request forwarding target.\"}, {\"source_symbol\": \"localNode\", \"target_symbol\": \"redirect\", \"dependency_kind\": \"conditional check\", \"dependency_reason\": \"A redirect is required when the local node differs from the final target.\"}]","The router first computes a character-accumulation hash of the request key, then obtains the slot through modulo 16. Slot 3 has static ownership of primary node cache-a and replica node cache-b; because slot 3 is in the migration set, the control flow selects cache-b as the target and forwards when the local node does not match. After migration completes, the hash and slot remain unchanged, but slot ownership and the branch path change from migration forwarding to direct access to the new primary node.","{\"hashing_strategy\": \"Accumulate Unicode code values character by character for the request key, and use unsigned right shift to obtain a non-negative integer hash.\", \"slot_space\": {\"slot_count\": 16, \"slot_range\": \"Valid slots are 0 to 15, calculated as keyHash % 16.\"}, \"slot_mapping\": {\"mapping_type\": \"Static slot table; each slot records a primary node and a replica node.\", \"hash_to_slot_rule\": \"slot = hashKey(key) % SLOT_COUNT.\", \"slot_to_node_rule\": \"Read slots[slot] first; the normal path selects primary, and the migration path selects replica.\"}, \"node_registry\": [{\"node_id\": \"cache-a\", \"endpoint\": \"cache-a.internal:6379\", \"node_state\": \"available\", \"weight\": 1}, {\"node_id\": \"cache-b\", \"endpoint\": \"cache-b.internal:6379\", \"node_state\": \"available\", \"weight\": 1}], \"migration_state\": {\"migration_active\": true, \"migrating_slots\": [3], \"source_node\": \"cache-a\", \"target_node\": \"cache-b\"}}","{\"source_code\":\"const SLOT_COUNT = 32;\\nconst slotOwner = Array.from({ length: SLOT_COUNT }, (_, slot) =>\\n  slot \u003C 16 ? \\\"cache-a\\\" : \\\"cache-b\\\"\\n);\\nconst nodes = {\\n  \\\"cache-a\\\": { endpoint: \\\"cache-a.internal:6379\\\", state: \\\"up\\\" },\\n  \\\"cache-b\\\": { endpoint: \\\"cache-b.internal:6379\\\", state: \\\"up\\\" },\\n  \\\"cache-c\\\": { endpoint: \\\"cache-c.internal:6379\\\", state: \\\"migrating\\\" }\\n};\\nconst migration = { active: true, slots: new Set([12]), from: \\\"cache-a\\\", to: \\\"cache-c\\\" };\\nfunction hashKey(key) {\\n  return [...key].reduce((h, c) => h + c.charCodeAt(0), 0) >>> 0;\\n}\\nfunction route(key, localNode = \\\"cache-a\\\") {\\n  const keyHash = hashKey(key);\\n  const slot = keyHash % SLOT_COUNT;\\n  const source = slotOwner[slot];\\n  if (migration.active && migration.slots.has(slot)) {\\n    const target = migration.to;\\n    return { node: target, redirect: localNode !== target, target, migration: \\\"read-source-on-miss\\\" };\\n  }\\n  return { node: source, redirect: localNode !== source, target: source };\\n}\",\"control_flow\":\"[{\\\"step_index\\\": 1, \\\"operation\\\": \\\"Compute character accumulation hash\\\", \\\"condition\\\": \\\"route receives the request key\\\", \\\"reads\\\": [\\\"key\\\", \\\"hashKey\\\"], \\\"writes\\\": [\\\"keyHash\\\"], \\\"branch_effect\\\": \\\"Provides an integer representation of the request key for slot calculation.\\\"}, {\\\"step_index\\\": 2, \\\"operation\\\": \\\"Execute slot modulo\\\", \\\"condition\\\": \\\"keyHash has been generated\\\", \\\"reads\\\": [\\\"keyHash\\\", \\\"SLOT_COUNT\\\"], \\\"writes\\\": [\\\"slot\\\"], \\\"branch_effect\\\": \\\"Places the request into one of 32 slots.\\\"}, {\\\"step_index\\\": 3, \\\"operation\\\": \\\"Read original slot owner\\\", \\\"condition\\\": \\\"slotOwner[slot] exists\\\", \\\"reads\\\": [\\\"slotOwner\\\", \\\"slot\\\"], \\\"writes\\\": [\\\"source\\\"], \\\"branch_effect\\\": \\\"Obtains the source node responsible for the slot before migration.\\\"}, {\\\"step_index\\\": 4, \\\"operation\\\": \\\"Detect migrating slot\\\", \\\"condition\\\": \\\"migration.active && migration.slots.has(slot)\\\", \\\"reads\\\": [\\\"migration.active\\\", \\\"migration.slots\\\", \\\"slot\\\"], \\\"writes\\\": [\\\"target\\\"], \\\"branch_effect\\\": \\\"When migration hits, does not return source; instead selects migration.to as the target node.\\\"}, {\\\"step_index\\\": 5, \\\"operation\\\": \\\"Generate forwarding result\\\", \\\"condition\\\": \\\"localNode !== target or localNode === target\\\", \\\"reads\\\": [\\\"localNode\\\", \\\"target\\\", \\\"source\\\"], \\\"writes\\\": [\\\"redirect\\\", \\\"routeResult\\\"], \\\"branch_effect\\\": \\\"During migration, requests entering from the source node are forwarded to the target node; when migration does not hit, directly accesses the slot owner.\\\"}]\",\"change_impact\":\"[{\\\"change_type\\\": \\\"Migration completed\\\", \\\"changed_component\\\": \\\"migration.active, migration.slots, and slotOwner[12]\\\", \\\"affected_slot_range\\\": \\\"12\\\", \\\"original_node\\\": \\\"cache-a\\\", \\\"new_node\\\": \\\"cache-c\\\", \\\"request_path_before\\\": \\\"The request enters from cache-a and is forwarded to cache-c after hitting the migration set.\\\", \\\"request_path_after\\\": \\\"slotOwner[12] is updated to cache-c; after the migration state is cleared, the request directly accesses cache-c.\\\", \\\"path_changed\\\": true, \\\"impact_explanation\\\": \\\"After migration completes, the owner of slot 12 should be updated to cache-c, and the migration marker should be removed. The hash and slot remain unchanged, but the request no longer depends on the migration.to branch and no longer uses cache-a as the source node, so both the control flow and the actual access path change.\\\"}]\",\"evidence_spans\":\"[{\\\"line_start\\\": 1, \\\"line_end\\\": 4, \\\"code_excerpt\\\": \\\"const SLOT_COUNT = 32;\\\\nconst slotOwner = Array.from({ length: SLOT_COUNT }, (_, slot) =>\\\\n  slot \u003C 16 ? \\\\\\\"cache-a\\\\\\\" : \\\\\\\"cache-b\\\\\\\"\\\\n);\\\", \\\"evidence_role\\\": \\\"Defines the 32-slot space and the range owner mapping before migration.\\\"}, {\\\"line_start\\\": 10, \\\"line_end\\\": 10, \\\"code_excerpt\\\": \\\"const migration = { active: true, slots: new Set([12]), from: \\\\\\\"cache-a\\\\\\\", to: \\\\\\\"cache-c\\\\\\\" };\\\", \\\"evidence_role\\\": \\\"Directly provides dependencies for whether migration is active, migrating slots, source node, and target node.\\\"}, {\\\"line_start\\\": 15, \\\"line_end\\\": 23, \\\"code_excerpt\\\": \\\"const slot = keyHash % SLOT_COUNT;\\\\nconst source = slotOwner[slot];\\\\nif (migration.active && migration.slots.has(slot)) {\\\\n  const target = migration.to;\\\\n  return { node: target, redirect: localNode !== target, target, migration: \\\\\\\"read-source-on-miss\\\\\\\" };\\\", \\\"evidence_role\\\": \\\"Supports slot calculation, source node reading, migration condition check, and the path where the target node overrides the original owner.\\\"}]\",\"route_decision\":\"{\\\"request_key\\\": \\\"acct:7\\\", \\\"key_hash\\\": 524, \\\"selected_slot\\\": 12, \\\"candidate_nodes\\\": [\\\"cache-a\\\", \\\"cache-c\\\"], \\\"selected_node\\\": \\\"cache-c\\\", \\\"redirect\\\": {\\\"redirect_required\\\": true, \\\"redirect_type\\\": \\\"migration target forwarding\\\", \\\"redirect_target\\\": \\\"cache-c\\\"}, \\\"migration_handling\\\": {\\\"migration_detected\\\": true, \\\"handling_strategy\\\": \\\"During migration of slot 12, keep cache-a as the source node and forward matching requests to target node cache-c; on a miss, it can fall back to read the source node.\\\", \\\"fallback_node\\\": \\\"cache-a\\\"}, \\\"decision_explanation\\\": \\\"The character code sum of acct:7 is 524, and 524 % 32 gives slot 12. slotOwner marks the original owner of this slot as cache-a, but the migration state covers slot 12, and migration.to is cache-c, so the actual target becomes cache-c. The current entry node is cache-a, so one migration target forward is required.\\\"}\",\"dependency_graph\":\"[{\\\"source_symbol\\\": \\\"key\\\", \\\"target_symbol\\\": \\\"hashKey\\\", \\\"dependency_kind\\\": \\\"call\\\", \\\"dependency_reason\\\": \\\"The character code sum of the request key determines the hash value.\\\"}, {\\\"source_symbol\\\": \\\"keyHash\\\", \\\"target_symbol\\\": \\\"slot\\\", \\\"dependency_kind\\\": \\\"write\\\", \\\"dependency_reason\\\": \\\"The hash value determines the slot through modulo 32.\\\"}, {\\\"source_symbol\\\": \\\"slot\\\", \\\"target_symbol\\\": \\\"slotOwner[slot]\\\", \\\"dependency_kind\\\": \\\"mapping lookup\\\", \\\"dependency_reason\\\": \\\"The slot is used to obtain the source node before migration.\\\"}, {\\\"source_symbol\\\": \\\"migration.slots\\\", \\\"target_symbol\\\": \\\"migration.slots.has(slot)\\\", \\\"dependency_kind\\\": \\\"conditional check\\\", \\\"dependency_reason\\\": \\\"The migrating slot set determines whether to override the original slot owner.\\\"}, {\\\"source_symbol\\\": \\\"migration.to\\\", \\\"target_symbol\\\": \\\"target\\\", \\\"dependency_kind\\\": \\\"read\\\", \\\"dependency_reason\\\": \\\"When migration hits, the target node is provided by the to field of the migration state.\\\"}, {\\\"source_symbol\\\": \\\"localNode\\\", \\\"target_symbol\\\": \\\"redirect\\\", \\\"dependency_kind\\\": \\\"conditional check\\\", \\\"dependency_reason\\\": \\\"Forwarding is required when the current node is not the migration target.\\\"}]\",\"inference_summary\":\"This implementation first maps the request key to 32 slots, then obtains the pre-migration source node through slotOwner. acct:7 maps to slot 12, whose original owner is cache-a; because slot 12 is migrating from cache-a to cache-c, the migration branch overrides the normal owner and forwards the request to cache-c. After migration completes, the slot owner needs to be updated and the migration set cleared, so the same request changes from the migration forwarding path to directly accessing cache-c.\",\"routing_data_structures\":\"{\\\"hashing_strategy\\\": \\\"Accumulate Unicode code values character by character for the request key and convert to an unsigned integer.\\\", \\\"slot_space\\\": {\\\"slot_count\\\": 32, \\\"slot_range\\\": \\\"Valid slots are 0 to 31; slot = keyHash % 32.\\\"}, \\\"slot_mapping\\\": {\\\"mapping_type\\\": \\\"Range owner mapping generated from an array; slots 0 to 15 initially belong to cache-a, and slots 16 to 31 belong to cache-b.\\\", \\\"hash_to_slot_rule\\\": \\\"slot = hashKey(key) % SLOT_COUNT.\\\", \\\"slot_to_node_rule\\\": \\\"Look up the source node through slotOwner[slot]; if the migration state covers the slot, use the target node migration.to as the actual request node.\\\"}, \\\"node_registry\\\": [{\\\"node_id\\\": \\\"cache-a\\\", \\\"endpoint\\\": \\\"cache-a.internal:6379\\\", \\\"node_state\\\": \\\"available\\\", \\\"weight\\\": 1}, {\\\"node_id\\\": \\\"cache-b\\\", \\\"endpoint\\\": \\\"cache-b.internal:6379\\\", \\\"node_state\\\": \\\"available\\\", \\\"weight\\\": 1}, {\\\"node_id\\\": \\\"cache-c\\\", \\\"endpoint\\\": \\\"cache-c.internal:6379\\\", \\\"node_state\\\": \\\"migrating\\\", \\\"weight\\\": 1}], \\\"migration_state\\\": {\\\"migration_active\\\": true, \\\"migrating_slots\\\": [12], \\\"source_node\\\": \\\"cache-a\\\", \\\"target_node\\\": \\\"cache-c\\\"}}\"}","MOBIUSI INC","https:\u002F\u002Fstatic.mobiusi.com\u002Fmobiwusi\u002F20250829\u002F7bf4ac62b4533e2b809998a6f1c5491e.png?Expires=1792463130&OSSAccessKeyId=LTAI5tH8MQqhgeiAtrzCHrxM&Signature=v6Tr8jBrdm4s5wU1SnnyGsYg%2Bhw%3D&x-oss-process=image%2Fresize%2Cm_fill%2Cw_35%2Ch_35",[694,700],{"type":695,"title":696,"count_data":697},"bar","Length distribution",[698],{"name":699,"value":483},"1k lower",{"type":701,"title":702,"count_data":703},"pie","Language distribution",[704],{"name":705,"value":483},"English"]