seokjin0414 opened a new pull request, #3046:
URL: https://github.com/apache/iggy/pull/3046

   ## Summary
   
   Closes #2965 (Phase 1 of 2).
   
   - Add `get_streams`, `send_messages`, `poll_messages` FFI functions to the 
C++ SDK via cxx::bridge
   - Add 4 shared structs: `Stream`, `IggyMessageToSend`, `IggyMessagePolled`, 
`PolledMessages`
   - Add `From` conversions for `Stream`, `IggyMessage`, `PolledMessages`
   - Add 6 e2e tests covering round-trip messaging, ID verification, empty 
partition, and auth checks
   - Add `bytes` dependency for message payload construction
   - Extract shared test helpers (`to_payload`, `partition_id_bytes`) to 
`test_helpers.hpp`
   
   ## Design
   
   - **get_streams**: Returns `Vec<Stream>` (summary type, not 
`StreamDetails`). Enables BDD step "I have no streams in the system"
   - **send_messages**: Accepts `Vec<IggyMessageToSend>` with `id_lo`/`id_hi` 
(u128 split for cxx compatibility), `payload` as `Vec<u8>`. Supports 
`balanced`, `partition_id`, `messages_key` partitioning via string-encoded kind
   - **poll_messages**: Returns `PolledMessages` containing 
`Vec<IggyMessagePolled>` with offset, timestamp, payload, user_headers. 
Supports all polling strategies (`offset`, `timestamp`, `first`, `last`, 
`next`) and consumer kinds (`consumer`, `consumer_group`)
   - **u128 message ID**: Split into `id_lo: u64` + `id_hi: u64` due to cxx 
limitation. Reconstructed via `((id_hi as u128) << 64) | id_lo`
   - **partition_id sentinel**: `u32::MAX` = None (all partitions), any other 
value = `Some(id)`. Partition 0 is valid
   - **No existing FFI changes**: All additions are purely additive. Existing 
`create_stream`, `create_topic`, `get_stream` unchanged
   
   ## Context
   
   This is Phase 1 of issue #2965. Phase 2 (BDD test implementation with 
Gherkin framework) depends on this PR. BDD verification steps will use 
`get_stream()` to verify stream/topic creation (workaround for 
`create_stream`/`create_topic` returning `Result<()>`).
   
   Discussed with @slbotbm on Discord — PR split and message struct design 
confirmed.
   
   ## Test plan
   
   - [x] `cargo check` / `cargo clippy -- -D warnings` / `cargo fmt -- --check` 
— all clean
   - [x] 6 e2e tests in `tests/message/low_level_e2e.cpp` (requires Bazel + 
running iggy-server)
     - `GetStreamsReturnsEmptyAfterCleanup`
     - `GetStreamsReturnsStreamAfterCreation`
     - `SendAndPollMessagesRoundTrip` (10 messages, verify count/offset/payload)
     - `PollMessagesVerifyMessageIds` (custom ID=42, verify id_lo match)
     - `PollMessagesFromEmptyPartition` (verify count=0)
     - `SendMessagesBeforeLoginThrows` (verify auth check)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to