Skip to content

feat(cpp): add functions related to user management, and initial high-level client - #3733

Open
slbotbm wants to merge 12 commits into
apache:masterfrom
slbotbm:cpp-more-3-functions
Open

feat(cpp): add functions related to user management, and initial high-level client#3733
slbotbm wants to merge 12 commits into
apache:masterfrom
slbotbm:cpp-more-3-functions

Conversation

@slbotbm

@slbotbm slbotbm commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Closes #
Relates to #2100

Rationale

Works towards completion of cpp client.

What changed?

Adds the following:

  • create_user
  • get_user
  • get_users
  • update_user
  • delete_user
    and their tests.

Adds high level client that will function as primary API with documentation. The diff looks big since a lot of the public api was changed and aligned to PascalCase. I have not rewritten the tests using the high level client since I would like to do that at once instead of a gradual approach.

Local Execution

  • Passed
  • Pre-commit hooks ran

AI Usage

If AI tools were used, please answer:

  1. Which tools? codex
  2. Scope of usage? code generation
  3. How did you verify the generated code works correctly? read through it
  4. Can you explain every line of the code if asked? yes

@slbotbm
slbotbm marked this pull request as draft July 22, 2026 20:01
@github-actions github-actions Bot added S-waiting-on-review PR is waiting on a reviewer and removed S-waiting-on-review PR is waiting on a reviewer labels Jul 22, 2026
@slbotbm
slbotbm marked this pull request as ready for review August 1, 2026 15:21
@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Aug 1, 2026

@ethanlin01x ethanlin01x left a comment

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.

A few suggestions

Comment thread foreign/cpp/src/client.rs
Comment thread foreign/cpp/include/iggy.hpp Outdated
Comment thread foreign/cpp/include/iggy.hpp Outdated
@slbotbm
slbotbm requested a review from ethanlin01x August 3, 2026 20:12
Comment thread foreign/cpp/src/client.rs
Comment on lines 62 to 69
/// Creates a new client connection and returns a raw pointer to the underlying [`Client`].
///
/// # Ownership
///
/// The returned `*mut Client` is owned by the caller (the C++ side). The caller is responsible
/// for calling [`delete_connection`] exactly once to release the resources. Failing to do so
/// leaks the underlying tokio runtime resources and the open network connection.
///

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.

This and iggy.hpp:389-395 says destroying the client releases the connection. IggyClient::connect spawns a heartbeat holding its own Arc to the transport, exiting only on ClientShutdown, so the socket, the server session and the ping loop all survive. Same reason :488 ("no effect when already connected") is false and the :501-505 reuse cycle leaks a task per cycle. Worth filing upstream: store the JoinHandle discarded at clients/client.rs:250 and abort it in a Drop for IggyClient.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread foreign/cpp/include/iggy.hpp Outdated
Comment thread foreign/cpp/src/client.rs Outdated
slbotbm added a commit that referenced this pull request Aug 10, 2026
## Which issue does this PR address?

Relates to
#3733 (comment)

## Rationale

The heartbeat handle was being discarded and on shutdown, not being
stopped on calling `shutdown`.

## What changed?

Adds a heartbeat_handler that is saved when `connect()` is called. In
case connect is called repeatedly, the code uses the handler, and drops
it when the client is destroyed.

## Local Execution

- Passed 
- Pre-commit hooks ran


## AI Usage

If AI tools were used, please answer:
1. Which tools? codex
2. Scope of usage? code generation
3. How did you verify the generated code works correctly? tested it
4. Can you explain every line of the code if asked? yes

Co-authored-by: Piotr Gankiewicz <piotr.gankiewicz@gmail.com>
Co-authored-by: THE Patryk <phuzarski@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review PR is waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants