Implement platform management features

This commit is contained in:
npc0-hue
2026-08-17 08:48:45 +08:00
parent 65353cf269
commit 302f1f64b7
38 changed files with 2185 additions and 110 deletions
+8
View File
@@ -27,6 +27,14 @@ func ValidateLogBatchIngest(batch domain.LogBatchIngest) error {
if !validLogStreamSource(batch.Source) {
violations = append(violations, "source is invalid")
}
hasSessionID := strings.TrimSpace(batch.LogSessionID) != ""
hasSessionStart := !batch.SessionStartedAt.IsZero()
if hasSessionID != hasSessionStart {
violations = append(violations, "logSessionId and sessionStartedAt must be provided together")
}
if (hasSessionID || hasSessionStart) && batch.Source != domain.LogStreamSourceProcess {
violations = append(violations, "log session metadata is only valid for process streams")
}
if batch.FirstSeq == 0 || batch.LastSeq == 0 {
violations = append(violations, "sequence range must be positive")
}
+8
View File
@@ -1667,6 +1667,14 @@ func ValidateLogStream(stream domain.LogStream) error {
if !validLogStorageBackend(stream.StorageBackend) {
violations = append(violations, "storageBackend is invalid")
}
hasSessionID := strings.TrimSpace(stream.LogSessionID) != ""
hasSessionStart := !stream.SessionStartedAt.IsZero()
if hasSessionID != hasSessionStart {
violations = append(violations, "logSessionId and sessionStartedAt must be provided together")
}
if (hasSessionID || hasSessionStart) && stream.Source != domain.LogStreamSourceProcess {
violations = append(violations, "log session metadata is only valid for process streams")
}
return finish(violations)
}