Skip to content

Commit 0a69bfd

Browse files
committed
fix: Adding app lookup by id trait
1 parent 806d89a commit 0a69bfd

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ members = ["crates/*"]
33
resolver = "2"
44

55
[workspace.package]
6-
version = "0.3.8"
6+
version = "0.3.9"
77
edition = "2021"
88
publish = false
99
authors = ["FastEdge Development Team"]

crates/http-service/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ where
234234
app_name,
235235
request.uri()
236236
);
237-
let cfg = match self.context.lookup(&app_name).await {
237+
let cfg = match self.context.lookup_by_name(&app_name).await {
238238
None => {
239239
#[cfg(feature = "metrics")]
240240
metrics::metrics(AppResult::UNKNOWN);
@@ -612,7 +612,7 @@ mod tests {
612612
}
613613

614614
impl Router for TestContext {
615-
async fn lookup(&self, _name: &str) -> Option<App> {
615+
async fn lookup_by_name(&self, _name: &str) -> Option<App> {
616616
self.app.clone()
617617
}
618618
}

crates/runtime/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ pub trait ExecutorCache {
314314
}
315315

316316
pub trait Router: Send + Sync {
317-
fn lookup(&self, name: &str) -> impl std::future::Future<Output = Option<App>> + Send;
317+
fn lookup_by_name(&self, name: &str) -> impl std::future::Future<Output = Option<App>> + Send;
318+
fn lookup_by_id(&self, id: u64) -> impl std::future::Future<Output = Option<App>> + Send;
318319
}
319320

320321
pub fn componentize_if_necessary(buffer: &[u8]) -> anyhow::Result<Cow<[u8]>> {

src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,13 @@ impl ContextHeaders for CliContext<'_> {
246246
}
247247

248248
impl Router for CliContext<'_> {
249-
async fn lookup(&self, _name: &str) -> Option<App> {
249+
async fn lookup_by_name(&self, _name: &str) -> Option<App> {
250250
self.app.to_owned()
251251
}
252+
253+
async fn lookup_by_id(&self, _id: u64) -> Option<App> {
254+
unreachable!()
255+
}
252256
}
253257

254258
impl StatsWriter for CliContext<'_> {

0 commit comments

Comments
 (0)