Skip to content

Commit 0de27c0

Browse files
authored
Rename worker heartbeat duration to interval in C bridge, plumb plugin names (#1071)
* Rename heartbeat_duration to heartbeat_interval for c bridge * Plumb plugins through C bridge
1 parent 87afc29 commit 0de27c0

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

crates/sdk-core-c-bridge/include/temporal-sdk-core-c-bridge.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ typedef struct TemporalCoreTelemetryOptions {
446446

447447
typedef struct TemporalCoreRuntimeOptions {
448448
const struct TemporalCoreTelemetryOptions *telemetry;
449-
uint64_t worker_heartbeat_duration_millis;
449+
uint64_t worker_heartbeat_interval_millis;
450450
} TemporalCoreRuntimeOptions;
451451

452452
typedef struct TemporalCoreTestServerOptions {
@@ -785,6 +785,7 @@ typedef struct TemporalCoreWorkerOptions {
785785
struct TemporalCorePollerBehavior nexus_task_poller_behavior;
786786
bool nondeterminism_as_workflow_fail;
787787
struct TemporalCoreByteArrayRefArray nondeterminism_as_workflow_fail_for_types;
788+
struct TemporalCoreByteArrayRefArray plugins;
788789
} TemporalCoreWorkerOptions;
789790

790791
/**

crates/sdk-core-c-bridge/src/runtime.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use url::Url;
3131
#[repr(C)]
3232
pub struct RuntimeOptions {
3333
pub telemetry: *const TelemetryOptions,
34-
pub worker_heartbeat_duration_millis: u64,
34+
pub worker_heartbeat_interval_millis: u64,
3535
}
3636

3737
#[repr(C)]
@@ -240,11 +240,11 @@ impl Runtime {
240240
CoreTelemetryOptions::default()
241241
};
242242

243-
let heartbeat_interval = if options.worker_heartbeat_duration_millis == 0 {
243+
let heartbeat_interval = if options.worker_heartbeat_interval_millis == 0 {
244244
None
245245
} else {
246246
Some(Duration::from_millis(
247-
options.worker_heartbeat_duration_millis,
247+
options.worker_heartbeat_interval_millis,
248248
))
249249
};
250250

crates/sdk-core-c-bridge/src/tests/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl Context {
153153

154154
let RuntimeOrFail { runtime, fail } = temporal_core_runtime_new(&RuntimeOptions {
155155
telemetry: std::ptr::null(),
156-
worker_heartbeat_duration_millis: 0,
156+
worker_heartbeat_interval_millis: 0,
157157
});
158158

159159
if let Some(fail) = byte_array_to_string(runtime, fail) {

crates/sdk-core-c-bridge/src/worker.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ pub struct WorkerOptions {
5656
pub nexus_task_poller_behavior: PollerBehavior,
5757
pub nondeterminism_as_workflow_fail: bool,
5858
pub nondeterminism_as_workflow_fail_for_types: ByteArrayRefArray,
59+
pub plugins: ByteArrayRefArray,
5960
}
6061

6162
#[repr(C)]
@@ -1257,6 +1258,18 @@ impl TryFrom<&WorkerOptions> for temporalio_sdk_core::WorkerConfig {
12571258
})
12581259
.collect::<HashMap<String, HashSet<WorkflowErrorType>>>(),
12591260
)
1261+
.plugins(
1262+
opt.plugins
1263+
.to_str_vec()
1264+
.into_iter()
1265+
.map(
1266+
|name| temporalio_common::protos::temporal::api::worker::v1::PluginInfo {
1267+
name: name.to_owned(),
1268+
version: String::new(),
1269+
},
1270+
)
1271+
.collect::<Vec<_>>(),
1272+
)
12601273
.build()
12611274
.map_err(|err| anyhow::anyhow!(err))
12621275
}

0 commit comments

Comments
 (0)