package domain import "time" type LogEntry struct { Seq uint64 Timestamp time.Time Level string Line string Fields map[string]string Redacted bool } type LogBatchIngest struct { RunEndpointID string SessionToken string LogStreamID string ServerInstanceID string StreamKey string Source LogStreamSource LogSessionID string SessionStartedAt time.Time FirstSeq uint64 LastSeq uint64 Compression string Checksum string Entries []LogEntry } type LogBatchIngestResult struct { Accepted bool LogStreamID string AcceptedFrom uint64 AcceptedTo uint64 LatestSeq uint64 Duplicate bool ServerTime time.Time } type LogStreamCursorQuery struct { LogStreamID string AfterSeq uint64 Limit int } type LogStreamCursorResult struct { LogStreamID string Entries []LogEntry NextSeq uint64 LatestSeq uint64 } // RunLogStreamProgress is a signed Run-only request for sequence recovery. // It deliberately exposes no log body or host-local information. type RunLogStreamProgress struct { RunEndpointID string SessionToken string ServerInstanceID string LogStreamID string } type RunLogStreamProgressResult struct { Accepted bool RunEndpointID string ServerInstanceID string LogStreamID string LatestSeq uint64 ServerTime time.Time } type LogStreamEvent struct { ServerInstanceID string Stream LogStream Entry LogEntry LatestSeq uint64 } type LogBatchRecord struct { Checksum string FirstSeq uint64 LastSeq uint64 Entries []LogEntry } func CopyLogEntry(entry LogEntry) LogEntry { if entry.Fields != nil { fields := make(map[string]string, len(entry.Fields)) for key, value := range entry.Fields { fields[key] = value } entry.Fields = fields } return entry } func CopyLogEntries(entries []LogEntry) []LogEntry { if entries == nil { return nil } out := make([]LogEntry, len(entries)) for i, entry := range entries { out[i] = CopyLogEntry(entry) } return out } func CopyLogBatchIngest(batch LogBatchIngest) LogBatchIngest { batch.Entries = CopyLogEntries(batch.Entries) return batch } func CopyLogStreamCursorResult(result LogStreamCursorResult) LogStreamCursorResult { result.Entries = CopyLogEntries(result.Entries) return result } func CopyLogStreamEvent(event LogStreamEvent) LogStreamEvent { event.Stream = CopyLogStream(event.Stream) event.Entry = CopyLogEntry(event.Entry) return event } func CopyLogBatchRecord(record LogBatchRecord) LogBatchRecord { record.Entries = CopyLogEntries(record.Entries) return record }