[router] Remove deadcode and add note for unused API completeness methods (#16528)

This commit is contained in:
Chang Su
2026-01-05 19:53:28 -08:00
committed by GitHub
parent d7b706be94
commit 4cf2bbd084
5 changed files with 7 additions and 35 deletions
@@ -66,7 +66,6 @@ impl PipelineStage for DispatchMetadataStage {
model, model,
created, created,
weight_version: Some(weight_version), weight_version: Some(weight_version),
is_streaming: ctx.is_streaming(),
}); });
Ok(None) Ok(None)
+4 -24
View File
@@ -153,8 +153,6 @@ pub(crate) struct DispatchMetadata {
pub model: String, pub model: String,
pub created: u64, pub created: u64,
pub weight_version: Option<String>, pub weight_version: Option<String>,
#[allow(dead_code)]
pub is_streaming: bool,
} }
/// Load guards for worker load tracking /// Load guards for worker load tracking
@@ -368,13 +366,13 @@ impl RequestContext {
} }
} }
impl WorkerSelection { /// Some methods are kept for API completeness even if currently unused.
#[allow(dead_code)] #[allow(dead_code)]
impl WorkerSelection {
pub fn is_dual(&self) -> bool { pub fn is_dual(&self) -> bool {
matches!(self, Self::Dual { .. }) matches!(self, Self::Dual { .. })
} }
#[allow(dead_code)]
pub fn single(&self) -> Option<&Arc<dyn Worker>> { pub fn single(&self) -> Option<&Arc<dyn Worker>> {
match self { match self {
Self::Single { worker } => Some(worker), Self::Single { worker } => Some(worker),
@@ -401,7 +399,6 @@ impl WorkerSelection {
} }
} }
#[allow(dead_code)]
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
pub fn dual(&self) -> Option<(&Arc<dyn Worker>, &Arc<dyn Worker>)> { pub fn dual(&self) -> Option<(&Arc<dyn Worker>, &Arc<dyn Worker>)> {
match self { match self {
@@ -410,7 +407,6 @@ impl WorkerSelection {
} }
} }
#[allow(dead_code)]
pub fn prefill_worker(&self) -> Option<&Arc<dyn Worker>> { pub fn prefill_worker(&self) -> Option<&Arc<dyn Worker>> {
match self { match self {
Self::Dual { prefill, .. } => Some(prefill), Self::Dual { prefill, .. } => Some(prefill),
@@ -418,7 +414,6 @@ impl WorkerSelection {
} }
} }
#[allow(dead_code)]
pub fn decode_worker(&self) -> Option<&Arc<dyn Worker>> { pub fn decode_worker(&self) -> Option<&Arc<dyn Worker>> {
match self { match self {
Self::Dual { decode, .. } => Some(decode), Self::Dual { decode, .. } => Some(decode),
@@ -427,12 +422,9 @@ impl WorkerSelection {
} }
} }
impl ClientSelection { /// Some methods are kept for API completeness even if currently unused.
#[allow(dead_code)] #[allow(dead_code)]
pub fn is_dual(&self) -> bool { impl ClientSelection {
matches!(self, Self::Dual { .. })
}
pub fn single(&self) -> Option<&GrpcClient> { pub fn single(&self) -> Option<&GrpcClient> {
match self { match self {
Self::Single { client } => Some(client), Self::Single { client } => Some(client),
@@ -447,14 +439,6 @@ impl ClientSelection {
} }
} }
#[allow(dead_code)]
pub fn dual(&self) -> Option<(&GrpcClient, &GrpcClient)> {
match self {
Self::Dual { prefill, decode } => Some((prefill, decode)),
_ => None,
}
}
pub fn dual_mut(&mut self) -> Option<(&mut GrpcClient, &mut GrpcClient)> { pub fn dual_mut(&mut self) -> Option<(&mut GrpcClient, &mut GrpcClient)> {
match self { match self {
Self::Dual { prefill, decode } => Some((prefill, decode)), Self::Dual { prefill, decode } => Some((prefill, decode)),
@@ -462,7 +446,6 @@ impl ClientSelection {
} }
} }
#[allow(dead_code)]
pub fn prefill_client(&self) -> Option<&GrpcClient> { pub fn prefill_client(&self) -> Option<&GrpcClient> {
match self { match self {
Self::Dual { prefill, .. } => Some(prefill), Self::Dual { prefill, .. } => Some(prefill),
@@ -470,7 +453,6 @@ impl ClientSelection {
} }
} }
#[allow(dead_code)]
pub fn prefill_client_mut(&mut self) -> Option<&mut GrpcClient> { pub fn prefill_client_mut(&mut self) -> Option<&mut GrpcClient> {
match self { match self {
Self::Dual { prefill, .. } => Some(prefill), Self::Dual { prefill, .. } => Some(prefill),
@@ -478,7 +460,6 @@ impl ClientSelection {
} }
} }
#[allow(dead_code)]
pub fn decode_client(&self) -> Option<&GrpcClient> { pub fn decode_client(&self) -> Option<&GrpcClient> {
match self { match self {
Self::Dual { decode, .. } => Some(decode), Self::Dual { decode, .. } => Some(decode),
@@ -486,7 +467,6 @@ impl ClientSelection {
} }
} }
#[allow(dead_code)]
pub fn decode_client_mut(&mut self) -> Option<&mut GrpcClient> { pub fn decode_client_mut(&mut self) -> Option<&mut GrpcClient> {
match self { match self {
Self::Dual { decode, .. } => Some(decode), Self::Dual { decode, .. } => Some(decode),
@@ -15,6 +15,7 @@ pub(crate) struct HarmonyMessage {
pub content: String, pub content: String,
} }
/// Some methods are kept for API completeness even if currently unused.
#[allow(dead_code)] #[allow(dead_code)]
impl HarmonyMessage { impl HarmonyMessage {
pub fn new(role: impl Into<String>, content: impl Into<String>) -> Self { pub fn new(role: impl Into<String>, content: impl Into<String>) -> Self {
@@ -110,7 +111,6 @@ pub(crate) struct HarmonyChannelOutput {
/// ///
/// Represents incremental updates as tokens are parsed from the stream. /// Represents incremental updates as tokens are parsed from the stream.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
#[allow(dead_code)]
pub(crate) struct HarmonyChannelDelta { pub(crate) struct HarmonyChannelDelta {
/// Delta for analysis/reasoning content /// Delta for analysis/reasoning content
pub analysis_delta: Option<String>, pub analysis_delta: Option<String>,
@@ -122,6 +122,7 @@ pub(crate) struct HarmonyChannelDelta {
pub final_delta: Option<String>, pub final_delta: Option<String>,
/// Whether this is the final delta /// Whether this is the final delta
#[allow(dead_code)]
pub is_final: bool, pub is_final: bool,
} }
@@ -8,7 +8,6 @@ use std::{collections::HashMap, sync::Arc};
use tokio::{sync::RwLock, task::JoinHandle}; use tokio::{sync::RwLock, task::JoinHandle};
use crate::{ use crate::{
core::WorkerRegistry,
data_connector::{ConversationItemStorage, ConversationStorage, ResponseStorage}, data_connector::{ConversationItemStorage, ConversationStorage, ResponseStorage},
grpc_client::SglangSchedulerClient, grpc_client::SglangSchedulerClient,
mcp::McpManager, mcp::McpManager,
@@ -36,13 +35,9 @@ pub(crate) struct ResponsesContext {
/// Chat pipeline for executing requests /// Chat pipeline for executing requests
pub pipeline: Arc<RequestPipeline>, pub pipeline: Arc<RequestPipeline>,
/// Shared components (tokenizer, parsers, worker_registry) /// Shared components (tokenizer, parsers)
pub components: Arc<SharedComponents>, pub components: Arc<SharedComponents>,
/// Worker registry for validation
#[allow(dead_code)]
pub worker_registry: Arc<WorkerRegistry>,
/// Response storage backend /// Response storage backend
pub response_storage: Arc<dyn ResponseStorage>, pub response_storage: Arc<dyn ResponseStorage>,
@@ -64,7 +59,6 @@ impl ResponsesContext {
pub fn new( pub fn new(
pipeline: Arc<RequestPipeline>, pipeline: Arc<RequestPipeline>,
components: Arc<SharedComponents>, components: Arc<SharedComponents>,
worker_registry: Arc<WorkerRegistry>,
response_storage: Arc<dyn ResponseStorage>, response_storage: Arc<dyn ResponseStorage>,
conversation_storage: Arc<dyn ConversationStorage>, conversation_storage: Arc<dyn ConversationStorage>,
conversation_item_storage: Arc<dyn ConversationItemStorage>, conversation_item_storage: Arc<dyn ConversationItemStorage>,
@@ -73,7 +67,6 @@ impl ResponsesContext {
Self { Self {
pipeline, pipeline,
components, components,
worker_registry,
response_storage, response_storage,
conversation_storage, conversation_storage,
conversation_item_storage, conversation_item_storage,
@@ -116,7 +116,6 @@ impl GrpcRouter {
responses::ResponsesContext::new( responses::ResponsesContext::new(
Arc::new(pipeline.clone()), Arc::new(pipeline.clone()),
shared_components.clone(), shared_components.clone(),
worker_registry.clone(),
ctx.response_storage.clone(), ctx.response_storage.clone(),
ctx.conversation_storage.clone(), ctx.conversation_storage.clone(),
ctx.conversation_item_storage.clone(), ctx.conversation_item_storage.clone(),