Skip to content

Commit

Permalink
remove index field
Browse files Browse the repository at this point in the history
Signed-off-by: Yashash H L <[email protected]>
  • Loading branch information
yhl25 committed Jan 15, 2025
1 parent 4f9a478 commit 8728f09
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 137 deletions.
21 changes: 4 additions & 17 deletions rust/serving/src/app/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub(crate) struct Callback {

#[derive(Debug, Serialize, Deserialize, Clone)]
pub(crate) struct Response {
pub(crate) index: u16,
pub(crate) tags: Option<Vec<String>>,
}

Expand Down Expand Up @@ -118,10 +117,7 @@ mod tests {
vertex: "in".to_string(),
cb_time: 12345,
from_vertex: "in".to_string(),
responses: vec![Response {
index: 0,
tags: None,
}],
responses: vec![Response { tags: None }],
}];

let res = Request::builder()
Expand Down Expand Up @@ -157,30 +153,21 @@ mod tests {
vertex: "in".to_string(),
cb_time: 12345,
from_vertex: "in".to_string(),
responses: vec![Response {
index: 0,
tags: None,
}],
responses: vec![Response { tags: None }],
},
Callback {
id: "test_id".to_string(),
vertex: "cat".to_string(),
cb_time: 12345,
from_vertex: "in".to_string(),
responses: vec![Response {
index: 0,
tags: None,
}],
responses: vec![Response { tags: None }],
},
Callback {
id: "test_id".to_string(),
vertex: "out".to_string(),
cb_time: 12345,
from_vertex: "cat".to_string(),
responses: vec![Response {
index: 0,
tags: None,
}],
responses: vec![Response { tags: None }],
},
];

Expand Down
31 changes: 6 additions & 25 deletions rust/serving/src/app/callback/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,18 +270,14 @@ mod tests {
vertex: "in".to_string(),
cb_time: 12345,
from_vertex: "in".to_string(),
responses: vec![Response {
index: 0,
tags: None,
}],
responses: vec![Response { tags: None }],
},
Callback {
id: id.clone(),
vertex: "planner".to_string(),
cb_time: 12345,
from_vertex: "in".to_string(),
responses: vec![Response {
index: 0,
tags: Some(vec!["tiger".to_owned(), "asciiart".to_owned()]),
}],
},
Expand All @@ -290,40 +286,28 @@ mod tests {
vertex: "tiger".to_string(),
cb_time: 12345,
from_vertex: "planner".to_string(),
responses: vec![Response {
index: 0,
tags: None,
}],
responses: vec![Response { tags: None }],
},
Callback {
id: id.clone(),
vertex: "asciiart".to_string(),
cb_time: 12345,
from_vertex: "planner".to_string(),
responses: vec![Response {
index: 0,
tags: None,
}],
responses: vec![Response { tags: None }],
},
Callback {
id: id.clone(),
vertex: "serve-sink".to_string(),
cb_time: 12345,
from_vertex: "tiger".to_string(),
responses: vec![Response {
index: 0,
tags: None,
}],
responses: vec![Response { tags: None }],
},
Callback {
id: id.clone(),
vertex: "serve-sink".to_string(),
cb_time: 12345,
from_vertex: "asciiart".to_string(),
responses: vec![Response {
index: 0,
tags: None,
}],
responses: vec![Response { tags: None }],
},
];
state.insert_callback_requests(cbs).await.unwrap();
Expand Down Expand Up @@ -362,10 +346,7 @@ mod tests {
vertex: "in".to_string(),
cb_time: 12345,
from_vertex: "in".to_string(),
responses: vec![Response {
index: 0,
tags: None,
}],
responses: vec![Response { tags: None }],
}];

// Try to insert callback requests for an ID that hasn't been registered
Expand Down
10 changes: 2 additions & 8 deletions rust/serving/src/app/callback/store/memstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,7 @@ mod tests {
vertex: "in".to_string(),
cb_time: 12345,
from_vertex: "in".to_string(),
responses: vec![Response {
index: 0,
tags: None,
}],
responses: vec![Response { tags: None }],
});

// Save a callback
Expand Down Expand Up @@ -187,10 +184,7 @@ mod tests {
vertex: "in".to_string(),
cb_time: 12345,
from_vertex: "in".to_string(),
responses: vec![Response {
index: 0,
tags: None,
}],
responses: vec![Response { tags: None }],
});

// Try to save a callback with an invalid key
Expand Down
10 changes: 2 additions & 8 deletions rust/serving/src/app/callback/store/redisstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,7 @@ mod tests {
vertex: String::from("prev_vertex"),
cb_time: 1234,
from_vertex: String::from("next_vertex"),
responses: vec![Response {
index: 0,
tags: None,
}],
responses: vec![Response { tags: None }],
}),
};

Expand Down Expand Up @@ -298,10 +295,7 @@ mod tests {
vertex: String::from("vertex"),
cb_time: 1234,
from_vertex: String::from("next_vertex"),
responses: vec![Response {
index: 0,
tags: None,
}],
responses: vec![Response { tags: None }],
});

// Save with TTL of 1 second
Expand Down
15 changes: 3 additions & 12 deletions rust/serving/src/app/jetstream_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,30 +360,21 @@ mod tests {
vertex: "in".to_string(),
cb_time: 12345,
from_vertex: "in".to_string(),
responses: vec![callback::Response {
index: 0,
tags: None,
}],
responses: vec![callback::Response { tags: None }],
},
Callback {
id: id.to_string(),
vertex: "cat".to_string(),
cb_time: 12345,
from_vertex: "in".to_string(),
responses: vec![callback::Response {
index: 0,
tags: None,
}],
responses: vec![callback::Response { tags: None }],
},
Callback {
id: id.to_string(),
vertex: "out".to_string(),
cb_time: 12345,
from_vertex: "cat".to_string(),
responses: vec![callback::Response {
index: 0,
tags: None,
}],
responses: vec![callback::Response { tags: None }],
},
]
}
Expand Down
Loading

0 comments on commit 8728f09

Please sign in to comment.