Skip to content

Introduces binary type value for celix_properties_t.#841

Open
xuzhenbao wants to merge 2 commits into
apache:masterfrom
xuzhenbao:properties_support_binary
Open

Introduces binary type value for celix_properties_t.#841
xuzhenbao wants to merge 2 commits into
apache:masterfrom
xuzhenbao:properties_support_binary

Conversation

@xuzhenbao
Copy link
Copy Markdown
Contributor

In order to enable event admin to transmit arbitrary messages via the "payload" property entry, this pull request introduces a binary type value for celix_properties_t. And the serialization of binary data is achieved through the base64 encoding.

@PengZheng PengZheng requested a review from pnoltes May 26, 2026 00:32
Copy link
Copy Markdown
Contributor

@PengZheng PengZheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current implementation adds too much cost, as the following describes:

arrayValue; /**< The array list of longs, doubles, bools, strings or versions value of the entry. */
struct {
const void* data; /**< The binary data of the entry. */
size_t size; /**< The size of the binary data. */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On 64bit platform, it will cost 8 bytes, and in almost all cases, the upper 4 bytes are all zeros. Too much a cost.

} else if (entry->valueType == CELIX_PROPERTIES_VALUE_TYPE_ARRAY_LIST) {
entry->value = celix_utils_arrayListToString(entry->typed.arrayValue);
} else if (entry->valueType == CELIX_PROPERTIES_VALUE_TYPE_BINARY) {
entry->value = celix_utils_binaryToBase64String(entry->typed.binaryValue.data, entry->typed.binaryValue.size);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For large binary data, twice the space will be too much a cost.

Comment thread conanfile.py
if self.options.build_utils:
self.requires("libzip/[>=1.7.3 <2.0.0]")
self.requires("libuv/[>=1.49.2 <2.0.0]")
self.requires("openssl/[>=3.2.0]")
Copy link
Copy Markdown
Contributor

@PengZheng PengZheng May 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introducing such a heavy dependency for a simple task like base64 is a no-go. What if downstream users want to use embedTLS to reduce footprint?

@PengZheng
Copy link
Copy Markdown
Contributor

PengZheng commented May 26, 2026

As for binary payload in event admin, users can use whatever library (or their own abstraction over embedTLS/OpenSSL) to do base64 encoding/decoding themselves without incurring the above costs.

Or event admin can extend celix_event_admin_service and celix_event_handler_service to handle binary data separately. That way we can have a more efficient solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants