This is an automated email from the ASF dual-hosted git repository.
hgruszecki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git
The following commit(s) were added to refs/heads/master by this push:
new 9ecbcc00d fix(connectors): don't use posix function names as FFI
interface (#2771)
9ecbcc00d is described below
commit 9ecbcc00d325b9e97a02b6098102115ce6af354b
Author: Kriti Kathuria <[email protected]>
AuthorDate: Thu Feb 19 01:22:50 2026 +0530
fix(connectors): don't use posix function names as FFI interface (#2771)
Closes #2770.
---
core/connectors/runtime/src/main.rs | 24 ++++++++++++------------
core/connectors/runtime/src/sink.rs | 4 ++--
core/connectors/runtime/src/source.rs | 4 ++--
core/connectors/sdk/src/sink.rs | 8 ++++----
core/connectors/sdk/src/source.rs | 8 ++++----
5 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/core/connectors/runtime/src/main.rs
b/core/connectors/runtime/src/main.rs
index f9b5b3a72..1d53e71cf 100644
--- a/core/connectors/runtime/src/main.rs
+++ b/core/connectors/runtime/src/main.rs
@@ -71,7 +71,7 @@ const DEFAULT_CONFIG_PATH: &str =
"core/connectors/runtime/config.toml";
#[derive(WrapperApi)]
struct SourceApi {
- open: extern "C" fn(
+ iggy_source_open: extern "C" fn(
id: u32,
config_ptr: *const u8,
config_len: usize,
@@ -79,21 +79,21 @@ struct SourceApi {
state_len: usize,
log_callback: iggy_connector_sdk::LogCallback,
) -> i32,
- handle: extern "C" fn(id: u32, callback: SendCallback) -> i32,
- close: extern "C" fn(id: u32) -> i32,
- version: extern "C" fn() -> *const std::ffi::c_char,
+ iggy_source_handle: extern "C" fn(id: u32, callback: SendCallback) -> i32,
+ iggy_source_close: extern "C" fn(id: u32) -> i32,
+ iggy_source_version: extern "C" fn() -> *const std::ffi::c_char,
}
#[derive(WrapperApi)]
struct SinkApi {
- open: extern "C" fn(
+ iggy_sink_open: extern "C" fn(
id: u32,
config_ptr: *const u8,
config_len: usize,
log_callback: iggy_connector_sdk::LogCallback,
) -> i32,
#[allow(clippy::too_many_arguments)]
- consume: extern "C" fn(
+ iggy_sink_consume: extern "C" fn(
id: u32,
topic_meta_ptr: *const u8,
topic_meta_len: usize,
@@ -102,8 +102,8 @@ struct SinkApi {
messages_ptr: *const u8,
messages_len: usize,
) -> i32,
- close: extern "C" fn(id: u32) -> i32,
- version: extern "C" fn() -> *const std::ffi::c_char,
+ iggy_sink_close: extern "C" fn(id: u32) -> i32,
+ iggy_sink_version: extern "C" fn() -> *const std::ffi::c_char,
}
fn print_ascii_art(text: &str) {
@@ -175,7 +175,7 @@ async fn main() -> Result<(), RuntimeError> {
.map(|plugin| plugin.id)
.collect();
sink_wrappers.push(SinkConnectorWrapper {
- callback: sink.container.consume,
+ callback: sink.container.iggy_sink_consume,
plugins: sink.plugins,
});
sink_with_plugins.insert(
@@ -197,7 +197,7 @@ async fn main() -> Result<(), RuntimeError> {
.map(|plugin| plugin.id)
.collect();
source_wrappers.push(SourceConnectorWrapper {
- callback: source.container.handle,
+ callback: source.container.iggy_source_handle,
plugins: source.plugins,
});
source_with_plugins.insert(
@@ -246,7 +246,7 @@ async fn main() -> Result<(), RuntimeError> {
for (key, source) in source_with_plugins {
for id in source.plugin_ids {
info!("Closing source connector with ID: {id} for plugin: {key}");
- source.container.close(id);
+ source.container.iggy_source_close(id);
source::cleanup_sender(id);
info!("Closed source connector with ID: {id} for plugin: {key}");
}
@@ -261,7 +261,7 @@ async fn main() -> Result<(), RuntimeError> {
for (key, sink) in sink_with_plugins {
for id in sink.plugin_ids {
info!("Closing sink connector with ID: {id} for plugin: {key}");
- sink.container.close(id);
+ sink.container.iggy_sink_close(id);
info!("Closed sink connector with ID: {id} for plugin: {key}");
}
}
diff --git a/core/connectors/runtime/src/sink.rs
b/core/connectors/runtime/src/sink.rs
index fb53cdb50..1e82703fa 100644
--- a/core/connectors/runtime/src/sink.rs
+++ b/core/connectors/runtime/src/sink.rs
@@ -349,7 +349,7 @@ async fn consume_messages(
fn get_plugin_version(container: &Container<SinkApi>) -> String {
unsafe {
- let version_ptr = (container.version)();
+ let version_ptr = (container.iggy_sink_version)();
std::ffi::CStr::from_ptr(version_ptr)
.to_string_lossy()
.into_owned()
@@ -362,7 +362,7 @@ fn init_sink(
id: u32,
) -> Result<(), RuntimeError> {
let plugin_config = serde_json::to_string(plugin_config).expect("Invalid
sink plugin config.");
- let result = (container.open)(
+ let result = (container.iggy_sink_open)(
id,
plugin_config.as_ptr(),
plugin_config.len(),
diff --git a/core/connectors/runtime/src/source.rs
b/core/connectors/runtime/src/source.rs
index c6db93683..8fe422510 100644
--- a/core/connectors/runtime/src/source.rs
+++ b/core/connectors/runtime/src/source.rs
@@ -211,7 +211,7 @@ pub async fn init(
fn get_plugin_version(container: &Container<SourceApi>) -> String {
unsafe {
- let version_ptr = (container.version)();
+ let version_ptr = (container.iggy_source_version)();
std::ffi::CStr::from_ptr(version_ptr)
.to_string_lossy()
.into_owned()
@@ -229,7 +229,7 @@ fn init_source(
serde_json::to_string(plugin_config).expect("Invalid source plugin
config.");
let state_ptr = state.as_ref().map_or(std::ptr::null(), |s| s.0.as_ptr());
let state_len = state.as_ref().map_or(0, |s| s.0.len());
- let result = (container.open)(
+ let result = (container.iggy_source_open)(
id,
plugin_config.as_ptr(),
plugin_config.len(),
diff --git a/core/connectors/sdk/src/sink.rs b/core/connectors/sdk/src/sink.rs
index c236b4bc4..ad037b6f5 100644
--- a/core/connectors/sdk/src/sink.rs
+++ b/core/connectors/sdk/src/sink.rs
@@ -231,7 +231,7 @@ macro_rules! sink_connector {
#[cfg(not(test))]
#[unsafe(no_mangle)]
- unsafe extern "C" fn open(
+ unsafe extern "C" fn iggy_sink_open(
id: u32,
config_ptr: *const u8,
config_len: usize,
@@ -245,7 +245,7 @@ macro_rules! sink_connector {
#[cfg(not(test))]
#[unsafe(no_mangle)]
- unsafe extern "C" fn consume(
+ unsafe extern "C" fn iggy_sink_consume(
id: u32,
topic_meta_ptr: *const u8,
topic_meta_len: usize,
@@ -272,7 +272,7 @@ macro_rules! sink_connector {
#[cfg(not(test))]
#[unsafe(no_mangle)]
- unsafe extern "C" fn close(id: u32) -> i32 {
+ unsafe extern "C" fn iggy_sink_close(id: u32) -> i32 {
let Some(mut instance) = INSTANCES.remove(&id) else {
tracing::error!("Sink connector with ID: {id} was not found
and cannot be closed.");
return -1;
@@ -282,7 +282,7 @@ macro_rules! sink_connector {
#[cfg(not(test))]
#[unsafe(no_mangle)]
- extern "C" fn version() -> *const std::ffi::c_char {
+ extern "C" fn iggy_sink_version() -> *const std::ffi::c_char {
static VERSION: &str = concat!(env!("CARGO_PKG_VERSION"), "\0");
VERSION.as_ptr() as *const std::ffi::c_char
}
diff --git a/core/connectors/sdk/src/source.rs
b/core/connectors/sdk/src/source.rs
index d02428df1..d5486f24f 100644
--- a/core/connectors/sdk/src/source.rs
+++ b/core/connectors/sdk/src/source.rs
@@ -218,7 +218,7 @@ macro_rules! source_connector {
#[cfg(not(test))]
#[unsafe(no_mangle)]
- unsafe extern "C" fn open(
+ unsafe extern "C" fn iggy_source_open(
id: u32,
config_ptr: *const u8,
config_len: usize,
@@ -242,7 +242,7 @@ macro_rules! source_connector {
#[cfg(not(test))]
#[unsafe(no_mangle)]
- unsafe extern "C" fn handle(id: u32, callback: SendCallback) -> i32 {
+ unsafe extern "C" fn iggy_source_handle(id: u32, callback:
SendCallback) -> i32 {
let Some(mut instance) = INSTANCES.get_mut(&id) else {
tracing::error!(
"Source connector with ID: {id} was not found and cannot
be handled."
@@ -254,7 +254,7 @@ macro_rules! source_connector {
#[cfg(not(test))]
#[unsafe(no_mangle)]
- unsafe extern "C" fn close(id: u32) -> i32 {
+ unsafe extern "C" fn iggy_source_close(id: u32) -> i32 {
let Some(mut instance) = INSTANCES.remove(&id) else {
tracing::error!(
"Source connector with ID: {id} was not found and cannot
be closed."
@@ -266,7 +266,7 @@ macro_rules! source_connector {
#[cfg(not(test))]
#[unsafe(no_mangle)]
- extern "C" fn version() -> *const std::ffi::c_char {
+ extern "C" fn iggy_source_version() -> *const std::ffi::c_char {
static VERSION: &str = concat!(env!("CARGO_PKG_VERSION"), "\0");
VERSION.as_ptr() as *const std::ffi::c_char
}