[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

View File

@@ -66,7 +66,6 @@ impl PipelineStage for DispatchMetadataStage {
model,
created,
weight_version: Some(weight_version),
is_streaming: ctx.is_streaming(),
});
Ok(None)

View File

@@ -153,8 +153,6 @@ pub(crate) struct DispatchMetadata {
pub model: String,
pub created: u64,
pub weight_version: Option<String>,
#[allow(dead_code)]
pub is_streaming: bool,
}
/// Load guards for worker load tracking
@@ -368,13 +366,13 @@ impl RequestContext {
}
}
/// Some methods are kept for API completeness even if currently unused.
#[allow(dead_code)]
impl WorkerSelection {
#[allow(dead_code)]
pub fn is_dual(&self) -> bool {
matches!(self, Self::Dual { .. })
}
#[allow(dead_code)]
pub fn single(&self) -> Option<&Arc<dyn Worker>> {
match self {
Self::Single { worker } => Some(worker),
@@ -401,7 +399,6 @@ impl WorkerSelection {
}
}
#[allow(dead_code)]
#[allow(clippy::type_complexity)]
pub fn dual(&self) -> Option<(&Arc<dyn Worker>, &Arc<dyn Worker>)> {
match self {
@@ -410,7 +407,6 @@ impl WorkerSelection {
}
}
#[allow(dead_code)]
pub fn prefill_worker(&self) -> Option<&Arc<dyn Worker>> {
match self {
Self::Dual { prefill, .. } => Some(prefill),
@@ -418,7 +414,6 @@ impl WorkerSelection {
}
}
#[allow(dead_code)]
pub fn decode_worker(&self) -> Option<&Arc<dyn Worker>> {
match self {
Self::Dual { decode, .. } => Some(decode),
@@ -427,12 +422,9 @@ impl WorkerSelection {
}
}
/// Some methods are kept for API completeness even if currently unused.
#[allow(dead_code)]
impl ClientSelection {
#[allow(dead_code)]
pub fn is_dual(&self) -> bool {
matches!(self, Self::Dual { .. })
}
pub fn single(&self) -> Option<&GrpcClient> {
match self {
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)> {
match self {
Self::Dual { prefill, decode } => Some((prefill, decode)),
@@ -462,7 +446,6 @@ impl ClientSelection {
}
}
#[allow(dead_code)]
pub fn prefill_client(&self) -> Option<&GrpcClient> {
match self {
Self::Dual { prefill, .. } => Some(prefill),
@@ -470,7 +453,6 @@ impl ClientSelection {
}
}
#[allow(dead_code)]
pub fn prefill_client_mut(&mut self) -> Option<&mut GrpcClient> {
match self {
Self::Dual { prefill, .. } => Some(prefill),
@@ -478,7 +460,6 @@ impl ClientSelection {
}
}
#[allow(dead_code)]
pub fn decode_client(&self) -> Option<&GrpcClient> {
match self {
Self::Dual { decode, .. } => Some(decode),
@@ -486,7 +467,6 @@ impl ClientSelection {
}
}
#[allow(dead_code)]
pub fn decode_client_mut(&mut self) -> Option<&mut GrpcClient> {
match self {
Self::Dual { decode, .. } => Some(decode),

View File

@@ -15,6 +15,7 @@ pub(crate) struct HarmonyMessage {
pub content: String,
}
/// Some methods are kept for API completeness even if currently unused.
#[allow(dead_code)]
impl HarmonyMessage {
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.
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub(crate) struct HarmonyChannelDelta {
/// Delta for analysis/reasoning content
pub analysis_delta: Option<String>,
@@ -122,6 +122,7 @@ pub(crate) struct HarmonyChannelDelta {
pub final_delta: Option<String>,
/// Whether this is the final delta
#[allow(dead_code)]
pub is_final: bool,
}

View File

@@ -8,7 +8,6 @@ use std::{collections::HashMap, sync::Arc};
use tokio::{sync::RwLock, task::JoinHandle};
use crate::{
core::WorkerRegistry,
data_connector::{ConversationItemStorage, ConversationStorage, ResponseStorage},
grpc_client::SglangSchedulerClient,
mcp::McpManager,
@@ -36,13 +35,9 @@ pub(crate) struct ResponsesContext {
/// Chat pipeline for executing requests
pub pipeline: Arc<RequestPipeline>,
/// Shared components (tokenizer, parsers, worker_registry)
/// Shared components (tokenizer, parsers)
pub components: Arc<SharedComponents>,
/// Worker registry for validation
#[allow(dead_code)]
pub worker_registry: Arc<WorkerRegistry>,
/// Response storage backend
pub response_storage: Arc<dyn ResponseStorage>,
@@ -64,7 +59,6 @@ impl ResponsesContext {
pub fn new(
pipeline: Arc<RequestPipeline>,
components: Arc<SharedComponents>,
worker_registry: Arc<WorkerRegistry>,
response_storage: Arc<dyn ResponseStorage>,
conversation_storage: Arc<dyn ConversationStorage>,
conversation_item_storage: Arc<dyn ConversationItemStorage>,
@@ -73,7 +67,6 @@ impl ResponsesContext {
Self {
pipeline,
components,
worker_registry,
response_storage,
conversation_storage,
conversation_item_storage,

View File

@@ -116,7 +116,6 @@ impl GrpcRouter {
responses::ResponsesContext::new(
Arc::new(pipeline.clone()),
shared_components.clone(),
worker_registry.clone(),
ctx.response_storage.clone(),
ctx.conversation_storage.clone(),
ctx.conversation_item_storage.clone(),