[Cosmos] Implement azure_data_cosmos_driver_native Crate#4452
Draft
kundadebdatta wants to merge 4 commits into
Draft
[Cosmos] Implement azure_data_cosmos_driver_native Crate#4452kundadebdatta wants to merge 4 commits into
azure_data_cosmos_driver_native Crate#4452kundadebdatta wants to merge 4 commits into
Conversation
Adds a new crate (cdylib/staticlib/rlib named azurecosmosdriver) that wraps azure_data_cosmos_driver with a C-ABI surface. Includes the design spec, FFI plumbing (CallContext, RuntimeContext, error model, byte-buffer marshalling), and stub handles for partition keys, operations, responses, and diagnostics. See sdk/cosmos/azure_data_cosmos_driver/docs/NATIVE_WRAPPER_SPEC.md for the full plan.
…hases 0-finalize, 4, 5-partial, 6-partial) - build.rs wires up cbindgen and emits include/azurecosmosdriver.h (50 cosmos_* C functions) - Full partition-key builder (string/number/bool/null/undefined + hierarchical, plus a single-string convenience) - DatabaseReference and ItemReference handles (local, no network) - ContainerReference handle via async driver.resolve_container - Item CRUD + DB/container read/delete operation factories - cosmos_operation_with_body / with_partition_key mutators (move-only operations) - cosmos_driver_execute -> cosmos_response with status/RU/activity_id/etag/continuation/body accessors and into_body - 8 rlib smoke tests covering the new surface
CI was failing on cargo fmt --check in tests/smoke.rs. Ran cargo fmt -p azure_data_cosmos_driver_native to fix line-length wrapping and brace placement issues introduced by the previous test rewrite. Also picks up small post-commit polish in references.rs, response.rs, and lib.rs from manual edits, plus IMPLEMENTATION_STATUS.md (phase status snapshot generated during the prior session). All 8 smoke tests still pass.
kundadebdatta
added a commit
that referenced
this pull request
May 26, 2026
Second-round PR Deep Reviewer findings on PR #4461 (post-1672bd8). Addresses 5 blocking and 5 recommended items; nits / one open question deferred. F1 Predicate forwarding + cosmos_error_is_service_error (#4442 alignment). §3.5.2: documented that cosmos_error_is_* predicates forward to CosmosStatus::is_*; added is_service_error. §6.4: split backtrace rate knob into separate captures/resolutions per #4442 surface. F2 query_items + query_plan factory shape. §4.6.1: query_items now takes cosmos_feed_range_t* (matches driver's Option<FeedRange>); added a separate cosmos_operation_query_plan for the SQL-string path. F3 Factory signature template. §4.6.1: every CosmosOperation factory converted to "cosmos_error_code_t fn(... cosmos_operation_t **out_op)" matching the §3.2 ABI shape; removes the bare-pointer divergence. F4 Removed cosmos_response_iter_headers visitor. §4.7: typed accessors only; documented unknown-header drop; §9 Q2 reframed as a forward-compat passthrough question. F5 Opacity sweep. §3.1 cosmos_call_context_t opaque + accessors (_create/_free/_runtime/_set_include_error_details/_include_error_ details). §3.3 cosmos_bytes_t opaque (_data/_len/_free); kept cosmos_bytes_view_t for by-value input. §3.4 ownership table updated. §4.7 cosmos_response_into_body now writes cosmos_bytes_t **out_body. §4.8 cosmos_diagnostics_to_json signature corrected to **out_json. F6 Landing-prereq callouts. §3.5 / §4.2: explicitly cite #4442 (errors) and #4452 (Tokio thread-name prefix) as prerequisites; #4452-only surface reworded as "landed in". F7 Phase 5 operation-options enumeration. Removed max_item_count from the OperationOptions list (it's on CosmosOperation::with_max_item_count per §4.6.2); grouped all 17 OperationOptions fields by category and documented optional v1 subset path. §4.2 prose updated accordingly. F8 Partition-key value variants. §4.5: renamed append_none -> append_undefined to match Cosmos JSON semantics; added append_infinity; corrected source line ref to :303. F9 Cache-advisory warning class. §3.5.1: created a 5001..=5999 warning band (non-SUCCESS, populates out_*); moved OPTIONS_IGNORED_ON_CACHE_HIT from 4001 -> 5001; reserved 4001. §4.4.1: cache-hit advisory now returns 5001 (not SUCCESS) and is no longer predicated on single-runtime mode; documented the runtime.rs:380-390 lost-race redundant-init path. §9 Q1 reworded. F10 §5.3 ancillary-tooling checklist expanded. Added P0 workspace `members` entry, deny.toml MPL-2.0, sibling azure_data_cosmos README/lib.rs/ARCHITECTURE.md cross-link restoration, cspell regression-diff note, and deleted-file disposition for azurecosmos.pc.in / cmake/DiscoverTests.cmake / next_generation_ sdks_design_principles.md; added "Lessons from #4090 / #4103" preamble. Also: §4.6.4 NEW (minimal cosmos_feed_range_t surface); §10 migration table updated to show the new out_op factory pattern. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced May 26, 2026
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.
azure_data_cosmos_driver_nativeCrate