feat: stream-level metadata #237

Open
opened 2026-03-10 10:14:41 +00:00 by ash · 0 comments
Owner

Problem

Metadata can only be attached to individual events. There is no way to attach metadata to a stream itself.

Use Cases

  • Stream owner/tenant — who owns this stream (useful for multi-tenancy queries)
  • Schema version — which event schema version this stream uses
  • TTL hints — when should this stream be archived/compacted
  • Creation timestamp — when was the first event written
  • Custom tags — business-specific categorization

Solution

type StreamMetadata struct {
    StreamID    string
    StreamType  string
    CreatedAt   time.Time
    UpdatedAt   time.Time
    Tags        map[string]string
    MaxAge      *time.Duration  // optional TTL hint
    MaxCount    *int64          // optional max events hint
}

type StreamMetadataStore interface {
    GetStreamMetadata(ctx context.Context, streamType, streamID string) (StreamMetadata, error)
    SetStreamMetadata(ctx context.Context, meta StreamMetadata) error
}

Implement for pgstore and sqlitestore. Separate table, not mixed with events.

Pillar: Developer Experience, Production Readiness

## Problem Metadata can only be attached to individual events. There is no way to attach metadata to a stream itself. ## Use Cases - **Stream owner/tenant** — who owns this stream (useful for multi-tenancy queries) - **Schema version** — which event schema version this stream uses - **TTL hints** — when should this stream be archived/compacted - **Creation timestamp** — when was the first event written - **Custom tags** — business-specific categorization ## Solution ```go type StreamMetadata struct { StreamID string StreamType string CreatedAt time.Time UpdatedAt time.Time Tags map[string]string MaxAge *time.Duration // optional TTL hint MaxCount *int64 // optional max events hint } type StreamMetadataStore interface { GetStreamMetadata(ctx context.Context, streamType, streamID string) (StreamMetadata, error) SetStreamMetadata(ctx context.Context, meta StreamMetadata) error } ``` Implement for pgstore and sqlitestore. Separate table, not mixed with events. ## Pillar: Developer Experience, Production Readiness
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ash/eskit#237
No description provided.