Freeze SCUM log-source tailing run contract

This commit is contained in:
npc0-hue
2026-08-13 14:37:16 +08:00
parent 41c109128d
commit 4f55c71de5
18 changed files with 627 additions and 6 deletions
+85
View File
@@ -166,6 +166,44 @@ func DefaultSCUMGuardedMutationBounds() SCUMGuardedMutationBounds {
return SCUMGuardedMutationBounds{MaxPayloadBytes: 4096, TimeoutMS: 5000, BusyTimeoutMS: 250, MaxReadbackBytes: 16 * 1024, MaxAffectedRows: 1}
}
type SCUMParsedLogBatchBounds struct {
MaxEvents int
MaxPayloadBytes int
MaxLineBytes int
MaxResultBytes int
}
func DefaultSCUMParsedLogBatchBounds() SCUMParsedLogBatchBounds {
return SCUMParsedLogBatchBounds{MaxEvents: 256, MaxPayloadBytes: 16 * 1024, MaxLineBytes: 4096, MaxResultBytes: 256 * 1024}
}
type SCUMLogTailState string
const (
SCUMLogTailAdvanced SCUMLogTailState = "advanced"
SCUMLogTailRotated SCUMLogTailState = "rotated"
SCUMLogTailTruncated SCUMLogTailState = "truncated"
SCUMLogTailRestarted SCUMLogTailState = "restarted"
SCUMLogTailPartial SCUMLogTailState = "partial-buffered"
SCUMLogTailReplayed SCUMLogTailState = "replayed"
)
type SCUMParsedLogCursor struct {
SourceIdentityDigest string
StreamGeneration string
Sequence uint64
}
type SCUMParsedLogEvent struct {
EventType string
OccurredAt time.Time
Cursor SCUMParsedLogCursor
LogicalEventDigest string
EventDigest string
PayloadDigest string
Payload map[string]any
}
type SCUMSchemaProbeRequest struct {
RequestID string
JobID string
@@ -384,6 +422,32 @@ type SCUMGuardedMutationResult struct {
Limits SCUMGuardedMutationBounds
}
type SCUMParsedLogBatchResult struct {
RequestID string
JobID string
Binding SCUMBindingIdentity
Status SCUMTerminalResultStatus
SourceKey string
StreamKey string
ParserKey string
ParserVersion string
AdapterVersion string
AssetDigest string
ParserDigest string
ObservedAt time.Time
ResultDigest string
FirstCursor SCUMParsedLogCursor
LastCursor SCUMParsedLogCursor
TailState SCUMLogTailState
PartialLineBuffered bool
Replay bool
EventCount int
Events []SCUMParsedLogEvent
SafeSummary string
SafeError SCUMSafeError
Limits SCUMParsedLogBatchBounds
}
type SCUMCapabilityRequirement struct {
Capability SCUMDataCapability
AdapterVersion string
@@ -528,6 +592,27 @@ func CopySCUMGuardedMutationResultPtr(value *SCUMGuardedMutationResult) *SCUMGua
return &copy
}
func CopySCUMParsedLogBatchResultPtr(value *SCUMParsedLogBatchResult) *SCUMParsedLogBatchResult {
if value == nil {
return nil
}
copy := *value
copy.Events = CopySCUMParsedLogEvents(value.Events)
return &copy
}
func CopySCUMParsedLogEvents(events []SCUMParsedLogEvent) []SCUMParsedLogEvent {
if events == nil {
return nil
}
copy := make([]SCUMParsedLogEvent, len(events))
for index, event := range events {
copy[index] = event
copy[index].Payload = CopySCUMValueMap(event.Payload)
}
return copy
}
func CopySCUMValueMap(value map[string]any) map[string]any {
if value == nil {
return nil