Implement SCUM direct data plane

This commit is contained in:
npc0-hue
2026-08-13 16:33:11 +08:00
parent b07a792784
commit 8b236d7c15
56 changed files with 1466 additions and 90 deletions
+16
View File
@@ -69,8 +69,18 @@ type GameClientBridgeQueryTemplateDeclaration struct {
TargetKey string
ParameterSchemaRef string
ResultSchemaRef string
SQLRef string
MaxRows int
TimeoutSeconds int
RowTarget *SCUMRowTargetDeclaration
}
// SCUMRowTargetDeclaration is plugin-owned data-shaping metadata. The platform
// only applies this declaration; it does not infer a destination from a query key.
type SCUMRowTargetDeclaration struct {
TargetTable string
UpsertKeys []string
ColumnMappings map[string]string
}
type GameClientBridgeOperationKind string
@@ -453,6 +463,12 @@ func CopyGameClientBridgeManifest(value GameClientBridgeManifest) GameClientBrid
}
value.Snapshots = append([]GameClientBridgeSnapshotDeclaration(nil), value.Snapshots...)
value.QueryTemplates = append([]GameClientBridgeQueryTemplateDeclaration(nil), value.QueryTemplates...)
for index := range value.QueryTemplates {
if value.QueryTemplates[index].RowTarget != nil {
copy := CopySCUMRowTargetDeclaration(*value.QueryTemplates[index].RowTarget)
value.QueryTemplates[index].RowTarget = &copy
}
}
value.OperationTemplates = append([]GameClientBridgeOperationTemplateDeclaration(nil), value.OperationTemplates...)
value.Pages = append([]GameClientBridgePageContract(nil), value.Pages...)
value.Features = append([]GameClientBridgeFeatureDeclaration(nil), value.Features...)
+1
View File
@@ -25,6 +25,7 @@ type SCUMProjectionFilter struct {
FlagID string
SubjectType SCUMProjectionSubject
QueryKey string
TargetTable SCUMDataSet
Freshness SCUMProjectionFreshness
Search string
Limit int
+40
View File
@@ -85,6 +85,33 @@ type SCUMObservationResult struct {
Rows []map[string]any
}
type SCUMDataSet string
const (
SCUMDataSetUsers SCUMDataSet = "scum_users"
SCUMDataSetSquads SCUMDataSet = "scum_squads"
SCUMDataSetMembers SCUMDataSet = "scum_squad_members"
SCUMDataSetVehicles SCUMDataSet = "scum_vehicles"
SCUMDataSetFlags SCUMDataSet = "scum_flags"
SCUMDataSetActivity SCUMDataSet = "scum_activity_events"
SCUMDataSetGifts SCUMDataSet = "scum_gift_catalogs"
SCUMDataSetMapPoints SCUMDataSet = "scum_map_points"
)
type SCUMDataRow struct {
ID string
ServerInstanceID string
TargetTable SCUMDataSet
UpsertKey string
Fields map[string]any
Payload map[string]any
PluginID string
QueryKey string
Freshness SCUMProjectionFreshnessState
CreatedAt time.Time
UpdatedAt time.Time
}
type SCUMProjectionFreshnessState struct {
Status SCUMProjectionFreshness
ObservationID string
@@ -232,6 +259,19 @@ func CopySCUMObservationResult(value SCUMObservationResult) SCUMObservationResul
return value
}
func CopySCUMRowTargetDeclaration(value SCUMRowTargetDeclaration) SCUMRowTargetDeclaration {
value.UpsertKeys = CopyStringSlice(value.UpsertKeys)
value.ColumnMappings = CopyStringMap(value.ColumnMappings)
return value
}
func CopySCUMDataRow(value SCUMDataRow) SCUMDataRow {
value.Fields = CopyGameClientBridgePayload(value.Fields)
value.Payload = CopyGameClientBridgePayload(value.Payload)
value.Freshness = CopySCUMProjectionFreshnessState(value.Freshness)
return value
}
func CopyGameClientBridgeRows(values []map[string]any) []map[string]any {
if values == nil {
return nil