Skip to content

Commit fd72f7a

Browse files
committed
refactor: Remove retry config from fn registry
1 parent eb1b06b commit fd72f7a

7 files changed

Lines changed: 39 additions & 76 deletions

File tree

crates/concepts/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,13 +2159,13 @@ pub trait FunctionRegistry: Send + Sync {
21592159
fn get_by_exported_function(
21602160
&self,
21612161
ffqn: &FunctionFqn,
2162-
) -> Option<(FunctionMetadata, ComponentId, ComponentRetryConfig)>;
2162+
) -> Option<(FunctionMetadata, ComponentId)>;
21632163

21642164
// TODO: return Option<&TypeWrapperTopLevel>, optimize
21652165
/// Get return type of a non-ext function, otherwise return `None`.
21662166
fn get_ret_type(&self, ffqn: &FunctionFqn) -> Option<TypeWrapperTopLevel> {
21672167
self.get_by_exported_function(ffqn)
2168-
.and_then(|(fn_meta, _, _)| {
2168+
.and_then(|(fn_meta, _)| {
21692169
if let ReturnType::Extendable(ReturnTypeExtendable {
21702170
type_wrapper_tl: type_wrapper,
21712171
wit_type: _,

crates/wasm-workers/src/testing_fn_registry.rs

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1+
use crate::RunnableComponent;
12
use concepts::{
2-
ComponentId, ComponentRetryConfig, FnName, FunctionFqn, FunctionMetadata, FunctionRegistry,
3-
IfcFqnName, PackageIfcFns, ParameterTypes, RETURN_TYPE_DUMMY,
3+
ComponentId, FnName, FunctionFqn, FunctionMetadata, FunctionRegistry, IfcFqnName,
4+
PackageIfcFns, ParameterTypes, RETURN_TYPE_DUMMY,
45
};
56
use indexmap::IndexMap;
6-
use std::{sync::Arc, time::Duration};
7-
8-
use crate::RunnableComponent;
7+
use std::sync::Arc;
98

109
pub struct TestingFnRegistry {
11-
ffqn_to_fn_details:
12-
hashbrown::HashMap<FunctionFqn, (FunctionMetadata, ComponentId, ComponentRetryConfig)>,
10+
ffqn_to_fn_details: hashbrown::HashMap<FunctionFqn, (FunctionMetadata, ComponentId)>,
1311
export_hierarchy: Vec<PackageIfcFns>,
1412
}
1513

@@ -28,14 +26,7 @@ impl TestingFnRegistry {
2826
let ffqn = exported_function.ffqn.clone();
2927
ffqn_to_fn_details.insert(
3028
ffqn.clone(),
31-
(
32-
exported_function.clone(),
33-
component_id.clone(),
34-
ComponentRetryConfig {
35-
max_retries: 0,
36-
retry_exp_backoff: Duration::ZERO,
37-
},
38-
),
29+
(exported_function.clone(), component_id.clone()),
3930
);
4031

4132
let index_map = export_hierarchy.entry(ffqn.ifc_fqn.clone()).or_default();
@@ -61,7 +52,7 @@ impl FunctionRegistry for TestingFnRegistry {
6152
fn get_by_exported_function(
6253
&self,
6354
ffqn: &FunctionFqn,
64-
) -> Option<(FunctionMetadata, ComponentId, ComponentRetryConfig)> {
55+
) -> Option<(FunctionMetadata, ComponentId)> {
6556
self.ffqn_to_fn_details.get(ffqn).cloned()
6657
}
6758

@@ -84,14 +75,7 @@ pub fn fn_registry_dummy(ffqns: &[FunctionFqn]) -> Arc<dyn FunctionRegistry> {
8475
extension: None,
8576
submittable: true,
8677
};
87-
ffqn_to_fn_details.insert(
88-
ffqn.clone(),
89-
(
90-
fn_metadata.clone(),
91-
component_id.clone(),
92-
ComponentRetryConfig::ZERO,
93-
),
94-
);
78+
ffqn_to_fn_details.insert(ffqn.clone(), (fn_metadata.clone(), component_id.clone()));
9579
let index_map = export_hierarchy.entry(ffqn.ifc_fqn.clone()).or_default();
9680
index_map.insert(ffqn.function_name.clone(), fn_metadata);
9781
}

crates/wasm-workers/src/webhook/webhook_trigger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ impl<C: ClockFn> WebhookEndpointCtx<C> {
533533
let child_execution_id =
534534
ExecutionId::TopLevel(self.execution_id).next_level(&join_set_id_direct);
535535
let created_at = self.clock_fn.now();
536-
let (fn_metadata, _component_id, _import_retry_config) = self
536+
let (fn_metadata, _component_id) = self
537537
.fn_registry
538538
.get_by_exported_function(&ffqn)
539539
.expect("import was mocked using fn_registry exports limited to -schedule and no-ext functions");

crates/wasm-workers/src/workflow/workflow_ctx.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ impl<'a> ImportedFnCall<'a> {
687687
Arc::from(target_ifc_fqn.to_string()),
688688
Arc::from(function_name),
689689
);
690-
let (target_fn_metadata, _target_component_id, _target_retry_config) = fn_registry
690+
let (target_fn_metadata, _target_component_id) = fn_registry
691691
.get_by_exported_function(&target_ffqn)
692692
.expect("function obtained from `fn_registry.all_exports()` must be found");
693693
assert_eq!(None, target_fn_metadata.extension);
@@ -731,7 +731,7 @@ impl<'a> ImportedFnCall<'a> {
731731
Arc::from(target_ifc_fqn.to_string()),
732732
Arc::from(function_name),
733733
);
734-
let (target_fn_metadata, _fn_component_id, _fn_retry_config) = fn_registry
734+
let (target_fn_metadata, _fn_component_id) = fn_registry
735735
.get_by_exported_function(&target_ffqn)
736736
.expect("function obtained from `fn_registry.all_exports()` must be found");
737737
assert_eq!(None, target_fn_metadata.extension);
@@ -757,7 +757,7 @@ impl<'a> ImportedFnCall<'a> {
757757
Arc::from(target_ifc_fqn.to_string()),
758758
Arc::from(function_name),
759759
);
760-
let (target_fn_metadata, _target_component_id, _target_retry_config) = fn_registry
760+
let (target_fn_metadata, _target_component_id) = fn_registry
761761
.get_by_exported_function(&target_ffqn)
762762
.expect("function obtained from `fn_registry.all_exports()` must be found");
763763
assert_eq!(None, target_fn_metadata.extension);
@@ -783,7 +783,7 @@ impl<'a> ImportedFnCall<'a> {
783783
Arc::from(target_ifc_fqn.to_string()),
784784
Arc::from(function_name),
785785
);
786-
let (target_fn_metadata, _target_component_id, _target_retry_config) = fn_registry
786+
let (target_fn_metadata, _target_component_id) = fn_registry
787787
.get_by_exported_function(&target_ffqn)
788788
.expect("function obtained from `fn_registry.all_exports()` must be found");
789789
assert_eq!(None, target_fn_metadata.extension);
@@ -801,7 +801,7 @@ impl<'a> ImportedFnCall<'a> {
801801
);
802802
}
803803
} else {
804-
let (fn_metadata, _fn_component_id, _fn_retry_config) = fn_registry
804+
let (fn_metadata, _fn_component_id) = fn_registry
805805
.get_by_exported_function(&called_ffqn)
806806
.expect("function obtained from `fn_registry.all_exports()` must be found");
807807
assert_eq!(None, fn_metadata.extension);
@@ -1730,7 +1730,7 @@ pub(crate) mod tests {
17301730
.await
17311731
.map(|_| ()),
17321732
WorkflowStep::Call { ffqn } => {
1733-
let (_fn_metadata, _fn_component_id, _fn_retry_config) =
1733+
let (_fn_metadata, _fn_component_id) =
17341734
self.fn_registry.get_by_exported_function(ffqn).expect(
17351735
"function obtained from `fn_registry.all_exports()` must be found",
17361736
);
@@ -1780,7 +1780,7 @@ pub(crate) mod tests {
17801780
target_ffqn.function_name, SUFFIX_FN_SUBMIT
17811781
)),
17821782
};
1783-
let (_fn_metadata, _target_component_id, _target_retry_config) = self
1783+
let (_fn_metadata, _target_component_id) = self
17841784
.fn_registry
17851785
.get_by_exported_function(target_ffqn)
17861786
.expect(

src/command/server.rs

Lines changed: 21 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use anyhow::bail;
3333
use chrono::DateTime;
3434
use chrono::Utc;
3535
use concepts::ComponentId;
36-
use concepts::ComponentRetryConfig;
3736
use concepts::ComponentType;
3837
use concepts::ContentDigest;
3938
use concepts::ExecutionId;
@@ -285,7 +284,7 @@ impl grpc_gen::execution_repository_server::ExecutionRepository for GrpcServer {
285284
};
286285

287286
// Check that ffqn exists
288-
let Some((component_id, _retry_config, fn_metadata)) = self
287+
let Some((component_id, fn_metadata)) = self
289288
.component_registry_ro
290289
.find_by_exported_ffqn_submittable(&concepts::FunctionFqn::new_arc(
291290
Arc::from(interface_name),
@@ -350,11 +349,10 @@ impl grpc_gen::execution_repository_server::ExecutionRepository for GrpcServer {
350349
.to_string(),
351350
),
352351
};
353-
let fn_metadata = self
352+
let (_component_id, fn_metadata) = self
354353
.component_registry_ro
355354
.find_by_exported_ffqn_submittable(&ffqn)
356-
.expect("-schedule must have the original counterpart in the component registry")
357-
.2;
355+
.expect("-schedule must have the original counterpart in the component registry");
358356

359357
(
360358
schedule_at
@@ -1961,7 +1959,6 @@ async fn compile_and_verify(
19611959
let component_config_importable = ComponentConfigImportable {
19621960
exports_ext,
19631961
exports_hierarchy_ext,
1964-
retry_config: activity_stub_ext.retry_config,
19651962
};
19661963
let component_config = ComponentConfig {
19671964
component_id: activity_stub_ext.component_id,
@@ -2150,7 +2147,6 @@ fn prespawn_activity(
21502147
worker,
21512148
activity.content_digest,
21522149
activity.exec_config,
2153-
activity.retry_config,
21542150
wit,
21552151
))
21562152
}
@@ -2185,7 +2181,6 @@ fn prespawn_workflow(
21852181
worker,
21862182
workflow.content_digest,
21872183
workflow.exec_config,
2188-
workflow.retry_config,
21892184
wit,
21902185
))
21912186
}
@@ -2200,7 +2195,6 @@ impl WorkerCompiled {
22002195
worker: ActivityWorker<Now, TokioSleep>,
22012196
content_digest: ContentDigest,
22022197
exec_config: ExecConfig,
2203-
retry_config: ComponentRetryConfig,
22042198
wit: Option<String>,
22052199
) -> (WorkerCompiled, ComponentConfig) {
22062200
let component = ComponentConfig {
@@ -2209,7 +2203,6 @@ impl WorkerCompiled {
22092203
workflow_or_activity_config: Some(ComponentConfigImportable {
22102204
exports_ext: worker.exported_functions_ext().to_vec(),
22112205
exports_hierarchy_ext: worker.exports_hierarchy_ext().to_vec(),
2212-
retry_config,
22132206
}),
22142207
imports: worker.imported_functions().to_vec(),
22152208
wit,
@@ -2227,7 +2220,6 @@ impl WorkerCompiled {
22272220
worker: WorkflowWorkerCompiled<Now>,
22282221
content_digest: ContentDigest,
22292222
exec_config: ExecConfig,
2230-
retry_config: ComponentRetryConfig,
22312223
wit: Option<String>,
22322224
) -> (WorkerCompiled, ComponentConfig) {
22332225
let component = ComponentConfig {
@@ -2236,7 +2228,6 @@ impl WorkerCompiled {
22362228
workflow_or_activity_config: Some(ComponentConfigImportable {
22372229
exports_ext: worker.exported_functions_ext().to_vec(),
22382230
exports_hierarchy_ext: worker.exports_hierarchy_ext().to_vec(),
2239-
retry_config,
22402231
}),
22412232
imports: worker.imported_functions().to_vec(),
22422233
wit,
@@ -2292,8 +2283,7 @@ pub struct ComponentConfigRegistry {
22922283

22932284
#[derive(Default, Debug)]
22942285
struct ComponentConfigRegistryInner {
2295-
exported_ffqns_ext:
2296-
hashbrown::HashMap<FunctionFqn, (ComponentId, FunctionMetadata, ComponentRetryConfig)>,
2286+
exported_ffqns_ext: hashbrown::HashMap<FunctionFqn, (ComponentId, FunctionMetadata)>,
22972287
export_hierarchy: Vec<PackageIfcFns>,
22982288
ids_to_components: hashbrown::HashMap<ComponentId, ComponentConfig>,
22992289
}
@@ -2314,8 +2304,7 @@ impl ComponentConfigRegistry {
23142304
.iter()
23152305
.map(|f| &f.ffqn)
23162306
{
2317-
if let Some((conflicting_id, _, _)) =
2318-
self.inner.exported_ffqns_ext.get(exported_ffqn)
2307+
if let Some((conflicting_id, _)) = self.inner.exported_ffqns_ext.get(exported_ffqn)
23192308
{
23202309
bail!(
23212310
"function {exported_ffqn} is already exported by component {conflicting_id}, cannot insert {}",
@@ -2327,11 +2316,7 @@ impl ComponentConfigRegistry {
23272316
for exported_fn_metadata in &workflow_or_activity_config.exports_ext {
23282317
let old = self.inner.exported_ffqns_ext.insert(
23292318
exported_fn_metadata.ffqn.clone(),
2330-
(
2331-
component.component_id.clone(),
2332-
exported_fn_metadata.clone(),
2333-
workflow_or_activity_config.retry_config,
2334-
),
2319+
(component.component_id.clone(), exported_fn_metadata.clone()),
23352320
);
23362321
assert!(old.is_none());
23372322
}
@@ -2423,7 +2408,7 @@ impl ComponentConfigRegistry {
24232408
errors: &mut Vec<String>,
24242409
) {
24252410
for imported_fn_metadata in imports {
2426-
if let Some((exported_component_id, exported_fn_metadata, _)) = self
2411+
if let Some((exported_component_id, exported_fn_metadata)) = self
24272412
.inner
24282413
.exported_ffqns_ext
24292414
.get(&imported_fn_metadata.ffqn)
@@ -2484,31 +2469,33 @@ impl ComponentConfigRegistryRO {
24842469
pub fn find_by_exported_ffqn_submittable(
24852470
&self,
24862471
ffqn: &FunctionFqn,
2487-
) -> Option<(&ComponentId, ComponentRetryConfig, &FunctionMetadata)> {
2488-
self.inner.exported_ffqns_ext.get(ffqn).and_then(
2489-
|(component_id, fn_metadata, retry_config)| {
2472+
) -> Option<(&ComponentId, &FunctionMetadata)> {
2473+
self.inner
2474+
.exported_ffqns_ext
2475+
.get(ffqn)
2476+
.and_then(|(component_id, fn_metadata)| {
24902477
if fn_metadata.submittable {
2491-
Some((component_id, *retry_config, fn_metadata))
2478+
Some((component_id, fn_metadata))
24922479
} else {
24932480
None
24942481
}
2495-
},
2496-
)
2482+
})
24972483
}
24982484

24992485
pub fn find_by_exported_ffqn_stub(
25002486
&self,
25012487
ffqn: &FunctionFqn,
25022488
) -> Option<(&ComponentId, &FunctionMetadata)> {
2503-
self.inner.exported_ffqns_ext.get(ffqn).and_then(
2504-
|(component_id, fn_metadata, _retry_config)| {
2489+
self.inner
2490+
.exported_ffqns_ext
2491+
.get(ffqn)
2492+
.and_then(|(component_id, fn_metadata)| {
25052493
if component_id.component_type == ComponentType::ActivityStub {
25062494
Some((component_id, fn_metadata))
25072495
} else {
25082496
None
25092497
}
2510-
},
2511-
)
2498+
})
25122499
}
25132500

25142501
pub fn list(&self, extensions: bool) -> Vec<ComponentConfig> {
@@ -2534,14 +2521,14 @@ impl FunctionRegistry for ComponentConfigRegistryRO {
25342521
fn get_by_exported_function(
25352522
&self,
25362523
ffqn: &FunctionFqn,
2537-
) -> Option<(FunctionMetadata, ComponentId, ComponentRetryConfig)> {
2524+
) -> Option<(FunctionMetadata, ComponentId)> {
25382525
if ffqn.ifc_fqn.is_extension() {
25392526
None
25402527
} else {
25412528
self.inner
25422529
.exported_ffqns_ext
25432530
.get(ffqn)
2544-
.map(|(id, metadata, retry)| (metadata.clone(), id.clone(), *retry))
2531+
.map(|(id, metadata)| (metadata.clone(), id.clone()))
25452532
}
25462533
}
25472534

src/config.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ pub(crate) mod toml;
55
use crate::oci;
66
use anyhow::Context;
77
use concepts::ComponentId;
8-
use concepts::ComponentRetryConfig;
98
use concepts::ContentDigest;
109
use concepts::FunctionMetadata;
1110
use concepts::PackageIfcFns;
@@ -33,7 +32,6 @@ pub(crate) struct ComponentConfig {
3332
pub(crate) struct ComponentConfigImportable {
3433
pub(crate) exports_ext: Vec<FunctionMetadata>,
3534
pub(crate) exports_hierarchy_ext: Vec<PackageIfcFns>,
36-
pub(crate) retry_config: ComponentRetryConfig,
3735
}
3836

3937
#[derive(Debug, Clone, Hash)]

0 commit comments

Comments
 (0)