Files
sq/todos/SQ-010-publish-endpoint.md
2026-02-26 21:52:50 +01:00

1.1 KiB

SQ-010: Publish Endpoint (Single Node)

Status: [ ] TODO Blocked by: SQ-007, SQ-009 Priority: High

Description

Implement the Publish gRPC RPC. Clients send messages which are durably written to the local WAL via StorageEngine.

Files to Create/Modify

  • crates/sq-server/src/grpc/data_plane.rs - DataPlaneService Publish impl
  • crates/sq-server/src/state.rs - add StorageEngine to State

Behavior

  1. Receive PublishRequest with batch of messages
  2. For each message: call StorageEngine::append
  3. Ack mode handling:
    • ACK_MODE_ALL: return after fsync (default single-node behavior)
    • ACK_MODE_LOCAL: same as ALL for single node
    • ACK_MODE_NONE: return immediately, write async
  4. Return PublishResponse with offset assignments

Acceptance Criteria

  • Publish 1 message, verify WAL file exists and contains the message
  • Publish batch of 100 messages, verify all acked with sequential offsets
  • ACK_MODE_NONE: response is immediate (no waiting for fsync)
  • Invalid request (empty topic): returns InvalidArgument gRPC status
  • Auto-create topic on first publish (if topic doesn't exist)