Skip to content

docs: add async database operations guide#360

Merged
kcenon merged 1 commit into
mainfrom
docs/issue-356-document-async-database-operations-api
Feb 8, 2026
Merged

docs: add async database operations guide#360
kcenon merged 1 commit into
mainfrom
docs/issue-356-document-async-database-operations-api

Conversation

@kcenon

@kcenon kcenon commented Feb 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add comprehensive docs/guides/ASYNC_OPERATIONS.md (~1000 lines) covering the async database operations module
  • Update docs/API_REFERENCE.md with expanded Async Operations section and cross-references

What's Documented

Async Execution Model

  • Architecture diagram showing execution layers
  • thread_system integration with compile-time adapter pattern
  • Performance comparison: thread_system (1.16M+ jobs/s) vs std::thread fallback (~50K jobs/s)
  • Type aliases from thread_pool_adapter.h

async_executor

  • Construction (thread count, context), task submission with SubmittableTask concept
  • Lifecycle management: shutdown(), wait_for_completion(), pending_tasks()
  • Performance characteristics table

async_result<T>

  • Blocking operations: get(), get_for(timeout)
  • Non-blocking operations: is_ready(), wait_for(timeout)
  • Callback support: then() / on_error() with C++20 concept constraints
  • Helper functions: make_ready_result(), make_error_result()

async_database

  • Query operations: execute_async(), select_async()
  • Batch operations: execute_batch_async(), select_batch_async()
  • Async transaction operations: begin/commit/rollback
  • Async connection management

C++20 Coroutine Support

  • database_awaitable<T> with promise_type, await_ready/suspend/resume
  • Coroutine methods: execute_coro(), select_coro()
  • Helpers: when_all(), when_any()

Stream Processing

  • stream_processor with 4 stream types (PostgreSQL NOTIFY, MongoDB Change Streams, Redis Pub/Sub, custom)
  • stream_event structure
  • Event handlers and filters with StreamEventHandler/StreamEventFilter concepts

Distributed Transactions

  • transaction_coordinator with transaction state machine
  • Two-Phase Commit protocol: prepare_phase(), commit_phase()
  • Saga pattern: saga_builder with forward actions and compensations

Cross-Cutting Concerns

  • Thread safety table for all classes
  • Error handling patterns: future-based, callback-based, timeout
  • Performance guide: async vs sync decision matrix, pool sizing, batching, backpressure

Examples

  • Basic async queries
  • Stream processing with filters
  • Distributed transaction with Saga
  • Coroutine-based workflow

Test Plan

  • Markdown renders correctly (headings, tables, code blocks, diagrams)
  • All cross-document links resolve (API_REFERENCE.md, ARCHITECTURE.md, UNIFIED_SYSTEM.md)
  • Code examples match actual source API signatures
  • Build succeeds with no regressions

Verification Results

Check Status Details
Markdown rendering PASS Zero issues. 32 code blocks with language specifiers, 47 TOC anchors correct
Cross-document links PASS 11/12 valid. Only kr translation missing (expected pattern across all docs)
Code examples vs source PASS ALL API signatures match perfectly across all 9 components
Build PASS 100% success, no regressions

Closes #356

Add comprehensive documentation for the async operations module
covering async_executor, async_result, async_database, coroutine
support, stream processing, distributed transactions (2PC + Saga),
and thread_system integration. Update API_REFERENCE.md with
expanded async operations section and cross-references.
@kcenon kcenon merged commit 0a973ef into main Feb 8, 2026
23 checks passed
@kcenon kcenon deleted the docs/issue-356-document-async-database-operations-api branch February 8, 2026 16:35
kcenon added a commit that referenced this pull request Apr 13, 2026
Add comprehensive documentation for the async operations module
covering async_executor, async_result, async_database, coroutine
support, stream processing, distributed transactions (2PC + Saga),
and thread_system integration. Update API_REFERENCE.md with
expanded async operations section and cross-references.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] docs: Document async database operations API

1 participant