Skip to content

Commit 48414f8

Browse files
committed
Remove deadcode that are not used and move unused API completeness methods
1 parent 2d02c15 commit 48414f8

File tree

5 files changed

+51
-62
lines changed

5 files changed

+51
-62
lines changed

sgl-model-gateway/src/routers/grpc/common/stages/dispatch_metadata.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ impl PipelineStage for DispatchMetadataStage {
6666
model,
6767
created,
6868
weight_version: Some(weight_version),
69-
is_streaming: ctx.is_streaming(),
7069
});
7170

7271
Ok(None)

sgl-model-gateway/src/routers/grpc/context.rs

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ pub(crate) struct DispatchMetadata {
153153
pub model: String,
154154
pub created: u64,
155155
pub weight_version: Option<String>,
156-
#[allow(dead_code)]
157-
pub is_streaming: bool,
158156
}
159157

160158
/// Load guards for worker load tracking
@@ -369,19 +367,6 @@ impl RequestContext {
369367
}
370368

371369
impl WorkerSelection {
372-
#[allow(dead_code)]
373-
pub fn is_dual(&self) -> bool {
374-
matches!(self, Self::Dual { .. })
375-
}
376-
377-
#[allow(dead_code)]
378-
pub fn single(&self) -> Option<&Arc<dyn Worker>> {
379-
match self {
380-
Self::Single { worker } => Some(worker),
381-
_ => None,
382-
}
383-
}
384-
385370
/// Record circuit breaker outcome for all workers
386371
pub fn record_outcome(&self, success: bool) {
387372
match self {
@@ -400,8 +385,22 @@ impl WorkerSelection {
400385
decode.record_outcome(decode_success);
401386
}
402387
}
388+
}
389+
390+
/// Accessor methods kept for API completeness.
391+
#[allow(dead_code)]
392+
impl WorkerSelection {
393+
pub fn is_dual(&self) -> bool {
394+
matches!(self, Self::Dual { .. })
395+
}
396+
397+
pub fn single(&self) -> Option<&Arc<dyn Worker>> {
398+
match self {
399+
Self::Single { worker } => Some(worker),
400+
_ => None,
401+
}
402+
}
403403

404-
#[allow(dead_code)]
405404
#[allow(clippy::type_complexity)]
406405
pub fn dual(&self) -> Option<(&Arc<dyn Worker>, &Arc<dyn Worker>)> {
407406
match self {
@@ -410,15 +409,13 @@ impl WorkerSelection {
410409
}
411410
}
412411

413-
#[allow(dead_code)]
414412
pub fn prefill_worker(&self) -> Option<&Arc<dyn Worker>> {
415413
match self {
416414
Self::Dual { prefill, .. } => Some(prefill),
417415
_ => None,
418416
}
419417
}
420418

421-
#[allow(dead_code)]
422419
pub fn decode_worker(&self) -> Option<&Arc<dyn Worker>> {
423420
match self {
424421
Self::Dual { decode, .. } => Some(decode),
@@ -428,11 +425,6 @@ impl WorkerSelection {
428425
}
429426

430427
impl ClientSelection {
431-
#[allow(dead_code)]
432-
pub fn is_dual(&self) -> bool {
433-
matches!(self, Self::Dual { .. })
434-
}
435-
436428
pub fn single(&self) -> Option<&GrpcClient> {
437429
match self {
438430
Self::Single { client } => Some(client),
@@ -447,46 +439,49 @@ impl ClientSelection {
447439
}
448440
}
449441

450-
#[allow(dead_code)]
451-
pub fn dual(&self) -> Option<(&GrpcClient, &GrpcClient)> {
442+
pub fn dual_mut(&mut self) -> Option<(&mut GrpcClient, &mut GrpcClient)> {
452443
match self {
453444
Self::Dual { prefill, decode } => Some((prefill, decode)),
454445
_ => None,
455446
}
456447
}
448+
}
457449

458-
pub fn dual_mut(&mut self) -> Option<(&mut GrpcClient, &mut GrpcClient)> {
450+
/// Accessor methods kept for API completeness.
451+
#[allow(dead_code)]
452+
impl ClientSelection {
453+
pub fn is_dual(&self) -> bool {
454+
matches!(self, Self::Dual { .. })
455+
}
456+
457+
pub fn dual(&self) -> Option<(&GrpcClient, &GrpcClient)> {
459458
match self {
460459
Self::Dual { prefill, decode } => Some((prefill, decode)),
461460
_ => None,
462461
}
463462
}
464463

465-
#[allow(dead_code)]
466464
pub fn prefill_client(&self) -> Option<&GrpcClient> {
467465
match self {
468466
Self::Dual { prefill, .. } => Some(prefill),
469467
_ => None,
470468
}
471469
}
472470

473-
#[allow(dead_code)]
474471
pub fn prefill_client_mut(&mut self) -> Option<&mut GrpcClient> {
475472
match self {
476473
Self::Dual { prefill, .. } => Some(prefill),
477474
_ => None,
478475
}
479476
}
480477

481-
#[allow(dead_code)]
482478
pub fn decode_client(&self) -> Option<&GrpcClient> {
483479
match self {
484480
Self::Dual { decode, .. } => Some(decode),
485481
_ => None,
486482
}
487483
}
488484

489-
#[allow(dead_code)]
490485
pub fn decode_client_mut(&mut self) -> Option<&mut GrpcClient> {
491486
match self {
492487
Self::Dual { decode, .. } => Some(decode),

sgl-model-gateway/src/routers/grpc/harmony/types.rs

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,9 @@ pub(crate) struct HarmonyMessage {
1515
pub content: String,
1616
}
1717

18-
#[allow(dead_code)]
1918
impl HarmonyMessage {
20-
pub fn new(role: impl Into<String>, content: impl Into<String>) -> Self {
21-
Self {
22-
role: role.into(),
23-
content: content.into(),
24-
}
25-
}
26-
27-
pub fn user(content: impl Into<String>) -> Self {
28-
Self::new("user", content)
29-
}
30-
31-
pub fn assistant(content: impl Into<String>) -> Self {
32-
Self::new("assistant", content)
33-
}
34-
35-
pub fn system(content: impl Into<String>) -> Self {
36-
Self::new("system", content)
37-
}
38-
3919
/// Convert from openai_harmony::chat::Message to our simplified HarmonyMessage
40-
pub fn from_openai_harmony(msg: openai_harmony::chat::Message) -> Self {
20+
pub(crate) fn from_openai_harmony(msg: openai_harmony::chat::Message) -> Self {
4121
// Extract role as string
4222
let role = match msg.author.role {
4323
openai_harmony::chat::Role::User => "user",
@@ -63,6 +43,29 @@ impl HarmonyMessage {
6343
}
6444
}
6545

46+
/// Convenience constructors kept for API completeness.
47+
#[allow(dead_code)]
48+
impl HarmonyMessage {
49+
pub fn new(role: impl Into<String>, content: impl Into<String>) -> Self {
50+
Self {
51+
role: role.into(),
52+
content: content.into(),
53+
}
54+
}
55+
56+
pub fn user(content: impl Into<String>) -> Self {
57+
Self::new("user", content)
58+
}
59+
60+
pub fn assistant(content: impl Into<String>) -> Self {
61+
Self::new("assistant", content)
62+
}
63+
64+
pub fn system(content: impl Into<String>) -> Self {
65+
Self::new("system", content)
66+
}
67+
}
68+
6669
/// Output from Harmony encoding process
6770
///
6871
/// Contains the encoded input_ids, stop tokens, selection text for worker routing,
@@ -110,7 +113,6 @@ pub(crate) struct HarmonyChannelOutput {
110113
///
111114
/// Represents incremental updates as tokens are parsed from the stream.
112115
#[derive(Debug, Clone)]
113-
#[allow(dead_code)]
114116
pub(crate) struct HarmonyChannelDelta {
115117
/// Delta for analysis/reasoning content
116118
pub analysis_delta: Option<String>,
@@ -122,6 +124,7 @@ pub(crate) struct HarmonyChannelDelta {
122124
pub final_delta: Option<String>,
123125

124126
/// Whether this is the final delta
127+
#[allow(dead_code)]
125128
pub is_final: bool,
126129
}
127130

sgl-model-gateway/src/routers/grpc/regular/responses/context.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use std::{collections::HashMap, sync::Arc};
88
use tokio::{sync::RwLock, task::JoinHandle};
99

1010
use crate::{
11-
core::WorkerRegistry,
1211
data_connector::{ConversationItemStorage, ConversationStorage, ResponseStorage},
1312
grpc_client::SglangSchedulerClient,
1413
mcp::McpManager,
@@ -36,13 +35,9 @@ pub(crate) struct ResponsesContext {
3635
/// Chat pipeline for executing requests
3736
pub pipeline: Arc<RequestPipeline>,
3837

39-
/// Shared components (tokenizer, parsers, worker_registry)
38+
/// Shared components (tokenizer, parsers)
4039
pub components: Arc<SharedComponents>,
4140

42-
/// Worker registry for validation
43-
#[allow(dead_code)]
44-
pub worker_registry: Arc<WorkerRegistry>,
45-
4641
/// Response storage backend
4742
pub response_storage: Arc<dyn ResponseStorage>,
4843

@@ -64,7 +59,6 @@ impl ResponsesContext {
6459
pub fn new(
6560
pipeline: Arc<RequestPipeline>,
6661
components: Arc<SharedComponents>,
67-
worker_registry: Arc<WorkerRegistry>,
6862
response_storage: Arc<dyn ResponseStorage>,
6963
conversation_storage: Arc<dyn ConversationStorage>,
7064
conversation_item_storage: Arc<dyn ConversationItemStorage>,
@@ -73,7 +67,6 @@ impl ResponsesContext {
7367
Self {
7468
pipeline,
7569
components,
76-
worker_registry,
7770
response_storage,
7871
conversation_storage,
7972
conversation_item_storage,

sgl-model-gateway/src/routers/grpc/router.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ impl GrpcRouter {
116116
responses::ResponsesContext::new(
117117
Arc::new(pipeline.clone()),
118118
shared_components.clone(),
119-
worker_registry.clone(),
120119
ctx.response_storage.clone(),
121120
ctx.conversation_storage.clone(),
122121
ctx.conversation_item_storage.clone(),

0 commit comments

Comments
 (0)