4.5 KiB
4.5 KiB
S-MESSAGING-01..04 — Messaging Subsystem (Delivery Model, Ephemeral Queue, Durable Storage Queue, Outbox/Inbox, RPC Adapter)
Scope
Implement the P1–P3 native Void::Messaging subsystem, Void::MessagingStorage durable adapter + outbox/inbox helper, and Void::MessagingRpc remote adapter per docs/roadmap/subsystems/Messaging.md and docs/roadmap/DEPENDENCIES.md:
S-MESSAGING-01..02— Delivery Model, Receipts, State Machine, and Bounded Ephemeral Queue:- Module
src/Messaging/module.cmake(INTERNAL_DEPS Core Functional Binary Time Async) with zeroStorage,Net, orRPCdependency. - Error domain
kMessagingErrorDomain = 32(MessagingErrorCode). - Explicit
PublishDurability::{Memory, Durable}:InMemoryQueuestrictly rejectsPublishDurability::Durable(UnsupportedDurability) andPublishReceiptrecords exact durability so nondurable channels never claim durable success. - Native state machine
Pending -> InFlight(generation, visibility_deadline) -> Acked | Pending | DeadLetter. - FIFO per-queue competing consumers and
ConsumerMode::SingleActive(blocking group head on retry until ack). - Visibility timeout (default 30s, explicit extension up to 5m via injected
MonotonicClock), stale-receipt fencing (StaleReceipt), idempotent repeat ack, retry bound (default 5 attempts, full jitter 1s..60s via injectable RNG), corrupt-payload quarantine, and bounded caps (768 KiB message, 8 KiB / 32 headers, 1024 queues, 32 groups/queue, 64 in-flight/group, 1024 waiting receives, 64 MiB transient payload budget). - Clean
close_and_join()stopping admission, waking/cancelling waiting receives, and draining active deliveries.
- Module
S-MESSAGING-03— Durable Storage Queue (MessagingStorage):- Module
src/MessagingStorage/module.cmake(INTERNAL_DEPS Messaging Storage). StorageQueuepersists payload, sequence, group state, delivery generation/attempt, DLQ records, and bounded 24h / 100k publish idempotency ledger viaVoid::Storage::Engineconditional batches (Durability::Sync).- At idempotency capacity, rejects new publish (
IdempotencyCapacityExceeded) instead of silently evicting live contracts. - On restart/reopen, promotes all prior
InFlightrecords toPendingwith bumped generation so stale worker receipts fail withStaleReceipt, preserving attempt counters across restarts. - Atomic DLQ move (DLQ insert + source group removal in one
Storage::Batch); when DLQ or persistent quota is full, keeps the message durable, drops zero data, blocks affected admission, and exposesstuck_dlq_count(). - Explicit
RetentionPolicy::BlockAtQuotadefault (unread work never silently expired) vs opt-inDropOldestLossy, pausing expiry when civil clock health fails;UnknownOutcomesurfaced on uncertain storage commit.
- Module
S-MESSAGING-04— Outbox/Inbox Local-Batch Helper and Remote RPC Adapter (MessagingRpc):OutboxInboxhelper inMessagingStorageenabling single-batch local business mutation + outbox insert and single-batch local effect + inbox dedup insert, with explicit documentation that external effects remain outside the local batch boundary.- Separate module
src/MessagingRpc/module.cmake(INTERNAL_DEPS Messaging RPC) exposingRpcQueueServerandRpcQueueClientfor remotepublish,receive,ack,nack, andquery_receiptover Wire v1 unary RPC.
File Ownership
include/Void/Messaging/{Types,Queue}.hppsrc/Messaging/{module.cmake,Queue.cpp}include/Void/MessagingStorage/{StorageQueue,OutboxInbox}.hppsrc/MessagingStorage/{module.cmake,StorageQueue.cpp}include/Void/MessagingRpc/RpcAdapter.hppsrc/MessagingRpc/{module.cmake,RpcAdapter.cpp}tests/standalone/Messaging/Messaging.cpptests/standalone/MessagingStorage/StorageQueue.cpptests/standalone/MessagingRpc/RpcAdapter.cpptests/package/MessagingOnly/{CMakeLists.txt,main.cpp}tests/package/InstalledComponents.cmake
Acceptance & Verification
- Standalone
Messaging;MessagingStorage;MessagingRpc;Testing(-DVOID_WARNINGS_AS_ERRORS=ON) +MessagingOnlyconsumer with_no_external_deps. - Deterministic tests for ephemeral/durable separation, competing vs single-active ordering, visibility expiry & stale receipt fencing, idempotent ack/publish, restart recovery preserving attempts, poison -> atomic DLQ move, DLQ/quota/idempotency cap pressure, clock-health pause, outbox/inbox single-batch atomicity, and remote RPC round-trip.
- Full
RelWithDebInfo,DebugASan+UBSan, andDebugTSanwith 0 leaks, 0 UB, 0 races.