feat(scum): rebuild plugin-owned management data
This commit is contained in:
+45
-407
@@ -3,7 +3,6 @@ package repo
|
||||
import (
|
||||
"errors"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"browser.local/platform/domain"
|
||||
@@ -230,137 +229,8 @@ type PluginDataRecordRepository interface {
|
||||
Get(string) (domain.PluginDataRecord, error)
|
||||
List(domain.PluginDataFilter) ([]domain.PluginDataRecord, error)
|
||||
Update(domain.PluginDataRecord) error
|
||||
}
|
||||
|
||||
type GamePlayerRepository interface {
|
||||
Create(domain.GamePlayer) error
|
||||
Get(string) (domain.GamePlayer, error)
|
||||
List(domain.GamePlayerFilter) ([]domain.GamePlayer, error)
|
||||
Update(domain.GamePlayer) error
|
||||
}
|
||||
type GamePlayerAliasRepository interface {
|
||||
Create(domain.GamePlayerAlias) error
|
||||
Get(string) (domain.GamePlayerAlias, error)
|
||||
List(domain.GamePlayerAliasFilter) ([]domain.GamePlayerAlias, error)
|
||||
Update(domain.GamePlayerAlias) error
|
||||
Delete(string) error
|
||||
}
|
||||
type GamePlayerSessionRepository interface {
|
||||
Create(domain.GamePlayerSession) error
|
||||
Get(string) (domain.GamePlayerSession, error)
|
||||
List(domain.GamePlayerSessionFilter) ([]domain.GamePlayerSession, error)
|
||||
Update(domain.GamePlayerSession) error
|
||||
Delete(string) error
|
||||
}
|
||||
type GameAccessAttemptRepository interface {
|
||||
Create(domain.GameAccessAttempt) error
|
||||
Get(string) (domain.GameAccessAttempt, error)
|
||||
List(domain.GameAccessAttemptFilter) ([]domain.GameAccessAttempt, error)
|
||||
Update(domain.GameAccessAttempt) error
|
||||
Delete(string) error
|
||||
}
|
||||
type GameSecuritySignalRepository interface {
|
||||
Create(domain.GameSecuritySignal) error
|
||||
Get(string) (domain.GameSecuritySignal, error)
|
||||
List(domain.GameSecuritySignalFilter) ([]domain.GameSecuritySignal, error)
|
||||
Update(domain.GameSecuritySignal) error
|
||||
Delete(string) error
|
||||
}
|
||||
type GamePlayerStatePatchRepository interface {
|
||||
Create(domain.GamePlayerStatePatch) error
|
||||
Get(string) (domain.GamePlayerStatePatch, error)
|
||||
List(domain.GamePlayerStatePatchFilter) ([]domain.GamePlayerStatePatch, error)
|
||||
Update(domain.GamePlayerStatePatch) error
|
||||
}
|
||||
type GameMapTrackPointRepository interface {
|
||||
Create(domain.GameMapTrackPoint) error
|
||||
Get(string) (domain.GameMapTrackPoint, error)
|
||||
List(domain.GameMapTrackPointFilter) ([]domain.GameMapTrackPoint, error)
|
||||
Delete(string) error
|
||||
}
|
||||
type GamePlayerVehicleSegmentRepository interface {
|
||||
Create(domain.GamePlayerVehicleSegment) error
|
||||
Get(string) (domain.GamePlayerVehicleSegment, error)
|
||||
List(domain.GamePlayerVehicleSegmentFilter) ([]domain.GamePlayerVehicleSegment, error)
|
||||
Update(domain.GamePlayerVehicleSegment) error
|
||||
Delete(string) error
|
||||
}
|
||||
type GameGiftCatalogRepository interface {
|
||||
Create(domain.GameGiftCatalog) error
|
||||
Get(string) (domain.GameGiftCatalog, error)
|
||||
List(domain.GameGiftCatalogFilter) ([]domain.GameGiftCatalog, error)
|
||||
Update(domain.GameGiftCatalog) error
|
||||
}
|
||||
type GameGiftRevisionRepository interface {
|
||||
Create(domain.GameGiftRevision) error
|
||||
Get(string) (domain.GameGiftRevision, error)
|
||||
List(domain.GameGiftRevisionFilter) ([]domain.GameGiftRevision, error)
|
||||
}
|
||||
type GameGiftGrantRepository interface {
|
||||
Create(domain.GameGiftGrant) error
|
||||
Get(string) (domain.GameGiftGrant, error)
|
||||
List(domain.GameGiftGrantFilter) ([]domain.GameGiftGrant, error)
|
||||
Update(domain.GameGiftGrant) error
|
||||
}
|
||||
type SCUMDataObservationRepository interface {
|
||||
Create(domain.SCUMDataObservation) error
|
||||
Get(string) (domain.SCUMDataObservation, error)
|
||||
List(domain.SCUMProjectionFilter) ([]domain.SCUMDataObservation, error)
|
||||
Update(domain.SCUMDataObservation) error
|
||||
}
|
||||
type SCUMPlayerLiveStateRepository interface {
|
||||
Create(domain.SCUMPlayerLiveState) error
|
||||
Get(string) (domain.SCUMPlayerLiveState, error)
|
||||
List(domain.SCUMProjectionFilter) ([]domain.SCUMPlayerLiveState, error)
|
||||
Update(domain.SCUMPlayerLiveState) error
|
||||
}
|
||||
type SCUMSquadRepository interface {
|
||||
Create(domain.SCUMSquad) error
|
||||
Get(string) (domain.SCUMSquad, error)
|
||||
List(domain.SCUMProjectionFilter) ([]domain.SCUMSquad, error)
|
||||
Update(domain.SCUMSquad) error
|
||||
}
|
||||
type SCUMSquadMemberRepository interface {
|
||||
Create(domain.SCUMSquadMember) error
|
||||
Get(string) (domain.SCUMSquadMember, error)
|
||||
List(domain.SCUMProjectionFilter) ([]domain.SCUMSquadMember, error)
|
||||
Update(domain.SCUMSquadMember) error
|
||||
}
|
||||
type SCUMVehicleRepository interface {
|
||||
Create(domain.SCUMVehicle) error
|
||||
Get(string) (domain.SCUMVehicle, error)
|
||||
List(domain.SCUMProjectionFilter) ([]domain.SCUMVehicle, error)
|
||||
Update(domain.SCUMVehicle) error
|
||||
}
|
||||
type SCUMFlagRepository interface {
|
||||
Create(domain.SCUMFlag) error
|
||||
Get(string) (domain.SCUMFlag, error)
|
||||
List(domain.SCUMProjectionFilter) ([]domain.SCUMFlag, error)
|
||||
Update(domain.SCUMFlag) error
|
||||
}
|
||||
type SCUMCurrentPositionRepository interface {
|
||||
Create(domain.SCUMCurrentPosition) error
|
||||
Get(string) (domain.SCUMCurrentPosition, error)
|
||||
List(domain.SCUMProjectionFilter) ([]domain.SCUMCurrentPosition, error)
|
||||
Update(domain.SCUMCurrentPosition) error
|
||||
}
|
||||
type SCUMOperationRequestRepository interface {
|
||||
Create(domain.SCUMOperationRequest) error
|
||||
Get(string) (domain.SCUMOperationRequest, error)
|
||||
List(domain.SCUMOperationRequestFilter) ([]domain.SCUMOperationRequest, error)
|
||||
Update(domain.SCUMOperationRequest) error
|
||||
}
|
||||
type SCUMWorkflowInstanceRepository interface {
|
||||
Create(domain.SCUMWorkflowInstance) error
|
||||
Get(string) (domain.SCUMWorkflowInstance, error)
|
||||
List(domain.SCUMWorkflowInstanceFilter) ([]domain.SCUMWorkflowInstance, error)
|
||||
Update(domain.SCUMWorkflowInstance) error
|
||||
}
|
||||
type SCUMWorkflowStepRepository interface {
|
||||
Create(domain.SCUMWorkflowStep) error
|
||||
Get(string) (domain.SCUMWorkflowStep, error)
|
||||
List(domain.SCUMWorkflowStepFilter) ([]domain.SCUMWorkflowStep, error)
|
||||
Update(domain.SCUMWorkflowStep) error
|
||||
Apply([]domain.PluginDataRecord, []string) error
|
||||
}
|
||||
|
||||
type Store interface {
|
||||
@@ -394,81 +264,39 @@ type Store interface {
|
||||
GameClientBridgeSnapshots() GameClientBridgeSnapshotRepository
|
||||
GameClientBridgeSnapshotStreams() GameClientBridgeSnapshotStreamRepository
|
||||
PluginDataRecords() PluginDataRecordRepository
|
||||
GamePlayers() GamePlayerRepository
|
||||
GamePlayerAliases() GamePlayerAliasRepository
|
||||
GamePlayerSessions() GamePlayerSessionRepository
|
||||
GameAccessAttempts() GameAccessAttemptRepository
|
||||
GameSecuritySignals() GameSecuritySignalRepository
|
||||
GamePlayerStatePatches() GamePlayerStatePatchRepository
|
||||
GameMapTrackPoints() GameMapTrackPointRepository
|
||||
GamePlayerVehicleSegments() GamePlayerVehicleSegmentRepository
|
||||
GameGiftCatalogs() GameGiftCatalogRepository
|
||||
GameGiftRevisions() GameGiftRevisionRepository
|
||||
GameGiftGrants() GameGiftGrantRepository
|
||||
SCUMDataObservations() SCUMDataObservationRepository
|
||||
SCUMPlayerLiveStates() SCUMPlayerLiveStateRepository
|
||||
SCUMSquads() SCUMSquadRepository
|
||||
SCUMSquadMembers() SCUMSquadMemberRepository
|
||||
SCUMVehicles() SCUMVehicleRepository
|
||||
SCUMFlags() SCUMFlagRepository
|
||||
SCUMCurrentPositions() SCUMCurrentPositionRepository
|
||||
SCUMOperationRequests() SCUMOperationRequestRepository
|
||||
SCUMWorkflowInstances() SCUMWorkflowInstanceRepository
|
||||
SCUMWorkflowSteps() SCUMWorkflowStepRepository
|
||||
}
|
||||
|
||||
type MemoryStore struct {
|
||||
users *memoryRepository[domain.User, domain.UserFilter]
|
||||
authSessions *memoryRepository[domain.AuthSessionRecord, domain.AuthSessionFilter]
|
||||
runSessions *memoryRepository[domain.RunControlSession, struct{}]
|
||||
aiProviders *memoryRepository[domain.AIProvider, domain.AIProviderFilter]
|
||||
gamePlugins *memoryRepository[domain.GamePlugin, domain.GamePluginFilter]
|
||||
serverInstances *memoryRepository[domain.ServerInstance, domain.ServerInstanceFilter]
|
||||
runEndpoints *memoryRepository[domain.RunEndpoint, domain.RunEndpointFilter]
|
||||
jobs *memoryJobRepository
|
||||
artifacts *memoryRepository[domain.Artifact, domain.ArtifactFilter]
|
||||
runtimeBindings *memoryRepository[domain.RuntimeBinding, domain.RuntimeBindingFilter]
|
||||
componentKeys *memoryRepository[domain.EncryptedComponentKey, domain.EncryptedComponentKeyFilter]
|
||||
runDists *memoryRepository[domain.RunDistribution, domain.RunDistributionFilter]
|
||||
clientDists *memoryRepository[domain.ClientManagerDistribution, domain.ClientManagerDistributionFilter]
|
||||
clientInstalls *memoryRepository[domain.ClientManagerInstallation, domain.ClientManagerInstallationFilter]
|
||||
clientSessions *memoryRepository[domain.ClientManagerSession, domain.ClientManagerSessionFilter]
|
||||
clientNonces *memoryRepository[domain.ClientManagerRegistrationNonce, domain.ClientManagerNonceFilter]
|
||||
dependencies *memoryRepository[domain.DependencyStatus, domain.DependencyStatusFilter]
|
||||
buildJobs *memoryRepository[domain.ClientManagerBuildJob, domain.ClientManagerBuildJobFilter]
|
||||
updateJobs *memoryRepository[domain.RunUpdateJob, domain.RunUpdateJobFilter]
|
||||
logStreams *memoryRepository[domain.LogStream, domain.LogStreamFilter]
|
||||
auditEvents *memoryRepository[domain.AuditEvent, domain.AuditEventFilter]
|
||||
metricSamples *memoryRepository[domain.MetricSample, domain.MetricSampleFilter]
|
||||
backups *memoryRepository[domain.BackupRecord, domain.BackupFilter]
|
||||
alerts *memoryRepository[domain.AlertRecord, domain.AlertFilter]
|
||||
pluginLifecycle *memoryRepository[domain.PluginLifecycleInstallation, domain.PluginLifecycleFilter]
|
||||
aiConfigDiffs *memoryRepository[domain.AIConfigDiffPreview, domain.AIConfigDiffFilter]
|
||||
bridgeCommands *memoryGameClientBridgeCommandRepository
|
||||
bridgeSnapshots *memoryGameClientBridgeSnapshotRepository
|
||||
bridgeStreams *memoryRepository[domain.GameClientBridgeSnapshotStream, domain.GameClientBridgeSnapshotStreamFilter]
|
||||
pluginDataRecords *memoryRepository[domain.PluginDataRecord, domain.PluginDataFilter]
|
||||
gamePlayers *memoryRepository[domain.GamePlayer, domain.GamePlayerFilter]
|
||||
gamePlayerAliases *memoryRepository[domain.GamePlayerAlias, domain.GamePlayerAliasFilter]
|
||||
gamePlayerSessions *memoryRepository[domain.GamePlayerSession, domain.GamePlayerSessionFilter]
|
||||
gameAccessAttempts *memoryRepository[domain.GameAccessAttempt, domain.GameAccessAttemptFilter]
|
||||
gameSecuritySignals *memoryRepository[domain.GameSecuritySignal, domain.GameSecuritySignalFilter]
|
||||
gamePlayerStatePatches *memoryRepository[domain.GamePlayerStatePatch, domain.GamePlayerStatePatchFilter]
|
||||
gameMapTrackPoints *memoryRepository[domain.GameMapTrackPoint, domain.GameMapTrackPointFilter]
|
||||
gamePlayerVehicleSegments *memoryRepository[domain.GamePlayerVehicleSegment, domain.GamePlayerVehicleSegmentFilter]
|
||||
gameGiftCatalogs *memoryRepository[domain.GameGiftCatalog, domain.GameGiftCatalogFilter]
|
||||
gameGiftRevisions *memoryRepository[domain.GameGiftRevision, domain.GameGiftRevisionFilter]
|
||||
gameGiftGrants *memoryRepository[domain.GameGiftGrant, domain.GameGiftGrantFilter]
|
||||
scumDataObservations *memoryRepository[domain.SCUMDataObservation, domain.SCUMProjectionFilter]
|
||||
scumPlayerLiveStates *memoryRepository[domain.SCUMPlayerLiveState, domain.SCUMProjectionFilter]
|
||||
scumSquads *memoryRepository[domain.SCUMSquad, domain.SCUMProjectionFilter]
|
||||
scumSquadMembers *memoryRepository[domain.SCUMSquadMember, domain.SCUMProjectionFilter]
|
||||
scumVehicles *memoryRepository[domain.SCUMVehicle, domain.SCUMProjectionFilter]
|
||||
scumFlags *memoryRepository[domain.SCUMFlag, domain.SCUMProjectionFilter]
|
||||
scumCurrentPositions *memoryRepository[domain.SCUMCurrentPosition, domain.SCUMProjectionFilter]
|
||||
scumOperationRequests *memoryRepository[domain.SCUMOperationRequest, domain.SCUMOperationRequestFilter]
|
||||
scumWorkflowInstances *memoryRepository[domain.SCUMWorkflowInstance, domain.SCUMWorkflowInstanceFilter]
|
||||
scumWorkflowSteps *memoryRepository[domain.SCUMWorkflowStep, domain.SCUMWorkflowStepFilter]
|
||||
users *memoryRepository[domain.User, domain.UserFilter]
|
||||
authSessions *memoryRepository[domain.AuthSessionRecord, domain.AuthSessionFilter]
|
||||
runSessions *memoryRepository[domain.RunControlSession, struct{}]
|
||||
aiProviders *memoryRepository[domain.AIProvider, domain.AIProviderFilter]
|
||||
gamePlugins *memoryRepository[domain.GamePlugin, domain.GamePluginFilter]
|
||||
serverInstances *memoryRepository[domain.ServerInstance, domain.ServerInstanceFilter]
|
||||
runEndpoints *memoryRepository[domain.RunEndpoint, domain.RunEndpointFilter]
|
||||
jobs *memoryJobRepository
|
||||
artifacts *memoryRepository[domain.Artifact, domain.ArtifactFilter]
|
||||
runtimeBindings *memoryRepository[domain.RuntimeBinding, domain.RuntimeBindingFilter]
|
||||
componentKeys *memoryRepository[domain.EncryptedComponentKey, domain.EncryptedComponentKeyFilter]
|
||||
runDists *memoryRepository[domain.RunDistribution, domain.RunDistributionFilter]
|
||||
clientDists *memoryRepository[domain.ClientManagerDistribution, domain.ClientManagerDistributionFilter]
|
||||
clientInstalls *memoryRepository[domain.ClientManagerInstallation, domain.ClientManagerInstallationFilter]
|
||||
clientSessions *memoryRepository[domain.ClientManagerSession, domain.ClientManagerSessionFilter]
|
||||
clientNonces *memoryRepository[domain.ClientManagerRegistrationNonce, domain.ClientManagerNonceFilter]
|
||||
dependencies *memoryRepository[domain.DependencyStatus, domain.DependencyStatusFilter]
|
||||
buildJobs *memoryRepository[domain.ClientManagerBuildJob, domain.ClientManagerBuildJobFilter]
|
||||
updateJobs *memoryRepository[domain.RunUpdateJob, domain.RunUpdateJobFilter]
|
||||
logStreams *memoryRepository[domain.LogStream, domain.LogStreamFilter]
|
||||
auditEvents *memoryRepository[domain.AuditEvent, domain.AuditEventFilter]
|
||||
metricSamples *memoryRepository[domain.MetricSample, domain.MetricSampleFilter]
|
||||
backups *memoryRepository[domain.BackupRecord, domain.BackupFilter]
|
||||
alerts *memoryRepository[domain.AlertRecord, domain.AlertFilter]
|
||||
pluginLifecycle *memoryRepository[domain.PluginLifecycleInstallation, domain.PluginLifecycleFilter]
|
||||
aiConfigDiffs *memoryRepository[domain.AIConfigDiffPreview, domain.AIConfigDiffFilter]
|
||||
bridgeCommands *memoryGameClientBridgeCommandRepository
|
||||
bridgeSnapshots *memoryGameClientBridgeSnapshotRepository
|
||||
bridgeStreams *memoryRepository[domain.GameClientBridgeSnapshotStream, domain.GameClientBridgeSnapshotStreamFilter]
|
||||
pluginDataRecords *memoryRepository[domain.PluginDataRecord, domain.PluginDataFilter]
|
||||
}
|
||||
|
||||
func NewMemoryStore() *MemoryStore {
|
||||
@@ -606,28 +434,7 @@ func NewMemoryStore() *MemoryStore {
|
||||
domain.CopyGameClientBridgeSnapshotStream,
|
||||
matchGameClientBridgeSnapshotStream,
|
||||
),
|
||||
pluginDataRecords: newMemoryRepository(func(value domain.PluginDataRecord) string { return value.ID }, domain.CopyPluginDataRecord, matchPluginDataRecord),
|
||||
gamePlayers: newMemoryRepository(func(v domain.GamePlayer) string { return v.ID }, domain.CopyGamePlayer, matchGamePlayer),
|
||||
gamePlayerAliases: newMemoryRepository(func(v domain.GamePlayerAlias) string { return v.ID }, domain.CopyGamePlayerAlias, matchGamePlayerAlias),
|
||||
gamePlayerSessions: newMemoryRepository(func(v domain.GamePlayerSession) string { return v.ID }, domain.CopyGamePlayerSession, matchGamePlayerSession),
|
||||
gameAccessAttempts: newMemoryRepository(func(v domain.GameAccessAttempt) string { return v.ID }, domain.CopyGameAccessAttempt, matchGameAccessAttempt),
|
||||
gameSecuritySignals: newMemoryRepository(func(v domain.GameSecuritySignal) string { return v.ID }, domain.CopyGameSecuritySignal, matchGameSecuritySignal),
|
||||
gamePlayerStatePatches: newMemoryRepository(func(v domain.GamePlayerStatePatch) string { return v.ID }, domain.CopyGamePlayerStatePatch, matchGamePlayerStatePatch),
|
||||
gameMapTrackPoints: newMemoryRepository(func(v domain.GameMapTrackPoint) string { return v.ID }, domain.CopyGameMapTrackPoint, matchGameMapTrackPoint),
|
||||
gamePlayerVehicleSegments: newMemoryRepository(func(v domain.GamePlayerVehicleSegment) string { return v.ID }, domain.CopyGamePlayerVehicleSegment, matchGamePlayerVehicleSegment),
|
||||
gameGiftCatalogs: newMemoryRepository(func(v domain.GameGiftCatalog) string { return v.ID }, domain.CopyGameGiftCatalog, matchGameGiftCatalog),
|
||||
gameGiftRevisions: newMemoryRepository(func(v domain.GameGiftRevision) string { return v.ID }, domain.CopyGameGiftRevision, matchGameGiftRevision),
|
||||
gameGiftGrants: newMemoryRepository(func(v domain.GameGiftGrant) string { return v.ID }, domain.CopyGameGiftGrant, matchGameGiftGrant),
|
||||
scumDataObservations: newMemoryRepository(func(v domain.SCUMDataObservation) string { return v.ID }, domain.CopySCUMDataObservation, matchSCUMDataObservation),
|
||||
scumPlayerLiveStates: newMemoryRepository(func(v domain.SCUMPlayerLiveState) string { return v.ID }, domain.CopySCUMPlayerLiveState, matchSCUMPlayerLiveState),
|
||||
scumSquads: newMemoryRepository(func(v domain.SCUMSquad) string { return v.ID }, domain.CopySCUMSquad, matchSCUMSquad),
|
||||
scumSquadMembers: newMemoryRepository(func(v domain.SCUMSquadMember) string { return v.ID }, domain.CopySCUMSquadMember, matchSCUMSquadMember),
|
||||
scumVehicles: newMemoryRepository(func(v domain.SCUMVehicle) string { return v.ID }, domain.CopySCUMVehicle, matchSCUMVehicle),
|
||||
scumFlags: newMemoryRepository(func(v domain.SCUMFlag) string { return v.ID }, domain.CopySCUMFlag, matchSCUMFlag),
|
||||
scumCurrentPositions: newMemoryRepository(func(v domain.SCUMCurrentPosition) string { return v.ID }, domain.CopySCUMCurrentPosition, matchSCUMCurrentPosition),
|
||||
scumOperationRequests: newMemoryRepository(func(v domain.SCUMOperationRequest) string { return v.ID }, domain.CopySCUMOperationRequest, matchSCUMOperationRequest),
|
||||
scumWorkflowInstances: newMemoryRepository(func(v domain.SCUMWorkflowInstance) string { return v.ID }, domain.CopySCUMWorkflowInstance, matchSCUMWorkflowInstance),
|
||||
scumWorkflowSteps: newMemoryRepository(func(v domain.SCUMWorkflowStep) string { return v.ID }, domain.CopySCUMWorkflowStep, matchSCUMWorkflowStep),
|
||||
pluginDataRecords: newMemoryRepository(func(value domain.PluginDataRecord) string { return value.ID }, domain.CopyPluginDataRecord, matchPluginDataRecord),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -683,57 +490,6 @@ func (store *MemoryStore) GameClientBridgeSnapshotStreams() GameClientBridgeSnap
|
||||
func (store *MemoryStore) PluginDataRecords() PluginDataRecordRepository {
|
||||
return store.pluginDataRecords
|
||||
}
|
||||
func (store *MemoryStore) GamePlayers() GamePlayerRepository { return store.gamePlayers }
|
||||
func (store *MemoryStore) GamePlayerAliases() GamePlayerAliasRepository {
|
||||
return store.gamePlayerAliases
|
||||
}
|
||||
func (store *MemoryStore) GamePlayerSessions() GamePlayerSessionRepository {
|
||||
return store.gamePlayerSessions
|
||||
}
|
||||
func (store *MemoryStore) GameAccessAttempts() GameAccessAttemptRepository {
|
||||
return store.gameAccessAttempts
|
||||
}
|
||||
func (store *MemoryStore) GameSecuritySignals() GameSecuritySignalRepository {
|
||||
return store.gameSecuritySignals
|
||||
}
|
||||
func (store *MemoryStore) GamePlayerStatePatches() GamePlayerStatePatchRepository {
|
||||
return store.gamePlayerStatePatches
|
||||
}
|
||||
func (store *MemoryStore) GameMapTrackPoints() GameMapTrackPointRepository {
|
||||
return store.gameMapTrackPoints
|
||||
}
|
||||
func (store *MemoryStore) GamePlayerVehicleSegments() GamePlayerVehicleSegmentRepository {
|
||||
return store.gamePlayerVehicleSegments
|
||||
}
|
||||
func (store *MemoryStore) GameGiftCatalogs() GameGiftCatalogRepository { return store.gameGiftCatalogs }
|
||||
func (store *MemoryStore) GameGiftRevisions() GameGiftRevisionRepository {
|
||||
return store.gameGiftRevisions
|
||||
}
|
||||
func (store *MemoryStore) GameGiftGrants() GameGiftGrantRepository { return store.gameGiftGrants }
|
||||
func (store *MemoryStore) SCUMDataObservations() SCUMDataObservationRepository {
|
||||
return store.scumDataObservations
|
||||
}
|
||||
func (store *MemoryStore) SCUMPlayerLiveStates() SCUMPlayerLiveStateRepository {
|
||||
return store.scumPlayerLiveStates
|
||||
}
|
||||
func (store *MemoryStore) SCUMSquads() SCUMSquadRepository { return store.scumSquads }
|
||||
func (store *MemoryStore) SCUMSquadMembers() SCUMSquadMemberRepository {
|
||||
return store.scumSquadMembers
|
||||
}
|
||||
func (store *MemoryStore) SCUMVehicles() SCUMVehicleRepository { return store.scumVehicles }
|
||||
func (store *MemoryStore) SCUMFlags() SCUMFlagRepository { return store.scumFlags }
|
||||
func (store *MemoryStore) SCUMCurrentPositions() SCUMCurrentPositionRepository {
|
||||
return store.scumCurrentPositions
|
||||
}
|
||||
func (store *MemoryStore) SCUMOperationRequests() SCUMOperationRequestRepository {
|
||||
return store.scumOperationRequests
|
||||
}
|
||||
func (store *MemoryStore) SCUMWorkflowInstances() SCUMWorkflowInstanceRepository {
|
||||
return store.scumWorkflowInstances
|
||||
}
|
||||
func (store *MemoryStore) SCUMWorkflowSteps() SCUMWorkflowStepRepository {
|
||||
return store.scumWorkflowSteps
|
||||
}
|
||||
|
||||
type memoryRepository[T any, F any] struct {
|
||||
mu sync.RWMutex
|
||||
@@ -818,6 +574,19 @@ func (repository *memoryRepository[T, F]) Delete(id string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Apply makes a set of upserts and deletes visible as one repository change.
|
||||
func (repository *memoryRepository[T, F]) Apply(upserts []T, deleteIDs []string) error {
|
||||
repository.mu.Lock()
|
||||
defer repository.mu.Unlock()
|
||||
for _, value := range upserts {
|
||||
repository.byID[repository.idOf(value)] = repository.copyOf(value)
|
||||
}
|
||||
for _, id := range deleteIDs {
|
||||
delete(repository.byID, id)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type memoryJobRepository struct {
|
||||
*memoryRepository[domain.Job, domain.JobFilter]
|
||||
}
|
||||
@@ -1038,134 +807,3 @@ func matchGameClientBridgeSnapshotStream(stream domain.GameClientBridgeSnapshotS
|
||||
func matchPluginDataRecord(value domain.PluginDataRecord, filter domain.PluginDataFilter) bool {
|
||||
return (filter.PluginID == "" || value.PluginID == filter.PluginID) && (filter.ServerInstanceID == "" || value.ServerInstanceID == filter.ServerInstanceID) && (filter.Collection == "" || value.Collection == filter.Collection) && (filter.Key == "" || value.Key == filter.Key)
|
||||
}
|
||||
|
||||
func matchGamePlayer(v domain.GamePlayer, f domain.GamePlayerFilter) bool {
|
||||
return (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) && (f.Search == "" || strings.Contains(strings.ToLower(v.DisplayName), strings.ToLower(f.Search)) || strings.Contains(strings.ToLower(v.GamePlayerID), strings.ToLower(f.Search)))
|
||||
}
|
||||
func matchGamePlayerAlias(v domain.GamePlayerAlias, f domain.GamePlayerAliasFilter) bool {
|
||||
return (f.GamePlayerRecordID == "" || v.GamePlayerRecordID == f.GamePlayerRecordID) && (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID)
|
||||
}
|
||||
func matchGamePlayerSession(v domain.GamePlayerSession, f domain.GamePlayerSessionFilter) bool {
|
||||
return (f.GamePlayerRecordID == "" || v.GamePlayerRecordID == f.GamePlayerRecordID) && (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) && (!f.OpenOnly || v.EndedAt.IsZero())
|
||||
}
|
||||
func matchGameAccessAttempt(v domain.GameAccessAttempt, f domain.GameAccessAttemptFilter) bool {
|
||||
return (f.GamePlayerRecordID == "" || v.GamePlayerRecordID == f.GamePlayerRecordID) && (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID)
|
||||
}
|
||||
func matchGameSecuritySignal(v domain.GameSecuritySignal, f domain.GameSecuritySignalFilter) bool {
|
||||
return (f.GamePlayerRecordID == "" || v.GamePlayerRecordID == f.GamePlayerRecordID) && (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID)
|
||||
}
|
||||
func matchGamePlayerStatePatch(v domain.GamePlayerStatePatch, f domain.GamePlayerStatePatchFilter) bool {
|
||||
return (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) && (f.GamePlayerRecordID == "" || v.GamePlayerRecordID == f.GamePlayerRecordID)
|
||||
}
|
||||
func matchGameMapTrackPoint(v domain.GameMapTrackPoint, f domain.GameMapTrackPointFilter) bool {
|
||||
return (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) && (f.MapID == "" || v.MapID == f.MapID) && (f.MapVersion == "" || v.MapVersion == f.MapVersion) && (f.EntityID == "" || v.EntityID == f.EntityID) && (f.EntityKind == "" || v.EntityKind == f.EntityKind) && (f.OccurredAfter.IsZero() || !v.OccurredAt.Before(f.OccurredAfter)) && (f.OccurredBefore.IsZero() || !v.OccurredAt.After(f.OccurredBefore))
|
||||
}
|
||||
func matchGamePlayerVehicleSegment(v domain.GamePlayerVehicleSegment, f domain.GamePlayerVehicleSegmentFilter) bool {
|
||||
return (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) && (f.GamePlayerRecordID == "" || v.GamePlayerRecordID == f.GamePlayerRecordID) && (f.VehicleID == "" || v.VehicleID == f.VehicleID) && (f.MapID == "" || v.MapID == f.MapID) && (f.MapVersion == "" || v.MapVersion == f.MapVersion) && (f.OccurredAfter.IsZero() || !v.EndedAt.Before(f.OccurredAfter)) && (f.OccurredBefore.IsZero() || !v.StartedAt.After(f.OccurredBefore))
|
||||
}
|
||||
func matchGameGiftCatalog(v domain.GameGiftCatalog, f domain.GameGiftCatalogFilter) bool {
|
||||
return f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID
|
||||
}
|
||||
func matchGameGiftRevision(v domain.GameGiftRevision, f domain.GameGiftRevisionFilter) bool {
|
||||
return (f.CatalogID == "" || v.CatalogID == f.CatalogID) && (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID)
|
||||
}
|
||||
func matchGameGiftGrant(v domain.GameGiftGrant, f domain.GameGiftGrantFilter) bool {
|
||||
return (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) && (f.GamePlayerRecordID == "" || v.GamePlayerRecordID == f.GamePlayerRecordID) && (f.IdempotencyKey == "" || v.IdempotencyKey == f.IdempotencyKey)
|
||||
}
|
||||
|
||||
func matchSCUMDataObservation(v domain.SCUMDataObservation, f domain.SCUMProjectionFilter) bool {
|
||||
return (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) &&
|
||||
(f.SubjectType == "" || v.SubjectType == string(f.SubjectType)) &&
|
||||
(f.GamePlayerRecordID == "" || v.SubjectID == f.GamePlayerRecordID) &&
|
||||
(f.QueryKey == "" || v.QueryKey == f.QueryKey) &&
|
||||
(f.Freshness == "" || domain.SCUMProjectionFreshness(v.Status) == f.Freshness)
|
||||
}
|
||||
|
||||
func matchSCUMPlayerLiveState(v domain.SCUMPlayerLiveState, f domain.SCUMProjectionFilter) bool {
|
||||
search := strings.ToLower(strings.TrimSpace(f.Search))
|
||||
return (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) &&
|
||||
(f.GamePlayerID == "" || v.GamePlayerID == f.GamePlayerID) &&
|
||||
(f.GamePlayerRecordID == "" || v.GamePlayerRecordID == f.GamePlayerRecordID) &&
|
||||
(f.UserProfileID == "" || v.UserProfileID == f.UserProfileID) &&
|
||||
(f.SteamID == "" || v.SteamID == f.SteamID) &&
|
||||
(f.SquadID == "" || v.SquadID == f.SquadID) &&
|
||||
(f.Freshness == "" || v.Freshness.Status == f.Freshness) &&
|
||||
(search == "" || strings.Contains(strings.ToLower(v.DisplayName), search) || strings.Contains(strings.ToLower(v.GamePlayerID), search) || strings.Contains(strings.ToLower(v.UserProfileID), search) || strings.Contains(strings.ToLower(v.SteamID), search))
|
||||
}
|
||||
|
||||
func matchSCUMSquad(v domain.SCUMSquad, f domain.SCUMProjectionFilter) bool {
|
||||
search := strings.ToLower(strings.TrimSpace(f.Search))
|
||||
return (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) &&
|
||||
(f.SquadID == "" || v.SquadID == f.SquadID) &&
|
||||
(f.UserProfileID == "" || v.LeaderProfileID == f.UserProfileID) &&
|
||||
(f.Freshness == "" || v.Freshness.Status == f.Freshness) &&
|
||||
(search == "" || strings.Contains(strings.ToLower(v.Name), search) || strings.Contains(strings.ToLower(v.SquadID), search))
|
||||
}
|
||||
|
||||
func matchSCUMSquadMember(v domain.SCUMSquadMember, f domain.SCUMProjectionFilter) bool {
|
||||
search := strings.ToLower(strings.TrimSpace(f.Search))
|
||||
return (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) &&
|
||||
(f.SquadID == "" || v.SquadID == f.SquadID) &&
|
||||
(f.GamePlayerID == "" || v.GamePlayerID == f.GamePlayerID) &&
|
||||
(f.GamePlayerRecordID == "" || v.GamePlayerRecordID == f.GamePlayerRecordID) &&
|
||||
(f.UserProfileID == "" || v.UserProfileID == f.UserProfileID) &&
|
||||
(f.SteamID == "" || v.SteamID == f.SteamID) &&
|
||||
(f.Freshness == "" || v.Freshness.Status == f.Freshness) &&
|
||||
(search == "" || strings.Contains(strings.ToLower(v.DisplayName), search) || strings.Contains(strings.ToLower(v.GamePlayerID), search) || strings.Contains(strings.ToLower(v.UserProfileID), search))
|
||||
}
|
||||
|
||||
func matchSCUMVehicle(v domain.SCUMVehicle, f domain.SCUMProjectionFilter) bool {
|
||||
search := strings.ToLower(strings.TrimSpace(f.Search))
|
||||
return (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) &&
|
||||
(f.VehicleID == "" || v.VehicleID == f.VehicleID) &&
|
||||
(f.UserProfileID == "" || v.OwnerProfileID == f.UserProfileID) &&
|
||||
(f.GamePlayerID == "" || v.OwnerPlayerID == f.GamePlayerID) &&
|
||||
(f.SquadID == "" || v.SquadID == f.SquadID) &&
|
||||
(f.Freshness == "" || v.Freshness.Status == f.Freshness) &&
|
||||
(search == "" || strings.Contains(strings.ToLower(v.Label), search) || strings.Contains(strings.ToLower(v.ClassName), search) || strings.Contains(strings.ToLower(v.VehicleID), search))
|
||||
}
|
||||
|
||||
func matchSCUMFlag(v domain.SCUMFlag, f domain.SCUMProjectionFilter) bool {
|
||||
return (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) &&
|
||||
(f.FlagID == "" || v.FlagID == f.FlagID) &&
|
||||
(f.UserProfileID == "" || v.OwnerProfileID == f.UserProfileID) &&
|
||||
(f.GamePlayerID == "" || v.OwnerPlayerID == f.GamePlayerID) &&
|
||||
(f.SquadID == "" || v.OwnerSquadID == f.SquadID) &&
|
||||
(f.Freshness == "" || v.Freshness.Status == f.Freshness)
|
||||
}
|
||||
|
||||
func matchSCUMCurrentPosition(v domain.SCUMCurrentPosition, f domain.SCUMProjectionFilter) bool {
|
||||
return (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) &&
|
||||
(f.SubjectType == "" || v.SubjectType == f.SubjectType) &&
|
||||
(f.GamePlayerID == "" || v.GamePlayerID == f.GamePlayerID) &&
|
||||
(f.GamePlayerRecordID == "" || v.GamePlayerRecordID == f.GamePlayerRecordID) &&
|
||||
(f.VehicleID == "" || v.VehicleID == f.VehicleID) &&
|
||||
(f.Freshness == "" || v.Freshness.Status == f.Freshness)
|
||||
}
|
||||
|
||||
func matchSCUMOperationRequest(v domain.SCUMOperationRequest, f domain.SCUMOperationRequestFilter) bool {
|
||||
return (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) &&
|
||||
(f.PluginID == "" || v.PluginID == f.PluginID) &&
|
||||
(f.TemplateKey == "" || v.TemplateKey == f.TemplateKey) &&
|
||||
(f.PlayerID == "" || v.PlayerID == f.PlayerID) &&
|
||||
(f.RequesterID == "" || v.RequesterID == f.RequesterID) &&
|
||||
(f.Status == "" || v.Status == f.Status) &&
|
||||
(f.IdempotencyKey == "" || v.IdempotencyKey == f.IdempotencyKey)
|
||||
}
|
||||
|
||||
func matchSCUMWorkflowInstance(v domain.SCUMWorkflowInstance, f domain.SCUMWorkflowInstanceFilter) bool {
|
||||
return (f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) &&
|
||||
(f.PluginID == "" || v.PluginID == f.PluginID) &&
|
||||
(f.TemplateKey == "" || v.TemplateKey == f.TemplateKey) &&
|
||||
(f.RequestedBy == "" || v.RequestedBy == f.RequestedBy) &&
|
||||
(f.Status == "" || v.Status == f.Status) &&
|
||||
(f.IdempotencyKey == "" || v.IdempotencyKey == f.IdempotencyKey)
|
||||
}
|
||||
|
||||
func matchSCUMWorkflowStep(v domain.SCUMWorkflowStep, f domain.SCUMWorkflowStepFilter) bool {
|
||||
return (f.WorkflowID == "" || v.WorkflowID == f.WorkflowID) &&
|
||||
(f.ServerInstanceID == "" || v.ServerInstanceID == f.ServerInstanceID) &&
|
||||
(f.StepKey == "" || v.StepKey == f.StepKey) &&
|
||||
(f.Status == "" || v.Status == f.Status) &&
|
||||
(f.MutatesState == nil || v.MutatesState == *f.MutatesState)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user