[WIP]Feat/c sdk - #111
Draft
olavgg wants to merge 5 commits into
Draft
Conversation
Records the decision from the "should we have a C SDK" discussion: build it here as datahub_c_bindings/ beside the Python bindings, expose a small ingest-first C ABI (typed datapoints, JSON for everything else, pull-based listener), and do not start until a named consumer exists. Also lists the two core changes that must land first: gating process_response's stdout printing and not reading .env from the host process's working directory. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011A3JAv2ewVM7WmTXZurY1r Signed-off-by: olav <olav@intellistream.ai>
…static token on 401 Groundwork for the C bindings, all usable from Rust too: - Every request-path println!/eprintln! goes through debug_println!/ debug_eprintln!, gated by http::set_debug_output. It defaults on, so nothing changes for Rust and Python callers; a library loaded into someone else's process must be able to stay silent. - DataHubConfig::from_map is public: one configuration path for the process environment, an env file and programmatic values, without reading .env from the host's working directory. - TimeSeriesService::flush_buffer and EventsService::flush_buffer drain a spool without ingesting anything new, for a controlled shutdown or a host retrying on its own clock. - invalidate_token keeps a user-supplied TOKEN. It cannot be re-minted, and dropping it turned every later call into "OAuth2 Client not configured" instead of the server's own answer. - Three test assertions on TimeSeries::security_categories, a field the type no longer has, are removed; they kept the lib test target from compiling at all. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011A3JAv2ewVM7WmTXZurY1r Signed-off-by: olav <olav@intellistream.ai>
A thin FFI crate over the core, datahub_c_bindings/, built as a shared and a static library with a committed, cbindgen-generated header (include/intellistream_datahub.h). Nothing is reimplemented: a client owns a Tokio runtime and block_ons the async ApiService, so auth, buffering and the listener behave exactly as for Rust and Python. The surface is ingest-first. Datapoints cross as plain C structs; time series lookup, events, search and filter cross as JSON with the exact REST request and response bodies; datahub_request_json is the raw, authenticated escape hatch for any other endpoint; the subscription listener is pull-based with a timeout. Every export runs inside a catch_unwind guard, errors are a status enum plus a thread-local message, and every export is written out by hand because cbindgen does not expand macro_rules!. Tests: unit tests on the boundary, tests/offline.rs (no network: argument checks, config, the spool path against an unreachable server), tests/mock_api.rs (a small HTTP mock asserting what goes on the wire and the buffered-then-flushed path), tests/live.rs (skips without a BASE_URL), and tests/c/smoke.c compiled and run by run_c_tests.sh. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011A3JAv2ewVM7WmTXZurY1r Signed-off-by: olav <olav@intellistream.ai>
CI gains a c-sdk job running run_c_tests.sh --check-header, and the versions job compares the C crate's manifest with the other three. The release workflow rehearses on that manifest too and builds the library natively on Linux, macOS and Windows, keeping header and libraries as workflow artifacts; it does not gate the crate or wheel publication. README and AGENTS.md describe the crate, its conventions, and the core switches it relies on. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011A3JAv2ewVM7WmTXZurY1r Signed-off-by: olav <olav@intellistream.ai>
…e departs from it Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011A3JAv2ewVM7WmTXZurY1r Signed-off-by: olav <olav@intellistream.ai>
Contributor
|
i think we should be careful adding a new sdk language we already have 3 and are struggling to maintain them all with the current pace of development. |
olavgg
marked this pull request as draft
September 8, 2026 21:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.