Major refactoring to hexagonal (ports & adapters) architecture: - Add service layer (apikey_service, project_service) for business logic - Add webhook system with dispatcher and delivery tracking - Add command queue with priority-based processing - Add rate limiting with sliding window algorithm - Add audit logging for command execution - Add OpenTelemetry integration (traces, metrics, spans) - Add circuit breaker for fault tolerance - Add cached repository wrapper for performance - Add comprehensive validation package - Add Kubernetes client integration for pod management - Add database migrations (allowed_ips, audit_log, rate_limiting, queue, webhooks) - Add network policy and PodDisruptionBudget for k8s - Remove legacy executor and projects/registry packages - Untrack secrets.yaml (now managed via envault) - Add coverage.out to .gitignore - Add e2e test infrastructure with docker-compose - Add comprehensive documentation (API, architecture, operations, plans) - Add golangci-lint config and pre-commit hook Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
28 lines
1.0 KiB
Go
28 lines
1.0 KiB
Go
package port
|
|
|
|
// StreamEvent represents an event to be published on a stream.
|
|
type StreamEvent struct {
|
|
ID string // Event ID for Last-Event-ID support
|
|
Type string
|
|
Data map[string]any
|
|
}
|
|
|
|
// StreamPublisher defines operations for managing SSE event streams.
|
|
type StreamPublisher interface {
|
|
// Subscribe creates a subscription to events for the given stream ID.
|
|
// Returns a channel that will receive events and a cleanup function.
|
|
Subscribe(streamID string) (<-chan StreamEvent, func())
|
|
|
|
// SubscribeFromID creates a subscription starting from a specific event ID.
|
|
// This is used for reconnection with Last-Event-ID support.
|
|
// Events since lastEventID will be replayed before new events are delivered.
|
|
SubscribeFromID(streamID string, lastEventID string) (<-chan StreamEvent, func())
|
|
|
|
// Publish sends an event to all subscribers of a stream.
|
|
// Returns the generated event ID.
|
|
Publish(streamID string, event StreamEvent) string
|
|
|
|
// Close closes a stream and all its subscriptions.
|
|
Close(streamID string)
|
|
}
|