MEMO-014: Pattern SDK Shared Complexity Analysis
Summary
Analysis of RFC-021 reveals significant shared complexity across the three POC 1 plugins (MemStore, Redis, Kafka) that should be extracted into the Pattern SDK. This memo identifies 12 areas of duplication and proposes SDK enhancements to reduce plugin implementation burden by ~40%.
Key Finding: Each plugin currently re-implements connection management, TTL handling, health checks, and concurrency patterns. Moving these to the SDK would reduce plugin code by an estimated 300-500 lines per plugin.
Context
RFC-021 defines three minimal plugins for POC 1:
- MemStore: In-memory storage with TTL support
- Redis: External backend with connection pooling
- Kafka: Streaming with async buffering
Current Pattern SDK provides:
auth/- Authentication stubobservability/- Structured logginglifecycle/- Startup/shutdown hooksserver/- gRPC server setupstorage/- Basic retry logic
Analysis
Plugin Implementation Breakdown
| Feature | MemStore | Redis | Kafka | SDK Support |
|---|---|---|---|---|
| TTL Management | ✅ sync.Map + timers | ✅ Redis EXPIRE | ❌ N/A | ❌ None |
| Connection Pooling |