Skip to content

Buffer (Batching) #5

@prosdev

Description

@prosdev

Phase: 4 - Processing Pipeline
Estimated Effort: 3 hours
Tasks: Task 8 from specs/core-pipeline/tasks.md

Checklist

Task 8: Implement Buffer (3 hours)

  • Create Buffer class
  • Implement per-partition buffers (dict[int, list[TypedEvent]])
  • Implement enqueue() with size-based flush (default: 100)
  • Implement _flush_partition() (batch write to EventStore)
  • Implement time-based flusher (async background task, default: 5s)
  • Implement start_flusher() / stop_flusher()
  • Implement graceful shutdown (flush all buffers)
  • Write unit tests (mocked EventStore)

Acceptance Criteria

  • Per-partition buffering (no cross-partition blocking)
  • Size-based flush works
  • Time-based flush works
  • Graceful shutdown flushes all buffers
  • Unit tests pass

Files to Create

src/eventkit/processing/buffer.py
tests/unit/processing/test_buffer.py

Dependencies: Issue #2 (EventStore)
User Stories: Story 5 (Efficient Batch Processing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions