Skip to content

api: async Get/Put surface (std::future or coroutine-ready awaitables) #217

Description

@harshavardhana

Problem

The entire public API is blocking. Every `Client` and `BaseClient` method returns a value type synchronously. Modern S3 workloads need to overlap I/O with compute (Asio, tokio-style runtimes, JavaScript runtimes via bindings, or simply running many transfers from a single thread).

Current state

`include/miniocpp/client.h` exposes ~40 sync methods. No `std::future`, no callbacks, no coroutines anywhere in the codebase. Users who want concurrency are forced to either dedicate a thread per outstanding call or roll their own `std::async` wrapper around the SDK.

Suggested approach

Phase 1 (additive, non-breaking): Add `*Async` overloads returning `std::future`:
```cpp
std::future GetObjectAsync(GetObjectArgs args);
std::future PutObjectAsync(PutObjectArgs args);
// ... high-volume ops first
```
Implementation can sit on `std::async` initially. With PR #215's CURLSH the underlying transport is already safe for parallel use.

Phase 2 (C++20 opt-in): Add awaitable variants for coroutine-based composition. Requires #221 (C++20 opt-in CMake flag).

Impact

Large for ecosystem adoption — currently blocks integration with any async runtime without a thread-per-call shim.

Roadmap

Tier 2 item from the C++ modernization audit. Pairs naturally with #216 (parallel multipart) and #218 (list pagination prefetch).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions