MCPcopy Index your code
hub / github.com/AI45Lab/Code / js_queue_config_to_rust

Function js_queue_config_to_rust

sdk/node/src/lib.rs:2097–2136  ·  view source on GitHub ↗
(config: &SessionQueueConfig)

Source from the content-addressed store, hash-verified

2095}
2096
2097fn js_queue_config_to_rust(config: &SessionQueueConfig) -> napi::Result<RustSessionQueueConfig> {
2098 let mut c = if config.enable_all_features.unwrap_or(false) {
2099 RustSessionQueueConfig::default().with_lane_features()
2100 } else {
2101 RustSessionQueueConfig::default()
2102 };
2103 if let Some(n) = config.query_concurrency {
2104 c.query_max_concurrency = n as usize;
2105 }
2106 if let Some(n) = config.execute_concurrency {
2107 c.execute_max_concurrency = n as usize;
2108 }
2109 if let Some(n) = config.generate_concurrency {
2110 c.generate_max_concurrency = n as usize;
2111 }
2112 if let Some(true) = config.enable_dlq {
2113 c = c.with_dlq(config.dlq_max_size.map(|n| n as usize));
2114 }
2115 if let Some(true) = config.enable_metrics {
2116 c = c.with_metrics();
2117 }
2118 if let Some(true) = config.enable_alerts {
2119 c = c.with_alerts();
2120 }
2121 if let Some(ms) = config.timeout_ms {
2122 c = c.with_timeout(ms as u64);
2123 }
2124 if let Some(ref handlers) = config.lane_handlers {
2125 for (lane_str, handler) in handlers {
2126 let lane = parse_lane(lane_str)?;
2127 let mode = parse_handler_mode(&handler.mode)?;
2128 let lane_cfg = RustLaneHandlerConfig {
2129 mode,
2130 timeout_ms: handler.timeout_ms.map(|ms| ms as u64).unwrap_or(60_000),
2131 };
2132 c.lane_handlers.insert(lane, lane_cfg);
2133 }
2134 }
2135 Ok(c)
2136}
2137
2138fn parse_lane(lane: &str) -> napi::Result<RustSessionLane> {
2139 match lane.trim().to_ascii_lowercase().as_str() {

Callers 1

Calls 8

with_dlqMethod · 0.80
with_metricsMethod · 0.80
with_alertsMethod · 0.80
parse_laneFunction · 0.70
parse_handler_modeFunction · 0.70
with_lane_featuresMethod · 0.45
with_timeoutMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected