Stream live server logs over SSE

This commit is contained in:
npc0-hue
2026-08-03 22:28:54 +08:00
parent 5d4fca14f9
commit 7eac1926dd
48 changed files with 1526 additions and 263 deletions
+2
View File
@@ -324,6 +324,8 @@ type RunJobReconcileResult struct {
func CopyRunJobAssignment(assignment RunJobAssignment) RunJobAssignment {
assignment.ExecutionInput.Inputs = CopyStringMap(assignment.ExecutionInput.Inputs)
assignment.ExecutionInput.LogSource = CopyRuntimeLogSourcePtr(assignment.ExecutionInput.LogSource)
assignment.ExecutionInput.LogSources = CopyRuntimeLogSources(assignment.ExecutionInput.LogSources)
assignment.ExecutionInput.DLLExtensions = append([]RuntimeDLLExtensionPlan(nil), assignment.ExecutionInput.DLLExtensions...)
assignment.ExecutionInput.SourceRCON = CopyRuntimeSourceRCONPlan(assignment.ExecutionInput.SourceRCON)
return assignment
+13
View File
@@ -48,6 +48,13 @@ type LogStreamCursorResult struct {
LatestSeq uint64
}
type LogStreamEvent struct {
ServerInstanceID string
Stream LogStream
Entry LogEntry
LatestSeq uint64
}
type LogBatchRecord struct {
Checksum string
FirstSeq uint64
@@ -87,6 +94,12 @@ func CopyLogStreamCursorResult(result LogStreamCursorResult) LogStreamCursorResu
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
+19
View File
@@ -1109,6 +1109,8 @@ type JobExecutionInput struct {
LifecycleOperation string
TargetVersion string
Inputs map[string]string
LogSource *RuntimeLogSource
LogSources []RuntimeLogSource
DLLExtensions []RuntimeDLLExtensionPlan
SourceRCON *RuntimeSourceRCONPlan
Deployment *ServerDeploymentDefinition
@@ -1988,6 +1990,8 @@ func CopyRunEndpoint(endpoint RunEndpoint) RunEndpoint {
func CopyJob(job Job) Job {
job.ExecutionInput.Inputs = CopyStringMap(job.ExecutionInput.Inputs)
job.ExecutionInput.LogSource = CopyRuntimeLogSourcePtr(job.ExecutionInput.LogSource)
job.ExecutionInput.LogSources = CopyRuntimeLogSources(job.ExecutionInput.LogSources)
job.ExecutionInput.DLLExtensions = append([]RuntimeDLLExtensionPlan(nil), job.ExecutionInput.DLLExtensions...)
job.ExecutionInput.SourceRCON = CopyRuntimeSourceRCONPlan(job.ExecutionInput.SourceRCON)
job.ExecutionInput.ServerDeploymentPlan = CopyServerDeploymentPlan(job.ExecutionInput.ServerDeploymentPlan)
@@ -2000,6 +2004,21 @@ func CopyJob(job Job) Job {
return job
}
func CopyRuntimeLogSourcePtr(source *RuntimeLogSource) *RuntimeLogSource {
if source == nil {
return nil
}
copy := *source
return &copy
}
func CopyRuntimeLogSources(sources []RuntimeLogSource) []RuntimeLogSource {
if sources == nil {
return nil
}
return append([]RuntimeLogSource(nil), sources...)
}
func CopyRuntimeSourceRCONPlan(plan *RuntimeSourceRCONPlan) *RuntimeSourceRCONPlan {
if plan == nil {
return nil