feat(coordinator): add configurable coordinator settings and enhance WebSocket connection handling
Build & Test (NowChessSystems) TeamCity build failed

This commit is contained in:
2026-04-26 22:33:16 +02:00
parent 64d5afa4d1
commit 6b59e68e04
27 changed files with 873 additions and 617 deletions
+260 -283
View File
@@ -2,11 +2,58 @@
> **Stack:** raw-http | none | unknown | scala > **Stack:** raw-http | none | unknown | scala
> 0 routes | 0 models | 0 components | 159 lib files | 1 env vars | 1 middleware > 0 routes + 40 rpc | 0 models | 0 components | 140 lib files | 1 env vars | 1 middleware
> **Token savings:** this file is ~0 tokens. Without it, AI exploration would cost ~0 tokens. **Saves ~0 tokens per conversation.** > **Token savings:** this file is ~0 tokens. Without it, AI exploration would cost ~0 tokens. **Saves ~0 tokens per conversation.**
--- ---
# Routes
## gRPC
- `/CoordinatorService/BatchResubscribeGames` (BatchResubscribeRequest) → BatchResubscribeResponse
- `/CoordinatorService/UnsubscribeGames` (UnsubscribeGamesRequest) → UnsubscribeGamesResponse
- `/CoordinatorService/EvictGames` (EvictGamesRequest) → EvictGamesResponse
- `/CoordinatorService/DrainInstance` (DrainInstanceRequest) → DrainInstanceResponse
- `/CoordinatorService/BatchResubscribeGames` (BatchResubscribeRequest) → BatchResubscribeResponse
- `/CoordinatorService/UnsubscribeGames` (UnsubscribeGamesRequest) → UnsubscribeGamesResponse
- `/CoordinatorService/EvictGames` (EvictGamesRequest) → EvictGamesResponse
- `/CoordinatorService/DrainInstance` (DrainInstanceRequest) → DrainInstanceResponse
- `/IoService/ImportFen` (ProtoImportFenRequest) → ProtoGameContext
- `/IoService/ImportPgn` (ProtoImportPgnRequest) → ProtoGameContext
- `/IoService/ExportCombined` (ProtoGameContext) → ProtoCombinedExport
- `/IoService/ExportFen` (ProtoGameContext) → ProtoStringResult
- `/IoService/ExportPgn` (ProtoGameContext) → ProtoStringResult
- `/RuleService/CandidateMoves` (ProtoSquareRequest) → ProtoMoveList
- `/RuleService/LegalMoves` (ProtoSquareRequest) → ProtoMoveList
- `/RuleService/AllLegalMoves` (ProtoGameContext) → ProtoMoveList
- `/RuleService/IsCheck` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsCheckmate` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsStalemate` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsInsufficientMaterial` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsFiftyMoveRule` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsThreefoldRepetition` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/ApplyMove` (ProtoMoveRequest) → ProtoGameContext
- `/RuleService/PostMoveStatus` (ProtoGameContext) → ProtoPostMoveStatus
- `/IoService/ImportFen` (ProtoImportFenRequest) → ProtoGameContext
- `/IoService/ImportPgn` (ProtoImportPgnRequest) → ProtoGameContext
- `/IoService/ExportCombined` (ProtoGameContext) → ProtoCombinedExport
- `/IoService/ExportFen` (ProtoGameContext) → ProtoStringResult
- `/IoService/ExportPgn` (ProtoGameContext) → ProtoStringResult
- `/RuleService/CandidateMoves` (ProtoSquareRequest) → ProtoMoveList
- `/RuleService/LegalMoves` (ProtoSquareRequest) → ProtoMoveList
- `/RuleService/AllLegalMoves` (ProtoGameContext) → ProtoMoveList
- `/RuleService/IsCheck` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsCheckmate` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsStalemate` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsInsufficientMaterial` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsFiftyMoveRule` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsThreefoldRepetition` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/ApplyMove` (ProtoMoveRequest) → ProtoGameContext
- `/RuleService/PostMoveStatus` (ProtoGameContext) → ProtoPostMoveStatus
---
# Libraries # Libraries
- `jacoco-reporter/scoverage_coverage_gaps.py` - `jacoco-reporter/scoverage_coverage_gaps.py`
@@ -28,7 +75,6 @@
- `modules/account/src/main/scala/de/nowchess/account/client/CoreGameClient.scala` — class CoreGameClient, function createGame - `modules/account/src/main/scala/de/nowchess/account/client/CoreGameClient.scala` — class CoreGameClient, function createGame
- `modules/account/src/main/scala/de/nowchess/account/config/JacksonConfig.scala` — class JacksonConfig, function customize - `modules/account/src/main/scala/de/nowchess/account/config/JacksonConfig.scala` — class JacksonConfig, function customize
- `modules/account/src/main/scala/de/nowchess/account/config/NativeReflectionConfig.scala` — class NativeReflectionConfig - `modules/account/src/main/scala/de/nowchess/account/config/NativeReflectionConfig.scala` — class NativeReflectionConfig
- `modules/account/src/main/scala/de/nowchess/account/domain/Account.scala` — class Account
- `modules/account/src/main/scala/de/nowchess/account/domain/Challenge.scala` - `modules/account/src/main/scala/de/nowchess/account/domain/Challenge.scala`
- class Challenge - class Challenge
- function gameIdOpt - function gameIdOpt
@@ -39,15 +85,22 @@
- `modules/account/src/main/scala/de/nowchess/account/domain/ChallengeStatusConverter.scala` — class ChallengeStatusConverter - `modules/account/src/main/scala/de/nowchess/account/domain/ChallengeStatusConverter.scala` — class ChallengeStatusConverter
- `modules/account/src/main/scala/de/nowchess/account/domain/DeclineReasonConverter.scala` — class DeclineReasonConverter - `modules/account/src/main/scala/de/nowchess/account/domain/DeclineReasonConverter.scala` — class DeclineReasonConverter
- `modules/account/src/main/scala/de/nowchess/account/domain/TimeControl.scala` — class TimeControl - `modules/account/src/main/scala/de/nowchess/account/domain/TimeControl.scala` — class TimeControl
- `modules/account/src/main/scala/de/nowchess/account/domain/UserAccount.scala`
- class UserAccount
- function getBotAccounts
- class BotAccount
- class OfficialBotAccount
- `modules/account/src/main/scala/de/nowchess/account/error/AccountError.scala` — function message - `modules/account/src/main/scala/de/nowchess/account/error/AccountError.scala` — function message
- `modules/account/src/main/scala/de/nowchess/account/error/ChallengeError.scala` — function message - `modules/account/src/main/scala/de/nowchess/account/error/ChallengeError.scala` — function message
- `modules/account/src/main/scala/de/nowchess/account/filter/AlreadyLoggedInFilter.scala` — class AlreadyLoggedInFilter
- `modules/account/src/main/scala/de/nowchess/account/repository/AccountRepository.scala` - `modules/account/src/main/scala/de/nowchess/account/repository/AccountRepository.scala`
- class AccountRepository - class UserAccountRepository
- function findByUsername - function findByUsername
- function findById - function findById
- function persist - function persist
- function findByEmail - function findByEmail
- function findAll - function findAll
- _...12 more_
- `modules/account/src/main/scala/de/nowchess/account/repository/ChallengeRepository.scala` - `modules/account/src/main/scala/de/nowchess/account/repository/ChallengeRepository.scala`
- class ChallengeRepository - class ChallengeRepository
- function findActiveByChallengerId - function findActiveByChallengerId
@@ -62,6 +115,8 @@
- function login - function login
- function me - function me
- function publicProfile - function publicProfile
- function banUser
- _...10 more_
- `modules/account/src/main/scala/de/nowchess/account/resource/ChallengeResource.scala` - `modules/account/src/main/scala/de/nowchess/account/resource/ChallengeResource.scala`
- class ChallengeResource - class ChallengeResource
- function create - function create
@@ -75,6 +130,8 @@
- function login - function login
- function findByUsername - function findByUsername
- function findById - function findById
- function createBotAccount
- _...11 more_
- `modules/account/src/main/scala/de/nowchess/account/service/ChallengeService.scala` - `modules/account/src/main/scala/de/nowchess/account/service/ChallengeService.scala`
- class ChallengeService - class ChallengeService
- function create - function create
@@ -83,48 +140,6 @@
- function cancel - function cancel
- function listForUser - function listForUser
- _...1 more_ - _...1 more_
- `modules/api/bin/scoverage/de/nowchess/api/board/Board.scala`
- class Board
- function apply
- function pieceAt
- function updated
- function removed
- function withMove
- _...2 more_
- `modules/api/bin/scoverage/de/nowchess/api/board/CastlingRights.scala`
- function hasAnyRights
- function hasRights
- function revokeColor
- function revokeKingSide
- function revokeQueenSide
- class CastlingRights
- `modules/api/bin/scoverage/de/nowchess/api/board/Color.scala` — function opposite, function label
- `modules/api/bin/scoverage/de/nowchess/api/board/Piece.scala` — class Piece
- `modules/api/bin/scoverage/de/nowchess/api/board/PieceType.scala` — function label
- `modules/api/bin/scoverage/de/nowchess/api/board/Square.scala`
- class Square
- function fromAlgebraic
- function offset
- `modules/api/bin/scoverage/de/nowchess/api/bot/Bot.scala`
- class Bot
- function name
- function nextMove
- `modules/api/bin/scoverage/de/nowchess/api/dto/ErrorEventDto.scala` — class ErrorEventDto, function apply
- `modules/api/bin/scoverage/de/nowchess/api/dto/GameFullEventDto.scala` — class GameFullEventDto, function apply
- `modules/api/bin/scoverage/de/nowchess/api/dto/GameStateEventDto.scala` — class GameStateEventDto, function apply
- `modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala`
- function kingSquare
- function withBoard
- function withTurn
- function withCastlingRights
- function withEnPassantSquare
- function withHalfMoveClock
- _...4 more_
- `modules/api/bin/scoverage/de/nowchess/api/player/PlayerInfo.scala` — class PlayerId, function apply
- `modules/api/bin/scoverage/de/nowchess/api/response/ApiResponse.scala`
- class ApiResponse
- function error
- function totalPages
- `modules/api/src/main/scala/de/nowchess/api/board/Board.scala` - `modules/api/src/main/scala/de/nowchess/api/board/Board.scala`
- class Board - class Board
- function apply - function apply
@@ -185,76 +200,7 @@
- function allLegalMoves - function allLegalMoves
- function isCheck - function isCheck
- function isCheckmate - function isCheckmate
- _...5 more_ - _...6 more_
- `modules/bot/bin/scoverage/de/nowchess/bot/BotController.scala`
- class BotController
- function getBot
- function listBots
- `modules/bot/bin/scoverage/de/nowchess/bot/BotMoveRepetition.scala`
- class BotMoveRepetition
- function blockedMoves
- function repeatedMove
- function filterAllowed
- `modules/bot/bin/scoverage/de/nowchess/bot/Config.scala` — class Config
- `modules/bot/bin/scoverage/de/nowchess/bot/ai/Evaluation.scala`
- class Evaluation
- class CHECKMATE_SCORE
- class DRAW_SCORE
- function evaluate
- function initAccumulator
- function copyAccumulator
- _...2 more_
- `modules/bot/bin/scoverage/de/nowchess/bot/bots/classic/EvaluationClassic.scala`
- class EvaluationClassic
- function evaluate
- function countRay
- `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/EvaluationNNUE.scala` — class EvaluationNNUE, function evaluate
- `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NNUE.scala`
- class NNUE
- function initAccumulator
- function pushAccumulator
- function copyAccumulator
- function recomputeAccumulator
- function validateAccumulator
- _...4 more_
- `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NbaiLoader.scala`
- class NbaiLoader
- function load
- function loadDefault
- `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NbaiMigrator.scala` — class NbaiMigrator, function migrateFromBin
- `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NbaiModel.scala`
- function toJson
- class NbaiMetadata
- function fromJson
- function str
- function num
- `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NbaiWriter.scala` — class NbaiWriter, function write
- `modules/bot/bin/scoverage/de/nowchess/bot/logic/AlphaBetaSearch.scala`
- function bestMove
- function bestMove
- function bestMoveWithTime
- function bestMoveWithTime
- function loop
- function loop
- `modules/bot/bin/scoverage/de/nowchess/bot/logic/MoveOrdering.scala`
- class MoveOrdering
- class OrderingContext
- function addKillerMove
- function getKillerMoves
- function addHistory
- function getHistory
- _...3 more_
- `modules/bot/bin/scoverage/de/nowchess/bot/logic/TranspositionTable.scala`
- function advance
- function probe
- function store
- function clear
- `modules/bot/bin/scoverage/de/nowchess/bot/util/PolyglotBook.scala` — function probe, function select
- `modules/bot/bin/scoverage/de/nowchess/bot/util/PolyglotHash.scala` — class PolyglotHash, function hash
- `modules/bot/bin/scoverage/de/nowchess/bot/util/ZobristHash.scala`
- class ZobristHash
- function hash
- function nextHash
- `modules/bot/python/nnue.py` - `modules/bot/python/nnue.py`
- function get_weights_dir: () - function get_weights_dir: ()
- function get_data_dir: () - function get_data_dir: ()
@@ -359,63 +305,65 @@
- class ZobristHash - class ZobristHash
- function hash - function hash
- function nextHash - function nextHash
- `modules/core/bin/scoverage/de/nowchess/chess/command/Command.scala` - `modules/coordinator/src/main/scala/de/nowchess/coordinator/CoordinatorApp.scala` — class CoordinatorApp
- class Command - `modules/coordinator/src/main/scala/de/nowchess/coordinator/config/BeansProducer.scala`
- function execute - class BeansProducer
- function undo - function redissonClient
- function description - function kubernetesClient
- class MoveResult - `modules/coordinator/src/main/scala/de/nowchess/coordinator/config/CoordinatorConfig.scala`
- `modules/core/bin/scoverage/de/nowchess/chess/command/CommandInvoker.scala` - class CoordinatorConfig
- class CommandInvoker - function maxGamesPerCore
- function execute - function maxDeviationPercent
- function undo - function rebalanceInterval
- function redo - function rebalanceMinInterval
- function history - function heartbeatTtl
- function getCurrentIndex - _...11 more_
- _...3 more_ - `modules/coordinator/src/main/scala/de/nowchess/coordinator/grpc/CoordinatorGrpcServer.scala` — class CoordinatorGrpcServer
- `modules/core/bin/scoverage/de/nowchess/chess/config/JacksonConfig.scala` — class JacksonConfig, function customize - `modules/coordinator/src/main/scala/de/nowchess/coordinator/grpc/CoreGrpcClient.scala`
- `modules/core/bin/scoverage/de/nowchess/chess/controller/Parser.scala` — class Parser, function parseMove - class CoreGrpcClient
- `modules/core/bin/scoverage/de/nowchess/chess/engine/GameEngine.scala` - function shutdown
- class GameEngine - function batchResubscribeGames
- function board - function unsubscribeGames
- function turn - function evictGames
- function context - `modules/coordinator/src/main/scala/de/nowchess/coordinator/resource/CoordinatorResource.scala`
- function pendingDrawOfferBy - class CoordinatorResource
- function canUndo - function listInstances
- _...17 more_ - function getMetrics
- `modules/core/bin/scoverage/de/nowchess/chess/exception/ApiException.scala` - function triggerRebalance
- class ApiException - function triggerFailover
- class GameNotFoundException - function triggerScaleUp
- class BadRequestException
- `modules/core/bin/scoverage/de/nowchess/chess/exception/ApiExceptionMapper.scala` — class ApiExceptionMapper, function toResponse
- `modules/core/bin/scoverage/de/nowchess/chess/observer/Observer.scala`
- function context
- class Observer
- function onGameEvent
- class Observable
- function subscribe
- function unsubscribe
- _...1 more_ - _...1 more_
- `modules/core/bin/scoverage/de/nowchess/chess/registry/GameRegistry.scala` - `modules/coordinator/src/main/scala/de/nowchess/coordinator/service/AutoScaler.scala`
- class GameRegistry - class AutoScaler
- function store - function checkAndScale
- function get - function scaleUp
- function update - function scaleDown
- function generateId - `modules/coordinator/src/main/scala/de/nowchess/coordinator/service/CacheEvictionManager.scala`
- `modules/core/bin/scoverage/de/nowchess/chess/registry/GameRegistryImpl.scala` - class CacheEvictionManager
- class GameRegistryImpl - function setRedisPrefix
- function store - function evictStaleGames
- function get - `modules/coordinator/src/main/scala/de/nowchess/coordinator/service/FailoverService.scala`
- function update - class FailoverService
- function generateId - function setRedisPrefix
- `modules/core/bin/scoverage/de/nowchess/chess/resource/GameResource.scala` - function onInstanceStreamDropped
- class GameResource - `modules/coordinator/src/main/scala/de/nowchess/coordinator/service/HealthMonitor.scala`
- function onGameEvent - class HealthMonitor
- function createGame - function setRedisPrefix
- function getGame - function checkInstanceHealth
- function streamGame - function watchK8sPods
- function onGameEvent - `modules/coordinator/src/main/scala/de/nowchess/coordinator/service/InstanceRegistry.scala`
- _...10 more_ - class InstanceRegistry
- function setRedisPrefix
- function getInstance
- function getAllInstances
- function updateInstanceFromRedis
- function markInstanceDead
- _...1 more_
- `modules/coordinator/src/main/scala/de/nowchess/coordinator/service/LoadBalancer.scala`
- class LoadBalancer
- function setRedisPrefix
- function shouldRebalance
- function rebalance
- `modules/core/src/main/scala/de/nowchess/chess/adapter/RuleSetRestAdapter.scala` - `modules/core/src/main/scala/de/nowchess/chess/adapter/RuleSetRestAdapter.scala`
- class RuleSetRestAdapter - class RuleSetRestAdapter
- function candidateMoves - function candidateMoves
@@ -430,6 +378,7 @@
- function importPgn - function importPgn
- function exportFen - function exportFen
- function exportPgn - function exportPgn
- function exportCombined
- `modules/core/src/main/scala/de/nowchess/chess/client/RuleServiceClient.scala` - `modules/core/src/main/scala/de/nowchess/chess/client/RuleServiceClient.scala`
- class RuleServiceClient - class RuleServiceClient
- function candidateMoves - function candidateMoves
@@ -437,23 +386,15 @@
- function allLegalMoves - function allLegalMoves
- function isCheck - function isCheck
- function isCheckmate - function isCheckmate
- _...5 more_ - _...6 more_
- `modules/core/src/main/scala/de/nowchess/chess/command/Command.scala` - `modules/core/src/main/scala/de/nowchess/chess/client/StoreServiceClient.scala` — class StoreServiceClient, function getGame
- class Command
- function execute
- function undo
- function description
- class MoveResult
- `modules/core/src/main/scala/de/nowchess/chess/command/CommandInvoker.scala`
- class CommandInvoker
- function execute
- function undo
- function redo
- function history
- function getCurrentIndex
- _...3 more_
- `modules/core/src/main/scala/de/nowchess/chess/config/JacksonConfig.scala` — class JacksonConfig, function customize - `modules/core/src/main/scala/de/nowchess/chess/config/JacksonConfig.scala` — class JacksonConfig, function customize
- `modules/core/src/main/scala/de/nowchess/chess/config/NativeReflectionConfig.scala` — class NativeReflectionConfig - `modules/core/src/main/scala/de/nowchess/chess/config/NativeReflectionConfig.scala` — class NativeReflectionConfig
- `modules/core/src/main/scala/de/nowchess/chess/config/RedisConfig.scala` — class RedisConfig
- `modules/core/src/main/scala/de/nowchess/chess/config/RedissonProducer.scala`
- class RedissonProducer
- function produceRedissonClient
- function shutdown
- `modules/core/src/main/scala/de/nowchess/chess/controller/Parser.scala` — class Parser, function parseMove - `modules/core/src/main/scala/de/nowchess/chess/controller/Parser.scala` — class Parser, function parseMove
- `modules/core/src/main/scala/de/nowchess/chess/engine/GameEngine.scala` - `modules/core/src/main/scala/de/nowchess/chess/engine/GameEngine.scala`
- class GameEngine - class GameEngine
@@ -462,12 +403,36 @@
- function context - function context
- function pendingDrawOfferBy - function pendingDrawOfferBy
- function currentClockState - function currentClockState
- _...18 more_ - _...22 more_
- `modules/core/src/main/scala/de/nowchess/chess/exception/ApiException.scala` - `modules/core/src/main/scala/de/nowchess/chess/exception/ApiException.scala`
- class ApiException - class ApiException
- class GameNotFoundException - class GameNotFoundException
- class BadRequestException - class BadRequestException
- `modules/core/src/main/scala/de/nowchess/chess/exception/ApiExceptionMapper.scala` — class ApiExceptionMapper, function toResponse - `modules/core/src/main/scala/de/nowchess/chess/exception/ApiExceptionMapper.scala` — class ApiExceptionMapper, function toResponse
- `modules/core/src/main/scala/de/nowchess/chess/grpc/CoordinatorServiceHandler.scala` — class CoordinatorServiceHandler
- `modules/core/src/main/scala/de/nowchess/chess/grpc/CoreProtoMapper.scala`
- class CoreProtoMapper
- function toProtoColor
- function fromProtoColor
- function toProtoPieceType
- function fromProtoPieceType
- function toProtoMoveKind
- _...9 more_
- `modules/core/src/main/scala/de/nowchess/chess/grpc/IoGrpcClientWrapper.scala`
- class IoGrpcClientWrapper
- function exportCombined
- function importFen
- function importPgn
- function exportFen
- function exportPgn
- `modules/core/src/main/scala/de/nowchess/chess/grpc/RuleSetGrpcAdapter.scala`
- class RuleSetGrpcAdapter
- function candidateMoves
- function legalMoves
- function allLegalMoves
- function isCheck
- function isCheckmate
- _...5 more_
- `modules/core/src/main/scala/de/nowchess/chess/observer/Observer.scala` - `modules/core/src/main/scala/de/nowchess/chess/observer/Observer.scala`
- function context - function context
- class Observer - class Observer
@@ -476,18 +441,36 @@
- function subscribe - function subscribe
- function unsubscribe - function unsubscribe
- _...1 more_ - _...1 more_
- `modules/core/src/main/scala/de/nowchess/chess/redis/C2sMessage.scala` — class C2sMessage
- `modules/core/src/main/scala/de/nowchess/chess/redis/GameRedisPublisher.scala` — class GameRedisPublisher, function onGameEvent
- `modules/core/src/main/scala/de/nowchess/chess/redis/GameRedisSubscriberManager.scala`
- class GameRedisSubscriberManager
- function subscribeGame
- function onMessage
- function unsubscribeGame
- function batchResubscribeGames
- function unsubscribeGames
- _...3 more_
- `modules/core/src/main/scala/de/nowchess/chess/registry/GameRegistry.scala` - `modules/core/src/main/scala/de/nowchess/chess/registry/GameRegistry.scala`
- class GameRegistry - class GameRegistry
- function store - function store
- function get - function get
- function update - function update
- function generateId - function generateId
- `modules/core/src/main/scala/de/nowchess/chess/registry/GameRegistryImpl.scala` - `modules/core/src/main/scala/de/nowchess/chess/registry/RedisGameRegistry.scala`
- class GameRegistryImpl - class RedisGameRegistry
- function generateId
- function store - function store
- function get - function get
- function update - function update
- function generateId - `modules/core/src/main/scala/de/nowchess/chess/resource/GameDtoMapper.scala`
- class GameDtoMapper
- function statusOf
- function moveToUci
- function toPlayerDto
- function toClockDto
- function toGameStateDto
- _...1 more_
- `modules/core/src/main/scala/de/nowchess/chess/resource/GameResource.scala` - `modules/core/src/main/scala/de/nowchess/chess/resource/GameResource.scala`
- class GameResource - class GameResource
- function onGameEvent - function onGameEvent
@@ -495,54 +478,15 @@
- function getGame - function getGame
- function resignGame - function resignGame
- function makeMove - function makeMove
- _...8 more_ - _...9 more_
- `modules/core/src/main/scala/de/nowchess/chess/resource/GameWebSocketResource.scala` - `modules/core/src/main/scala/de/nowchess/chess/service/InstanceHeartbeatService.scala`
- class GameWebSocketResource - class InstanceHeartbeatService
- function onOpen - function onStart
- function onGameEvent - function onShutdown
- function onClose - function setRedisPrefix
- `modules/io/bin/scoverage/de/nowchess/io/GameContextExport.scala` — class GameContextExport, function exportGameContext - function setSubscriptionCount
- `modules/io/bin/scoverage/de/nowchess/io/GameContextImport.scala` — class GameContextImport, function importGameContext - function setLocalCacheSize
- `modules/io/bin/scoverage/de/nowchess/io/GameFileService.scala` - _...2 more_
- class GameFileService
- function saveGameToFile
- function loadGameFromFile
- class FileSystemGameService
- function saveGameToFile
- function loadGameFromFile
- `modules/io/bin/scoverage/de/nowchess/io/fen/FenExporter.scala`
- class FenExporter
- function boardToFen
- function gameContextToFen
- function exportGameContext
- `modules/io/bin/scoverage/de/nowchess/io/fen/FenParser.scala`
- class FenParser
- function parseFen
- function importGameContext
- function parseBoard
- `modules/io/bin/scoverage/de/nowchess/io/fen/FenParserCombinators.scala`
- class FenParserCombinators
- function parseFen
- function parseBoard
- function importGameContext
- `modules/io/bin/scoverage/de/nowchess/io/fen/FenParserFastParse.scala`
- class FenParserFastParse
- function parseFen
- function parseBoard
- function importGameContext
- `modules/io/bin/scoverage/de/nowchess/io/fen/FenParserSupport.scala` — function buildSquares
- `modules/io/bin/scoverage/de/nowchess/io/json/JsonExporter.scala` — class JsonExporter, function exportGameContext
- `modules/io/bin/scoverage/de/nowchess/io/json/JsonParser.scala` — class JsonParser, function importGameContext
- `modules/io/bin/scoverage/de/nowchess/io/pgn/PgnExporter.scala`
- class PgnExporter
- function exportGameContext
- function exportGame
- `modules/io/bin/scoverage/de/nowchess/io/pgn/PgnParser.scala`
- class PgnParser
- function validatePgn
- function importGameContext
- function parsePgn
- function parseAlgebraicMove
- `modules/io/src/main/scala/de/nowchess/io/GameFileService.scala` - `modules/io/src/main/scala/de/nowchess/io/GameFileService.scala`
- class GameFileService - class GameFileService
- function saveGameToFile - function saveGameToFile
@@ -571,6 +515,15 @@
- function parseBoard - function parseBoard
- function importGameContext - function importGameContext
- `modules/io/src/main/scala/de/nowchess/io/fen/FenParserSupport.scala` — function buildSquares - `modules/io/src/main/scala/de/nowchess/io/fen/FenParserSupport.scala` — function buildSquares
- `modules/io/src/main/scala/de/nowchess/io/grpc/IoGrpcService.scala` — class IoGrpcService
- `modules/io/src/main/scala/de/nowchess/io/grpc/IoProtoMapper.scala`
- class IoProtoMapper
- function toProtoColor
- function fromProtoColor
- function toProtoPieceType
- function fromProtoPieceType
- function toProtoMoveKind
- _...9 more_
- `modules/io/src/main/scala/de/nowchess/io/json/JsonExporter.scala` — class JsonExporter, function exportGameContext - `modules/io/src/main/scala/de/nowchess/io/json/JsonExporter.scala` — class JsonExporter, function exportGameContext
- `modules/io/src/main/scala/de/nowchess/io/json/JsonParser.scala` — class JsonParser, function importGameContext - `modules/io/src/main/scala/de/nowchess/io/json/JsonParser.scala` — class JsonParser, function importGameContext
- `modules/io/src/main/scala/de/nowchess/io/pgn/PgnExporter.scala` - `modules/io/src/main/scala/de/nowchess/io/pgn/PgnExporter.scala`
@@ -591,6 +544,7 @@
- function importPgn - function importPgn
- function exportFen - function exportFen
- function exportPgn - function exportPgn
- function exportCombined
- `modules/json/src/main/scala/de/nowchess/json/ChessJacksonModule.scala` — class ChessJacksonModule - `modules/json/src/main/scala/de/nowchess/json/ChessJacksonModule.scala` — class ChessJacksonModule
- `modules/json/src/main/scala/de/nowchess/json/GameResultDeserializer.scala` — class GameResultDeserializer - `modules/json/src/main/scala/de/nowchess/json/GameResultDeserializer.scala` — class GameResultDeserializer
- `modules/json/src/main/scala/de/nowchess/json/GameResultSerializer.scala` — class GameResultSerializer - `modules/json/src/main/scala/de/nowchess/json/GameResultSerializer.scala` — class GameResultSerializer
@@ -600,22 +554,17 @@
- `modules/json/src/main/scala/de/nowchess/json/SquareKeyDeserializer.scala` — class SquareKeyDeserializer - `modules/json/src/main/scala/de/nowchess/json/SquareKeyDeserializer.scala` — class SquareKeyDeserializer
- `modules/json/src/main/scala/de/nowchess/json/SquareKeySerializer.scala` — class SquareKeySerializer - `modules/json/src/main/scala/de/nowchess/json/SquareKeySerializer.scala` — class SquareKeySerializer
- `modules/json/src/main/scala/de/nowchess/json/SquareSerializer.scala` — class SquareSerializer - `modules/json/src/main/scala/de/nowchess/json/SquareSerializer.scala` — class SquareSerializer
- `modules/rule/bin/scoverage/de/nowchess/rules/RuleSet.scala`
- class RuleSet
- function candidateMoves
- function legalMoves
- function allLegalMoves
- function isCheck
- function isCheckmate
- _...5 more_
- `modules/rule/bin/scoverage/de/nowchess/rules/sets/DefaultRules.scala`
- class DefaultRules
- function positionOf
- function loop
- function toMoves
- function loop
- `modules/rule/src/main/scala/de/nowchess/rules/config/JacksonConfig.scala` — class JacksonConfig, function customize - `modules/rule/src/main/scala/de/nowchess/rules/config/JacksonConfig.scala` — class JacksonConfig, function customize
- `modules/rule/src/main/scala/de/nowchess/rules/config/NativeReflectionConfig.scala` — class NativeReflectionConfig - `modules/rule/src/main/scala/de/nowchess/rules/config/NativeReflectionConfig.scala` — class NativeReflectionConfig
- `modules/rule/src/main/scala/de/nowchess/rules/grpc/ProtoMapper.scala`
- class ProtoMapper
- function toProtoColor
- function fromProtoColor
- function toProtoPieceType
- function fromProtoPieceType
- function toProtoMoveKind
- _...9 more_
- `modules/rule/src/main/scala/de/nowchess/rules/grpc/RuleGrpcService.scala` — class RuleGrpcService
- `modules/rule/src/main/scala/de/nowchess/rules/resource/RuleSetResource.scala` - `modules/rule/src/main/scala/de/nowchess/rules/resource/RuleSetResource.scala`
- class RuleSetResource - class RuleSetResource
- function candidateMoves - function candidateMoves
@@ -623,8 +572,36 @@
- function allLegalMoves - function allLegalMoves
- function isCheck - function isCheck
- function isCheckmate - function isCheckmate
- _...5 more_ - _...6 more_
- `modules/rule/src/main/scala/de/nowchess/rules/sets/DefaultRules.scala` — class DefaultRules, function positionOf - `modules/rule/src/main/scala/de/nowchess/rules/sets/DefaultRules.scala` — class DefaultRules, function positionOf
- `modules/store/src/main/scala/de/nowchess/store/config/RedisConfig.scala` — class RedisConfig
- `modules/store/src/main/scala/de/nowchess/store/config/RedissonProducer.scala`
- class RedissonProducer
- function redissonClient
- function close
- `modules/store/src/main/scala/de/nowchess/store/domain/GameRecord.scala` — class GameRecord
- `modules/store/src/main/scala/de/nowchess/store/redis/GameWritebackStreamListener.scala`
- class GameWritebackStreamListener
- function startListening
- function onMessage
- `modules/store/src/main/scala/de/nowchess/store/repository/GameRecordRepository.scala`
- class GameRecordRepository
- function findByGameId
- function persist
- function merge
- `modules/store/src/main/scala/de/nowchess/store/resource/StoreGameResource.scala` — class StoreGameResource, function getGame
- `modules/store/src/main/scala/de/nowchess/store/service/GameWritebackService.scala` — class GameWritebackService, function writeBack
- `modules/ws/src/main/scala/de/nowchess/ws/config/RedisConfig.scala` — class RedisConfig
- `modules/ws/src/main/scala/de/nowchess/ws/config/RedissonProducer.scala`
- class RedissonProducer
- function produceRedissonClient
- function shutdown
- `modules/ws/src/main/scala/de/nowchess/ws/resource/GameWebSocketResource.scala`
- class GameWebSocketResource
- function onOpen
- function onMessage
- function onTextMessage
- function onClose
--- ---
@@ -647,39 +624,39 @@
## Most Imported Files (change these carefully) ## Most Imported Files (change these carefully)
- `modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala` — imported by **138** files - `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala` — imported by **76** files
- `modules/api/bin/scoverage/de/nowchess/api/board/Square.scala` — imported by **99** files - `modules/api/src/main/scala/de/nowchess/api/board/Square.scala` — imported by **57** files
- `modules/api/bin/scoverage/de/nowchess/api/move/Move.scala` — imported by **97** files - `modules/api/src/main/scala/de/nowchess/api/move/Move.scala` — imported by **55** files
- `modules/api/bin/scoverage/de/nowchess/api/board/Color.scala` — imported by **81** files - `modules/api/src/main/scala/de/nowchess/api/board/Color.scala` — imported by **46** files
- `modules/rule/bin/scoverage/de/nowchess/rules/sets/DefaultRules.scala` — imported by **44** files - `modules/rule/src/main/scala/de/nowchess/rules/sets/DefaultRules.scala` — imported by **28** files
- `modules/api/bin/scoverage/de/nowchess/api/board/Board.scala` — imported by **39** files - `modules/api/src/main/scala/de/nowchess/api/board/Board.scala` — imported by **20** files
- `modules/api/bin/scoverage/de/nowchess/api/board/Piece.scala` — imported by **39** files - `modules/api/src/main/scala/de/nowchess/api/board/PieceType.scala` — imported by **20** files
- `modules/api/bin/scoverage/de/nowchess/api/board/PieceType.scala` — imported by **37** files - `modules/api/src/main/scala/de/nowchess/api/board/Piece.scala` — imported by **20** files
- `modules/api/bin/scoverage/de/nowchess/api/game/DrawReason.scala` — imported by **23** files - `modules/api/src/main/scala/de/nowchess/api/game/DrawReason.scala` — imported by **18** files
- `modules/api/src/main/scala/de/nowchess/api/rules/RuleSet.scala` — imported by **23** files - `modules/api/src/main/scala/de/nowchess/api/game/GameResult.scala` — imported by **18** files
- `modules/api/bin/scoverage/de/nowchess/api/board/CastlingRights.scala` — imported by **22** files - `modules/api/src/main/scala/de/nowchess/api/rules/RuleSet.scala` — imported by **14** files
- `modules/api/bin/scoverage/de/nowchess/api/game/GameResult.scala` — imported by **21** files - `modules/api/src/main/scala/de/nowchess/api/board/CastlingRights.scala` — imported by **13** files
- `modules/io/bin/scoverage/de/nowchess/io/fen/FenParser.scala` — imported by **20** files - `modules/io/src/main/scala/de/nowchess/io/fen/FenParser.scala` — imported by **11** files
- `modules/api/src/main/scala/de/nowchess/api/io/GameContextImport.scala` — imported by **15** files - `modules/api/src/main/scala/de/nowchess/api/player/PlayerInfo.scala` — imported by **9** files
- `modules/api/bin/scoverage/de/nowchess/api/player/PlayerInfo.scala` — imported by **14** files - `modules/api/src/main/scala/de/nowchess/api/error/GameError.scala` — imported by **9** files
- `modules/core/bin/scoverage/de/nowchess/chess/observer/Observer.scala` — imported by **13** files - `modules/core/src/main/scala/de/nowchess/chess/observer/Observer.scala` — imported by **9** files
- `modules/api/bin/scoverage/de/nowchess/api/bot/Bot.scala` — imported by **12** files - `modules/api/src/main/scala/de/nowchess/api/io/GameContextImport.scala` — imported by **8** files
- `modules/bot/bin/scoverage/de/nowchess/bot/ai/Evaluation.scala` — imported by **12** files - `modules/core/src/main/scala/de/nowchess/chess/grpc/IoGrpcClientWrapper.scala` — imported by **7** files
- `modules/bot/bin/scoverage/de/nowchess/bot/util/PolyglotBook.scala` — imported by **10** files - `modules/api/src/main/scala/de/nowchess/api/bot/Bot.scala` — imported by **6** files
- `modules/api/src/main/scala/de/nowchess/api/io/GameContextExport.scala` — imported by **10** files - `modules/bot/src/main/scala/de/nowchess/bot/ai/Evaluation.scala` — imported by **6** files
## Import Map (who imports what) ## Import Map (who imports what)
- `modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala` `modules/api/bin/scoverage/de/nowchess/api/bot/Bot.scala`, `modules/api/src/main/scala/de/nowchess/api/bot/Bot.scala`, `modules/api/src/main/scala/de/nowchess/api/io/GameContextExport.scala`, `modules/api/src/main/scala/de/nowchess/api/io/GameContextImport.scala`, `modules/api/src/main/scala/de/nowchess/api/rules/RuleSet.scala` +133 more - `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala``modules/api/src/main/scala/de/nowchess/api/bot/Bot.scala`, `modules/api/src/main/scala/de/nowchess/api/io/GameContextExport.scala`, `modules/api/src/main/scala/de/nowchess/api/io/GameContextImport.scala`, `modules/api/src/main/scala/de/nowchess/api/rules/RuleSet.scala`, `modules/bot/src/main/scala/de/nowchess/bot/BotMoveRepetition.scala` +71 more
- `modules/api/bin/scoverage/de/nowchess/api/board/Square.scala``modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala`, `modules/api/bin/scoverage/de/nowchess/api/move/Move.scala`, `modules/api/bin/test/de/nowchess/api/game/GameContextTest.scala`, `modules/api/bin/test/de/nowchess/api/move/MoveTest.scala`, `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala` +94 more - `modules/api/src/main/scala/de/nowchess/api/board/Square.scala``modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala`, `modules/api/src/main/scala/de/nowchess/api/move/Move.scala`, `modules/api/src/main/scala/de/nowchess/api/rules/RuleSet.scala`, `modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala`, `modules/api/src/test/scala/de/nowchess/api/move/MoveTest.scala` +52 more
- `modules/api/bin/scoverage/de/nowchess/api/move/Move.scala``modules/api/bin/scoverage/de/nowchess/api/bot/Bot.scala`, `modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala`, `modules/api/bin/test/de/nowchess/api/board/BoardTest.scala`, `modules/api/bin/test/de/nowchess/api/game/GameContextTest.scala`, `modules/api/src/main/scala/de/nowchess/api/bot/Bot.scala` +92 more - `modules/api/src/main/scala/de/nowchess/api/move/Move.scala``modules/api/src/main/scala/de/nowchess/api/bot/Bot.scala`, `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala`, `modules/api/src/main/scala/de/nowchess/api/rules/RuleSet.scala`, `modules/api/src/test/scala/de/nowchess/api/board/BoardTest.scala`, `modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala` +50 more
- `modules/api/bin/scoverage/de/nowchess/api/board/Color.scala``modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala`, `modules/api/bin/scoverage/de/nowchess/api/game/GameResult.scala`, `modules/api/bin/test/de/nowchess/api/game/GameContextTest.scala`, `modules/api/src/main/scala/de/nowchess/api/game/ClockState.scala`, `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala` +76 more - `modules/api/src/main/scala/de/nowchess/api/board/Color.scala``modules/api/src/main/scala/de/nowchess/api/game/ClockState.scala`, `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala`, `modules/api/src/main/scala/de/nowchess/api/game/GameResult.scala`, `modules/api/src/test/scala/de/nowchess/api/game/ClockStateTest.scala`, `modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala` +41 more
- `modules/rule/bin/scoverage/de/nowchess/rules/sets/DefaultRules.scala``modules/bot/bin/scoverage/de/nowchess/bot/bots/ClassicalBot.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/bots/HybridBot.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/bots/NNUEBot.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/logic/AlphaBetaSearch.scala`, `modules/bot/bin/test/de/nowchess/bot/AlphaBetaSearchTest.scala` +39 more - `modules/rule/src/main/scala/de/nowchess/rules/sets/DefaultRules.scala``modules/bot/src/main/scala/de/nowchess/bot/bots/ClassicalBot.scala`, `modules/bot/src/main/scala/de/nowchess/bot/bots/HybridBot.scala`, `modules/bot/src/main/scala/de/nowchess/bot/bots/NNUEBot.scala`, `modules/bot/src/main/scala/de/nowchess/bot/logic/AlphaBetaSearch.scala`, `modules/bot/src/test/scala/de/nowchess/bot/AlphaBetaSearchTest.scala` +23 more
- `modules/api/bin/scoverage/de/nowchess/api/board/Board.scala``modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala`, `modules/api/bin/test/de/nowchess/api/game/GameContextTest.scala`, `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala`, `modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NNUE.scala` +34 more - `modules/api/src/main/scala/de/nowchess/api/board/Board.scala``modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala`, `modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala`, `modules/bot/src/main/scala/de/nowchess/bot/bots/nnue/NNUE.scala`, `modules/bot/src/main/scala/de/nowchess/bot/logic/MoveOrdering.scala`, `modules/bot/src/test/scala/de/nowchess/bot/AlphaBetaSearchTest.scala` +15 more
- `modules/api/bin/scoverage/de/nowchess/api/board/Piece.scala``modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NNUE.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/logic/MoveOrdering.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/util/PolyglotHash.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/util/ZobristHash.scala`, `modules/bot/bin/test/de/nowchess/bot/AlphaBetaSearchTest.scala` +34 more - `modules/api/src/main/scala/de/nowchess/api/board/PieceType.scala``modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala`, `modules/bot/src/main/scala/de/nowchess/bot/bots/classic/EvaluationClassic.scala`, `modules/bot/src/main/scala/de/nowchess/bot/bots/nnue/NNUE.scala`, `modules/bot/src/main/scala/de/nowchess/bot/logic/AlphaBetaSearch.scala`, `modules/bot/src/main/scala/de/nowchess/bot/logic/MoveOrdering.scala` +15 more
- `modules/api/bin/scoverage/de/nowchess/api/board/PieceType.scala``modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala`, `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/bots/classic/EvaluationClassic.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NNUE.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/logic/AlphaBetaSearch.scala` +32 more - `modules/api/src/main/scala/de/nowchess/api/board/Piece.scala``modules/bot/src/main/scala/de/nowchess/bot/bots/nnue/NNUE.scala`, `modules/bot/src/main/scala/de/nowchess/bot/logic/MoveOrdering.scala`, `modules/bot/src/main/scala/de/nowchess/bot/util/PolyglotHash.scala`, `modules/bot/src/main/scala/de/nowchess/bot/util/ZobristHash.scala`, `modules/bot/src/test/scala/de/nowchess/bot/AlphaBetaSearchTest.scala` +15 more
- `modules/api/bin/scoverage/de/nowchess/api/game/DrawReason.scala``modules/api/bin/test/de/nowchess/api/game/GameContextTest.scala`, `modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala`, `modules/core/bin/scoverage/de/nowchess/chess/engine/GameEngine.scala`, `modules/core/bin/scoverage/de/nowchess/chess/observer/Observer.scala`, `modules/core/bin/scoverage/de/nowchess/chess/resource/GameResource.scala` +18 more - `modules/api/src/main/scala/de/nowchess/api/game/DrawReason.scala``modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala`, `modules/core/src/main/scala/de/nowchess/chess/config/NativeReflectionConfig.scala`, `modules/core/src/main/scala/de/nowchess/chess/engine/GameEngine.scala`, `modules/core/src/main/scala/de/nowchess/chess/grpc/CoreProtoMapper.scala`, `modules/core/src/main/scala/de/nowchess/chess/observer/Observer.scala` +13 more
- `modules/api/src/main/scala/de/nowchess/api/rules/RuleSet.scala``modules/bot/bin/scoverage/de/nowchess/bot/bots/ClassicalBot.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/bots/HybridBot.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/bots/NNUEBot.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/logic/AlphaBetaSearch.scala`, `modules/bot/bin/test/de/nowchess/bot/AlphaBetaSearchTest.scala` +18 more - `modules/api/src/main/scala/de/nowchess/api/game/GameResult.scala``modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala`, `modules/core/src/main/scala/de/nowchess/chess/config/NativeReflectionConfig.scala`, `modules/core/src/main/scala/de/nowchess/chess/engine/GameEngine.scala`, `modules/core/src/main/scala/de/nowchess/chess/grpc/CoreProtoMapper.scala`, `modules/core/src/main/scala/de/nowchess/chess/resource/GameDtoMapper.scala` +13 more
--- ---
+30 -30
View File
@@ -2,36 +2,36 @@
## Most Imported Files (change these carefully) ## Most Imported Files (change these carefully)
- `modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala` — imported by **138** files - `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala` — imported by **76** files
- `modules/api/bin/scoverage/de/nowchess/api/board/Square.scala` — imported by **99** files - `modules/api/src/main/scala/de/nowchess/api/board/Square.scala` — imported by **57** files
- `modules/api/bin/scoverage/de/nowchess/api/move/Move.scala` — imported by **97** files - `modules/api/src/main/scala/de/nowchess/api/move/Move.scala` — imported by **55** files
- `modules/api/bin/scoverage/de/nowchess/api/board/Color.scala` — imported by **81** files - `modules/api/src/main/scala/de/nowchess/api/board/Color.scala` — imported by **46** files
- `modules/rule/bin/scoverage/de/nowchess/rules/sets/DefaultRules.scala` — imported by **44** files - `modules/rule/src/main/scala/de/nowchess/rules/sets/DefaultRules.scala` — imported by **28** files
- `modules/api/bin/scoverage/de/nowchess/api/board/Board.scala` — imported by **39** files - `modules/api/src/main/scala/de/nowchess/api/board/Board.scala` — imported by **20** files
- `modules/api/bin/scoverage/de/nowchess/api/board/Piece.scala` — imported by **39** files - `modules/api/src/main/scala/de/nowchess/api/board/PieceType.scala` — imported by **20** files
- `modules/api/bin/scoverage/de/nowchess/api/board/PieceType.scala` — imported by **37** files - `modules/api/src/main/scala/de/nowchess/api/board/Piece.scala` — imported by **20** files
- `modules/api/bin/scoverage/de/nowchess/api/game/DrawReason.scala` — imported by **23** files - `modules/api/src/main/scala/de/nowchess/api/game/DrawReason.scala` — imported by **18** files
- `modules/api/src/main/scala/de/nowchess/api/rules/RuleSet.scala` — imported by **23** files - `modules/api/src/main/scala/de/nowchess/api/game/GameResult.scala` — imported by **18** files
- `modules/api/bin/scoverage/de/nowchess/api/board/CastlingRights.scala` — imported by **22** files - `modules/api/src/main/scala/de/nowchess/api/rules/RuleSet.scala` — imported by **14** files
- `modules/api/bin/scoverage/de/nowchess/api/game/GameResult.scala` — imported by **21** files - `modules/api/src/main/scala/de/nowchess/api/board/CastlingRights.scala` — imported by **13** files
- `modules/io/bin/scoverage/de/nowchess/io/fen/FenParser.scala` — imported by **20** files - `modules/io/src/main/scala/de/nowchess/io/fen/FenParser.scala` — imported by **11** files
- `modules/api/src/main/scala/de/nowchess/api/io/GameContextImport.scala` — imported by **15** files - `modules/api/src/main/scala/de/nowchess/api/player/PlayerInfo.scala` — imported by **9** files
- `modules/api/bin/scoverage/de/nowchess/api/player/PlayerInfo.scala` — imported by **14** files - `modules/api/src/main/scala/de/nowchess/api/error/GameError.scala` — imported by **9** files
- `modules/core/bin/scoverage/de/nowchess/chess/observer/Observer.scala` — imported by **13** files - `modules/core/src/main/scala/de/nowchess/chess/observer/Observer.scala` — imported by **9** files
- `modules/api/bin/scoverage/de/nowchess/api/bot/Bot.scala` — imported by **12** files - `modules/api/src/main/scala/de/nowchess/api/io/GameContextImport.scala` — imported by **8** files
- `modules/bot/bin/scoverage/de/nowchess/bot/ai/Evaluation.scala` — imported by **12** files - `modules/core/src/main/scala/de/nowchess/chess/grpc/IoGrpcClientWrapper.scala` — imported by **7** files
- `modules/bot/bin/scoverage/de/nowchess/bot/util/PolyglotBook.scala` — imported by **10** files - `modules/api/src/main/scala/de/nowchess/api/bot/Bot.scala` — imported by **6** files
- `modules/api/src/main/scala/de/nowchess/api/io/GameContextExport.scala` — imported by **10** files - `modules/bot/src/main/scala/de/nowchess/bot/ai/Evaluation.scala` — imported by **6** files
## Import Map (who imports what) ## Import Map (who imports what)
- `modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala` `modules/api/bin/scoverage/de/nowchess/api/bot/Bot.scala`, `modules/api/src/main/scala/de/nowchess/api/bot/Bot.scala`, `modules/api/src/main/scala/de/nowchess/api/io/GameContextExport.scala`, `modules/api/src/main/scala/de/nowchess/api/io/GameContextImport.scala`, `modules/api/src/main/scala/de/nowchess/api/rules/RuleSet.scala` +133 more - `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala``modules/api/src/main/scala/de/nowchess/api/bot/Bot.scala`, `modules/api/src/main/scala/de/nowchess/api/io/GameContextExport.scala`, `modules/api/src/main/scala/de/nowchess/api/io/GameContextImport.scala`, `modules/api/src/main/scala/de/nowchess/api/rules/RuleSet.scala`, `modules/bot/src/main/scala/de/nowchess/bot/BotMoveRepetition.scala` +71 more
- `modules/api/bin/scoverage/de/nowchess/api/board/Square.scala``modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala`, `modules/api/bin/scoverage/de/nowchess/api/move/Move.scala`, `modules/api/bin/test/de/nowchess/api/game/GameContextTest.scala`, `modules/api/bin/test/de/nowchess/api/move/MoveTest.scala`, `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala` +94 more - `modules/api/src/main/scala/de/nowchess/api/board/Square.scala``modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala`, `modules/api/src/main/scala/de/nowchess/api/move/Move.scala`, `modules/api/src/main/scala/de/nowchess/api/rules/RuleSet.scala`, `modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala`, `modules/api/src/test/scala/de/nowchess/api/move/MoveTest.scala` +52 more
- `modules/api/bin/scoverage/de/nowchess/api/move/Move.scala``modules/api/bin/scoverage/de/nowchess/api/bot/Bot.scala`, `modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala`, `modules/api/bin/test/de/nowchess/api/board/BoardTest.scala`, `modules/api/bin/test/de/nowchess/api/game/GameContextTest.scala`, `modules/api/src/main/scala/de/nowchess/api/bot/Bot.scala` +92 more - `modules/api/src/main/scala/de/nowchess/api/move/Move.scala``modules/api/src/main/scala/de/nowchess/api/bot/Bot.scala`, `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala`, `modules/api/src/main/scala/de/nowchess/api/rules/RuleSet.scala`, `modules/api/src/test/scala/de/nowchess/api/board/BoardTest.scala`, `modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala` +50 more
- `modules/api/bin/scoverage/de/nowchess/api/board/Color.scala``modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala`, `modules/api/bin/scoverage/de/nowchess/api/game/GameResult.scala`, `modules/api/bin/test/de/nowchess/api/game/GameContextTest.scala`, `modules/api/src/main/scala/de/nowchess/api/game/ClockState.scala`, `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala` +76 more - `modules/api/src/main/scala/de/nowchess/api/board/Color.scala``modules/api/src/main/scala/de/nowchess/api/game/ClockState.scala`, `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala`, `modules/api/src/main/scala/de/nowchess/api/game/GameResult.scala`, `modules/api/src/test/scala/de/nowchess/api/game/ClockStateTest.scala`, `modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala` +41 more
- `modules/rule/bin/scoverage/de/nowchess/rules/sets/DefaultRules.scala``modules/bot/bin/scoverage/de/nowchess/bot/bots/ClassicalBot.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/bots/HybridBot.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/bots/NNUEBot.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/logic/AlphaBetaSearch.scala`, `modules/bot/bin/test/de/nowchess/bot/AlphaBetaSearchTest.scala` +39 more - `modules/rule/src/main/scala/de/nowchess/rules/sets/DefaultRules.scala``modules/bot/src/main/scala/de/nowchess/bot/bots/ClassicalBot.scala`, `modules/bot/src/main/scala/de/nowchess/bot/bots/HybridBot.scala`, `modules/bot/src/main/scala/de/nowchess/bot/bots/NNUEBot.scala`, `modules/bot/src/main/scala/de/nowchess/bot/logic/AlphaBetaSearch.scala`, `modules/bot/src/test/scala/de/nowchess/bot/AlphaBetaSearchTest.scala` +23 more
- `modules/api/bin/scoverage/de/nowchess/api/board/Board.scala``modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala`, `modules/api/bin/test/de/nowchess/api/game/GameContextTest.scala`, `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala`, `modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NNUE.scala` +34 more - `modules/api/src/main/scala/de/nowchess/api/board/Board.scala``modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala`, `modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala`, `modules/bot/src/main/scala/de/nowchess/bot/bots/nnue/NNUE.scala`, `modules/bot/src/main/scala/de/nowchess/bot/logic/MoveOrdering.scala`, `modules/bot/src/test/scala/de/nowchess/bot/AlphaBetaSearchTest.scala` +15 more
- `modules/api/bin/scoverage/de/nowchess/api/board/Piece.scala``modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NNUE.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/logic/MoveOrdering.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/util/PolyglotHash.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/util/ZobristHash.scala`, `modules/bot/bin/test/de/nowchess/bot/AlphaBetaSearchTest.scala` +34 more - `modules/api/src/main/scala/de/nowchess/api/board/PieceType.scala``modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala`, `modules/bot/src/main/scala/de/nowchess/bot/bots/classic/EvaluationClassic.scala`, `modules/bot/src/main/scala/de/nowchess/bot/bots/nnue/NNUE.scala`, `modules/bot/src/main/scala/de/nowchess/bot/logic/AlphaBetaSearch.scala`, `modules/bot/src/main/scala/de/nowchess/bot/logic/MoveOrdering.scala` +15 more
- `modules/api/bin/scoverage/de/nowchess/api/board/PieceType.scala``modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala`, `modules/api/src/main/scala/de/nowchess/api/game/GameContext.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/bots/classic/EvaluationClassic.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NNUE.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/logic/AlphaBetaSearch.scala` +32 more - `modules/api/src/main/scala/de/nowchess/api/board/Piece.scala``modules/bot/src/main/scala/de/nowchess/bot/bots/nnue/NNUE.scala`, `modules/bot/src/main/scala/de/nowchess/bot/logic/MoveOrdering.scala`, `modules/bot/src/main/scala/de/nowchess/bot/util/PolyglotHash.scala`, `modules/bot/src/main/scala/de/nowchess/bot/util/ZobristHash.scala`, `modules/bot/src/test/scala/de/nowchess/bot/AlphaBetaSearchTest.scala` +15 more
- `modules/api/bin/scoverage/de/nowchess/api/game/DrawReason.scala``modules/api/bin/test/de/nowchess/api/game/GameContextTest.scala`, `modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala`, `modules/core/bin/scoverage/de/nowchess/chess/engine/GameEngine.scala`, `modules/core/bin/scoverage/de/nowchess/chess/observer/Observer.scala`, `modules/core/bin/scoverage/de/nowchess/chess/resource/GameResource.scala` +18 more - `modules/api/src/main/scala/de/nowchess/api/game/DrawReason.scala``modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala`, `modules/core/src/main/scala/de/nowchess/chess/config/NativeReflectionConfig.scala`, `modules/core/src/main/scala/de/nowchess/chess/engine/GameEngine.scala`, `modules/core/src/main/scala/de/nowchess/chess/grpc/CoreProtoMapper.scala`, `modules/core/src/main/scala/de/nowchess/chess/observer/Observer.scala` +13 more
- `modules/api/src/main/scala/de/nowchess/api/rules/RuleSet.scala``modules/bot/bin/scoverage/de/nowchess/bot/bots/ClassicalBot.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/bots/HybridBot.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/bots/NNUEBot.scala`, `modules/bot/bin/scoverage/de/nowchess/bot/logic/AlphaBetaSearch.scala`, `modules/bot/bin/test/de/nowchess/bot/AlphaBetaSearchTest.scala` +18 more - `modules/api/src/main/scala/de/nowchess/api/game/GameResult.scala``modules/api/src/test/scala/de/nowchess/api/game/GameContextTest.scala`, `modules/core/src/main/scala/de/nowchess/chess/config/NativeReflectionConfig.scala`, `modules/core/src/main/scala/de/nowchess/chess/engine/GameEngine.scala`, `modules/core/src/main/scala/de/nowchess/chess/grpc/CoreProtoMapper.scala`, `modules/core/src/main/scala/de/nowchess/chess/resource/GameDtoMapper.scala` +13 more
+182 -252
View File
@@ -19,7 +19,6 @@
- `modules/account/src/main/scala/de/nowchess/account/client/CoreGameClient.scala` — class CoreGameClient, function createGame - `modules/account/src/main/scala/de/nowchess/account/client/CoreGameClient.scala` — class CoreGameClient, function createGame
- `modules/account/src/main/scala/de/nowchess/account/config/JacksonConfig.scala` — class JacksonConfig, function customize - `modules/account/src/main/scala/de/nowchess/account/config/JacksonConfig.scala` — class JacksonConfig, function customize
- `modules/account/src/main/scala/de/nowchess/account/config/NativeReflectionConfig.scala` — class NativeReflectionConfig - `modules/account/src/main/scala/de/nowchess/account/config/NativeReflectionConfig.scala` — class NativeReflectionConfig
- `modules/account/src/main/scala/de/nowchess/account/domain/Account.scala` — class Account
- `modules/account/src/main/scala/de/nowchess/account/domain/Challenge.scala` - `modules/account/src/main/scala/de/nowchess/account/domain/Challenge.scala`
- class Challenge - class Challenge
- function gameIdOpt - function gameIdOpt
@@ -30,15 +29,22 @@
- `modules/account/src/main/scala/de/nowchess/account/domain/ChallengeStatusConverter.scala` — class ChallengeStatusConverter - `modules/account/src/main/scala/de/nowchess/account/domain/ChallengeStatusConverter.scala` — class ChallengeStatusConverter
- `modules/account/src/main/scala/de/nowchess/account/domain/DeclineReasonConverter.scala` — class DeclineReasonConverter - `modules/account/src/main/scala/de/nowchess/account/domain/DeclineReasonConverter.scala` — class DeclineReasonConverter
- `modules/account/src/main/scala/de/nowchess/account/domain/TimeControl.scala` — class TimeControl - `modules/account/src/main/scala/de/nowchess/account/domain/TimeControl.scala` — class TimeControl
- `modules/account/src/main/scala/de/nowchess/account/domain/UserAccount.scala`
- class UserAccount
- function getBotAccounts
- class BotAccount
- class OfficialBotAccount
- `modules/account/src/main/scala/de/nowchess/account/error/AccountError.scala` — function message - `modules/account/src/main/scala/de/nowchess/account/error/AccountError.scala` — function message
- `modules/account/src/main/scala/de/nowchess/account/error/ChallengeError.scala` — function message - `modules/account/src/main/scala/de/nowchess/account/error/ChallengeError.scala` — function message
- `modules/account/src/main/scala/de/nowchess/account/filter/AlreadyLoggedInFilter.scala` — class AlreadyLoggedInFilter
- `modules/account/src/main/scala/de/nowchess/account/repository/AccountRepository.scala` - `modules/account/src/main/scala/de/nowchess/account/repository/AccountRepository.scala`
- class AccountRepository - class UserAccountRepository
- function findByUsername - function findByUsername
- function findById - function findById
- function persist - function persist
- function findByEmail - function findByEmail
- function findAll - function findAll
- _...12 more_
- `modules/account/src/main/scala/de/nowchess/account/repository/ChallengeRepository.scala` - `modules/account/src/main/scala/de/nowchess/account/repository/ChallengeRepository.scala`
- class ChallengeRepository - class ChallengeRepository
- function findActiveByChallengerId - function findActiveByChallengerId
@@ -53,6 +59,8 @@
- function login - function login
- function me - function me
- function publicProfile - function publicProfile
- function banUser
- _...10 more_
- `modules/account/src/main/scala/de/nowchess/account/resource/ChallengeResource.scala` - `modules/account/src/main/scala/de/nowchess/account/resource/ChallengeResource.scala`
- class ChallengeResource - class ChallengeResource
- function create - function create
@@ -66,6 +74,8 @@
- function login - function login
- function findByUsername - function findByUsername
- function findById - function findById
- function createBotAccount
- _...11 more_
- `modules/account/src/main/scala/de/nowchess/account/service/ChallengeService.scala` - `modules/account/src/main/scala/de/nowchess/account/service/ChallengeService.scala`
- class ChallengeService - class ChallengeService
- function create - function create
@@ -74,48 +84,6 @@
- function cancel - function cancel
- function listForUser - function listForUser
- _...1 more_ - _...1 more_
- `modules/api/bin/scoverage/de/nowchess/api/board/Board.scala`
- class Board
- function apply
- function pieceAt
- function updated
- function removed
- function withMove
- _...2 more_
- `modules/api/bin/scoverage/de/nowchess/api/board/CastlingRights.scala`
- function hasAnyRights
- function hasRights
- function revokeColor
- function revokeKingSide
- function revokeQueenSide
- class CastlingRights
- `modules/api/bin/scoverage/de/nowchess/api/board/Color.scala` — function opposite, function label
- `modules/api/bin/scoverage/de/nowchess/api/board/Piece.scala` — class Piece
- `modules/api/bin/scoverage/de/nowchess/api/board/PieceType.scala` — function label
- `modules/api/bin/scoverage/de/nowchess/api/board/Square.scala`
- class Square
- function fromAlgebraic
- function offset
- `modules/api/bin/scoverage/de/nowchess/api/bot/Bot.scala`
- class Bot
- function name
- function nextMove
- `modules/api/bin/scoverage/de/nowchess/api/dto/ErrorEventDto.scala` — class ErrorEventDto, function apply
- `modules/api/bin/scoverage/de/nowchess/api/dto/GameFullEventDto.scala` — class GameFullEventDto, function apply
- `modules/api/bin/scoverage/de/nowchess/api/dto/GameStateEventDto.scala` — class GameStateEventDto, function apply
- `modules/api/bin/scoverage/de/nowchess/api/game/GameContext.scala`
- function kingSquare
- function withBoard
- function withTurn
- function withCastlingRights
- function withEnPassantSquare
- function withHalfMoveClock
- _...4 more_
- `modules/api/bin/scoverage/de/nowchess/api/player/PlayerInfo.scala` — class PlayerId, function apply
- `modules/api/bin/scoverage/de/nowchess/api/response/ApiResponse.scala`
- class ApiResponse
- function error
- function totalPages
- `modules/api/src/main/scala/de/nowchess/api/board/Board.scala` - `modules/api/src/main/scala/de/nowchess/api/board/Board.scala`
- class Board - class Board
- function apply - function apply
@@ -176,76 +144,7 @@
- function allLegalMoves - function allLegalMoves
- function isCheck - function isCheck
- function isCheckmate - function isCheckmate
- _...5 more_ - _...6 more_
- `modules/bot/bin/scoverage/de/nowchess/bot/BotController.scala`
- class BotController
- function getBot
- function listBots
- `modules/bot/bin/scoverage/de/nowchess/bot/BotMoveRepetition.scala`
- class BotMoveRepetition
- function blockedMoves
- function repeatedMove
- function filterAllowed
- `modules/bot/bin/scoverage/de/nowchess/bot/Config.scala` — class Config
- `modules/bot/bin/scoverage/de/nowchess/bot/ai/Evaluation.scala`
- class Evaluation
- class CHECKMATE_SCORE
- class DRAW_SCORE
- function evaluate
- function initAccumulator
- function copyAccumulator
- _...2 more_
- `modules/bot/bin/scoverage/de/nowchess/bot/bots/classic/EvaluationClassic.scala`
- class EvaluationClassic
- function evaluate
- function countRay
- `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/EvaluationNNUE.scala` — class EvaluationNNUE, function evaluate
- `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NNUE.scala`
- class NNUE
- function initAccumulator
- function pushAccumulator
- function copyAccumulator
- function recomputeAccumulator
- function validateAccumulator
- _...4 more_
- `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NbaiLoader.scala`
- class NbaiLoader
- function load
- function loadDefault
- `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NbaiMigrator.scala` — class NbaiMigrator, function migrateFromBin
- `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NbaiModel.scala`
- function toJson
- class NbaiMetadata
- function fromJson
- function str
- function num
- `modules/bot/bin/scoverage/de/nowchess/bot/bots/nnue/NbaiWriter.scala` — class NbaiWriter, function write
- `modules/bot/bin/scoverage/de/nowchess/bot/logic/AlphaBetaSearch.scala`
- function bestMove
- function bestMove
- function bestMoveWithTime
- function bestMoveWithTime
- function loop
- function loop
- `modules/bot/bin/scoverage/de/nowchess/bot/logic/MoveOrdering.scala`
- class MoveOrdering
- class OrderingContext
- function addKillerMove
- function getKillerMoves
- function addHistory
- function getHistory
- _...3 more_
- `modules/bot/bin/scoverage/de/nowchess/bot/logic/TranspositionTable.scala`
- function advance
- function probe
- function store
- function clear
- `modules/bot/bin/scoverage/de/nowchess/bot/util/PolyglotBook.scala` — function probe, function select
- `modules/bot/bin/scoverage/de/nowchess/bot/util/PolyglotHash.scala` — class PolyglotHash, function hash
- `modules/bot/bin/scoverage/de/nowchess/bot/util/ZobristHash.scala`
- class ZobristHash
- function hash
- function nextHash
- `modules/bot/python/nnue.py` - `modules/bot/python/nnue.py`
- function get_weights_dir: () - function get_weights_dir: ()
- function get_data_dir: () - function get_data_dir: ()
@@ -350,63 +249,65 @@
- class ZobristHash - class ZobristHash
- function hash - function hash
- function nextHash - function nextHash
- `modules/core/bin/scoverage/de/nowchess/chess/command/Command.scala` - `modules/coordinator/src/main/scala/de/nowchess/coordinator/CoordinatorApp.scala` — class CoordinatorApp
- class Command - `modules/coordinator/src/main/scala/de/nowchess/coordinator/config/BeansProducer.scala`
- function execute - class BeansProducer
- function undo - function redissonClient
- function description - function kubernetesClient
- class MoveResult - `modules/coordinator/src/main/scala/de/nowchess/coordinator/config/CoordinatorConfig.scala`
- `modules/core/bin/scoverage/de/nowchess/chess/command/CommandInvoker.scala` - class CoordinatorConfig
- class CommandInvoker - function maxGamesPerCore
- function execute - function maxDeviationPercent
- function undo - function rebalanceInterval
- function redo - function rebalanceMinInterval
- function history - function heartbeatTtl
- function getCurrentIndex - _...11 more_
- _...3 more_ - `modules/coordinator/src/main/scala/de/nowchess/coordinator/grpc/CoordinatorGrpcServer.scala` — class CoordinatorGrpcServer
- `modules/core/bin/scoverage/de/nowchess/chess/config/JacksonConfig.scala` — class JacksonConfig, function customize - `modules/coordinator/src/main/scala/de/nowchess/coordinator/grpc/CoreGrpcClient.scala`
- `modules/core/bin/scoverage/de/nowchess/chess/controller/Parser.scala` — class Parser, function parseMove - class CoreGrpcClient
- `modules/core/bin/scoverage/de/nowchess/chess/engine/GameEngine.scala` - function shutdown
- class GameEngine - function batchResubscribeGames
- function board - function unsubscribeGames
- function turn - function evictGames
- function context - `modules/coordinator/src/main/scala/de/nowchess/coordinator/resource/CoordinatorResource.scala`
- function pendingDrawOfferBy - class CoordinatorResource
- function canUndo - function listInstances
- _...17 more_ - function getMetrics
- `modules/core/bin/scoverage/de/nowchess/chess/exception/ApiException.scala` - function triggerRebalance
- class ApiException - function triggerFailover
- class GameNotFoundException - function triggerScaleUp
- class BadRequestException
- `modules/core/bin/scoverage/de/nowchess/chess/exception/ApiExceptionMapper.scala` — class ApiExceptionMapper, function toResponse
- `modules/core/bin/scoverage/de/nowchess/chess/observer/Observer.scala`
- function context
- class Observer
- function onGameEvent
- class Observable
- function subscribe
- function unsubscribe
- _...1 more_ - _...1 more_
- `modules/core/bin/scoverage/de/nowchess/chess/registry/GameRegistry.scala` - `modules/coordinator/src/main/scala/de/nowchess/coordinator/service/AutoScaler.scala`
- class GameRegistry - class AutoScaler
- function store - function checkAndScale
- function get - function scaleUp
- function update - function scaleDown
- function generateId - `modules/coordinator/src/main/scala/de/nowchess/coordinator/service/CacheEvictionManager.scala`
- `modules/core/bin/scoverage/de/nowchess/chess/registry/GameRegistryImpl.scala` - class CacheEvictionManager
- class GameRegistryImpl - function setRedisPrefix
- function store - function evictStaleGames
- function get - `modules/coordinator/src/main/scala/de/nowchess/coordinator/service/FailoverService.scala`
- function update - class FailoverService
- function generateId - function setRedisPrefix
- `modules/core/bin/scoverage/de/nowchess/chess/resource/GameResource.scala` - function onInstanceStreamDropped
- class GameResource - `modules/coordinator/src/main/scala/de/nowchess/coordinator/service/HealthMonitor.scala`
- function onGameEvent - class HealthMonitor
- function createGame - function setRedisPrefix
- function getGame - function checkInstanceHealth
- function streamGame - function watchK8sPods
- function onGameEvent - `modules/coordinator/src/main/scala/de/nowchess/coordinator/service/InstanceRegistry.scala`
- _...10 more_ - class InstanceRegistry
- function setRedisPrefix
- function getInstance
- function getAllInstances
- function updateInstanceFromRedis
- function markInstanceDead
- _...1 more_
- `modules/coordinator/src/main/scala/de/nowchess/coordinator/service/LoadBalancer.scala`
- class LoadBalancer
- function setRedisPrefix
- function shouldRebalance
- function rebalance
- `modules/core/src/main/scala/de/nowchess/chess/adapter/RuleSetRestAdapter.scala` - `modules/core/src/main/scala/de/nowchess/chess/adapter/RuleSetRestAdapter.scala`
- class RuleSetRestAdapter - class RuleSetRestAdapter
- function candidateMoves - function candidateMoves
@@ -421,6 +322,7 @@
- function importPgn - function importPgn
- function exportFen - function exportFen
- function exportPgn - function exportPgn
- function exportCombined
- `modules/core/src/main/scala/de/nowchess/chess/client/RuleServiceClient.scala` - `modules/core/src/main/scala/de/nowchess/chess/client/RuleServiceClient.scala`
- class RuleServiceClient - class RuleServiceClient
- function candidateMoves - function candidateMoves
@@ -428,23 +330,15 @@
- function allLegalMoves - function allLegalMoves
- function isCheck - function isCheck
- function isCheckmate - function isCheckmate
- _...5 more_ - _...6 more_
- `modules/core/src/main/scala/de/nowchess/chess/command/Command.scala` - `modules/core/src/main/scala/de/nowchess/chess/client/StoreServiceClient.scala` — class StoreServiceClient, function getGame
- class Command
- function execute
- function undo
- function description
- class MoveResult
- `modules/core/src/main/scala/de/nowchess/chess/command/CommandInvoker.scala`
- class CommandInvoker
- function execute
- function undo
- function redo
- function history
- function getCurrentIndex
- _...3 more_
- `modules/core/src/main/scala/de/nowchess/chess/config/JacksonConfig.scala` — class JacksonConfig, function customize - `modules/core/src/main/scala/de/nowchess/chess/config/JacksonConfig.scala` — class JacksonConfig, function customize
- `modules/core/src/main/scala/de/nowchess/chess/config/NativeReflectionConfig.scala` — class NativeReflectionConfig - `modules/core/src/main/scala/de/nowchess/chess/config/NativeReflectionConfig.scala` — class NativeReflectionConfig
- `modules/core/src/main/scala/de/nowchess/chess/config/RedisConfig.scala` — class RedisConfig
- `modules/core/src/main/scala/de/nowchess/chess/config/RedissonProducer.scala`
- class RedissonProducer
- function produceRedissonClient
- function shutdown
- `modules/core/src/main/scala/de/nowchess/chess/controller/Parser.scala` — class Parser, function parseMove - `modules/core/src/main/scala/de/nowchess/chess/controller/Parser.scala` — class Parser, function parseMove
- `modules/core/src/main/scala/de/nowchess/chess/engine/GameEngine.scala` - `modules/core/src/main/scala/de/nowchess/chess/engine/GameEngine.scala`
- class GameEngine - class GameEngine
@@ -453,12 +347,36 @@
- function context - function context
- function pendingDrawOfferBy - function pendingDrawOfferBy
- function currentClockState - function currentClockState
- _...18 more_ - _...22 more_
- `modules/core/src/main/scala/de/nowchess/chess/exception/ApiException.scala` - `modules/core/src/main/scala/de/nowchess/chess/exception/ApiException.scala`
- class ApiException - class ApiException
- class GameNotFoundException - class GameNotFoundException
- class BadRequestException - class BadRequestException
- `modules/core/src/main/scala/de/nowchess/chess/exception/ApiExceptionMapper.scala` — class ApiExceptionMapper, function toResponse - `modules/core/src/main/scala/de/nowchess/chess/exception/ApiExceptionMapper.scala` — class ApiExceptionMapper, function toResponse
- `modules/core/src/main/scala/de/nowchess/chess/grpc/CoordinatorServiceHandler.scala` — class CoordinatorServiceHandler
- `modules/core/src/main/scala/de/nowchess/chess/grpc/CoreProtoMapper.scala`
- class CoreProtoMapper
- function toProtoColor
- function fromProtoColor
- function toProtoPieceType
- function fromProtoPieceType
- function toProtoMoveKind
- _...9 more_
- `modules/core/src/main/scala/de/nowchess/chess/grpc/IoGrpcClientWrapper.scala`
- class IoGrpcClientWrapper
- function exportCombined
- function importFen
- function importPgn
- function exportFen
- function exportPgn
- `modules/core/src/main/scala/de/nowchess/chess/grpc/RuleSetGrpcAdapter.scala`
- class RuleSetGrpcAdapter
- function candidateMoves
- function legalMoves
- function allLegalMoves
- function isCheck
- function isCheckmate
- _...5 more_
- `modules/core/src/main/scala/de/nowchess/chess/observer/Observer.scala` - `modules/core/src/main/scala/de/nowchess/chess/observer/Observer.scala`
- function context - function context
- class Observer - class Observer
@@ -467,18 +385,36 @@
- function subscribe - function subscribe
- function unsubscribe - function unsubscribe
- _...1 more_ - _...1 more_
- `modules/core/src/main/scala/de/nowchess/chess/redis/C2sMessage.scala` — class C2sMessage
- `modules/core/src/main/scala/de/nowchess/chess/redis/GameRedisPublisher.scala` — class GameRedisPublisher, function onGameEvent
- `modules/core/src/main/scala/de/nowchess/chess/redis/GameRedisSubscriberManager.scala`
- class GameRedisSubscriberManager
- function subscribeGame
- function onMessage
- function unsubscribeGame
- function batchResubscribeGames
- function unsubscribeGames
- _...3 more_
- `modules/core/src/main/scala/de/nowchess/chess/registry/GameRegistry.scala` - `modules/core/src/main/scala/de/nowchess/chess/registry/GameRegistry.scala`
- class GameRegistry - class GameRegistry
- function store - function store
- function get - function get
- function update - function update
- function generateId - function generateId
- `modules/core/src/main/scala/de/nowchess/chess/registry/GameRegistryImpl.scala` - `modules/core/src/main/scala/de/nowchess/chess/registry/RedisGameRegistry.scala`
- class GameRegistryImpl - class RedisGameRegistry
- function generateId
- function store - function store
- function get - function get
- function update - function update
- function generateId - `modules/core/src/main/scala/de/nowchess/chess/resource/GameDtoMapper.scala`
- class GameDtoMapper
- function statusOf
- function moveToUci
- function toPlayerDto
- function toClockDto
- function toGameStateDto
- _...1 more_
- `modules/core/src/main/scala/de/nowchess/chess/resource/GameResource.scala` - `modules/core/src/main/scala/de/nowchess/chess/resource/GameResource.scala`
- class GameResource - class GameResource
- function onGameEvent - function onGameEvent
@@ -486,54 +422,15 @@
- function getGame - function getGame
- function resignGame - function resignGame
- function makeMove - function makeMove
- _...8 more_ - _...9 more_
- `modules/core/src/main/scala/de/nowchess/chess/resource/GameWebSocketResource.scala` - `modules/core/src/main/scala/de/nowchess/chess/service/InstanceHeartbeatService.scala`
- class GameWebSocketResource - class InstanceHeartbeatService
- function onOpen - function onStart
- function onGameEvent - function onShutdown
- function onClose - function setRedisPrefix
- `modules/io/bin/scoverage/de/nowchess/io/GameContextExport.scala` — class GameContextExport, function exportGameContext - function setSubscriptionCount
- `modules/io/bin/scoverage/de/nowchess/io/GameContextImport.scala` — class GameContextImport, function importGameContext - function setLocalCacheSize
- `modules/io/bin/scoverage/de/nowchess/io/GameFileService.scala` - _...2 more_
- class GameFileService
- function saveGameToFile
- function loadGameFromFile
- class FileSystemGameService
- function saveGameToFile
- function loadGameFromFile
- `modules/io/bin/scoverage/de/nowchess/io/fen/FenExporter.scala`
- class FenExporter
- function boardToFen
- function gameContextToFen
- function exportGameContext
- `modules/io/bin/scoverage/de/nowchess/io/fen/FenParser.scala`
- class FenParser
- function parseFen
- function importGameContext
- function parseBoard
- `modules/io/bin/scoverage/de/nowchess/io/fen/FenParserCombinators.scala`
- class FenParserCombinators
- function parseFen
- function parseBoard
- function importGameContext
- `modules/io/bin/scoverage/de/nowchess/io/fen/FenParserFastParse.scala`
- class FenParserFastParse
- function parseFen
- function parseBoard
- function importGameContext
- `modules/io/bin/scoverage/de/nowchess/io/fen/FenParserSupport.scala` — function buildSquares
- `modules/io/bin/scoverage/de/nowchess/io/json/JsonExporter.scala` — class JsonExporter, function exportGameContext
- `modules/io/bin/scoverage/de/nowchess/io/json/JsonParser.scala` — class JsonParser, function importGameContext
- `modules/io/bin/scoverage/de/nowchess/io/pgn/PgnExporter.scala`
- class PgnExporter
- function exportGameContext
- function exportGame
- `modules/io/bin/scoverage/de/nowchess/io/pgn/PgnParser.scala`
- class PgnParser
- function validatePgn
- function importGameContext
- function parsePgn
- function parseAlgebraicMove
- `modules/io/src/main/scala/de/nowchess/io/GameFileService.scala` - `modules/io/src/main/scala/de/nowchess/io/GameFileService.scala`
- class GameFileService - class GameFileService
- function saveGameToFile - function saveGameToFile
@@ -562,6 +459,15 @@
- function parseBoard - function parseBoard
- function importGameContext - function importGameContext
- `modules/io/src/main/scala/de/nowchess/io/fen/FenParserSupport.scala` — function buildSquares - `modules/io/src/main/scala/de/nowchess/io/fen/FenParserSupport.scala` — function buildSquares
- `modules/io/src/main/scala/de/nowchess/io/grpc/IoGrpcService.scala` — class IoGrpcService
- `modules/io/src/main/scala/de/nowchess/io/grpc/IoProtoMapper.scala`
- class IoProtoMapper
- function toProtoColor
- function fromProtoColor
- function toProtoPieceType
- function fromProtoPieceType
- function toProtoMoveKind
- _...9 more_
- `modules/io/src/main/scala/de/nowchess/io/json/JsonExporter.scala` — class JsonExporter, function exportGameContext - `modules/io/src/main/scala/de/nowchess/io/json/JsonExporter.scala` — class JsonExporter, function exportGameContext
- `modules/io/src/main/scala/de/nowchess/io/json/JsonParser.scala` — class JsonParser, function importGameContext - `modules/io/src/main/scala/de/nowchess/io/json/JsonParser.scala` — class JsonParser, function importGameContext
- `modules/io/src/main/scala/de/nowchess/io/pgn/PgnExporter.scala` - `modules/io/src/main/scala/de/nowchess/io/pgn/PgnExporter.scala`
@@ -582,6 +488,7 @@
- function importPgn - function importPgn
- function exportFen - function exportFen
- function exportPgn - function exportPgn
- function exportCombined
- `modules/json/src/main/scala/de/nowchess/json/ChessJacksonModule.scala` — class ChessJacksonModule - `modules/json/src/main/scala/de/nowchess/json/ChessJacksonModule.scala` — class ChessJacksonModule
- `modules/json/src/main/scala/de/nowchess/json/GameResultDeserializer.scala` — class GameResultDeserializer - `modules/json/src/main/scala/de/nowchess/json/GameResultDeserializer.scala` — class GameResultDeserializer
- `modules/json/src/main/scala/de/nowchess/json/GameResultSerializer.scala` — class GameResultSerializer - `modules/json/src/main/scala/de/nowchess/json/GameResultSerializer.scala` — class GameResultSerializer
@@ -591,22 +498,17 @@
- `modules/json/src/main/scala/de/nowchess/json/SquareKeyDeserializer.scala` — class SquareKeyDeserializer - `modules/json/src/main/scala/de/nowchess/json/SquareKeyDeserializer.scala` — class SquareKeyDeserializer
- `modules/json/src/main/scala/de/nowchess/json/SquareKeySerializer.scala` — class SquareKeySerializer - `modules/json/src/main/scala/de/nowchess/json/SquareKeySerializer.scala` — class SquareKeySerializer
- `modules/json/src/main/scala/de/nowchess/json/SquareSerializer.scala` — class SquareSerializer - `modules/json/src/main/scala/de/nowchess/json/SquareSerializer.scala` — class SquareSerializer
- `modules/rule/bin/scoverage/de/nowchess/rules/RuleSet.scala`
- class RuleSet
- function candidateMoves
- function legalMoves
- function allLegalMoves
- function isCheck
- function isCheckmate
- _...5 more_
- `modules/rule/bin/scoverage/de/nowchess/rules/sets/DefaultRules.scala`
- class DefaultRules
- function positionOf
- function loop
- function toMoves
- function loop
- `modules/rule/src/main/scala/de/nowchess/rules/config/JacksonConfig.scala` — class JacksonConfig, function customize - `modules/rule/src/main/scala/de/nowchess/rules/config/JacksonConfig.scala` — class JacksonConfig, function customize
- `modules/rule/src/main/scala/de/nowchess/rules/config/NativeReflectionConfig.scala` — class NativeReflectionConfig - `modules/rule/src/main/scala/de/nowchess/rules/config/NativeReflectionConfig.scala` — class NativeReflectionConfig
- `modules/rule/src/main/scala/de/nowchess/rules/grpc/ProtoMapper.scala`
- class ProtoMapper
- function toProtoColor
- function fromProtoColor
- function toProtoPieceType
- function fromProtoPieceType
- function toProtoMoveKind
- _...9 more_
- `modules/rule/src/main/scala/de/nowchess/rules/grpc/RuleGrpcService.scala` — class RuleGrpcService
- `modules/rule/src/main/scala/de/nowchess/rules/resource/RuleSetResource.scala` - `modules/rule/src/main/scala/de/nowchess/rules/resource/RuleSetResource.scala`
- class RuleSetResource - class RuleSetResource
- function candidateMoves - function candidateMoves
@@ -614,5 +516,33 @@
- function allLegalMoves - function allLegalMoves
- function isCheck - function isCheck
- function isCheckmate - function isCheckmate
- _...5 more_ - _...6 more_
- `modules/rule/src/main/scala/de/nowchess/rules/sets/DefaultRules.scala` — class DefaultRules, function positionOf - `modules/rule/src/main/scala/de/nowchess/rules/sets/DefaultRules.scala` — class DefaultRules, function positionOf
- `modules/store/src/main/scala/de/nowchess/store/config/RedisConfig.scala` — class RedisConfig
- `modules/store/src/main/scala/de/nowchess/store/config/RedissonProducer.scala`
- class RedissonProducer
- function redissonClient
- function close
- `modules/store/src/main/scala/de/nowchess/store/domain/GameRecord.scala` — class GameRecord
- `modules/store/src/main/scala/de/nowchess/store/redis/GameWritebackStreamListener.scala`
- class GameWritebackStreamListener
- function startListening
- function onMessage
- `modules/store/src/main/scala/de/nowchess/store/repository/GameRecordRepository.scala`
- class GameRecordRepository
- function findByGameId
- function persist
- function merge
- `modules/store/src/main/scala/de/nowchess/store/resource/StoreGameResource.scala` — class StoreGameResource, function getGame
- `modules/store/src/main/scala/de/nowchess/store/service/GameWritebackService.scala` — class GameWritebackService, function writeBack
- `modules/ws/src/main/scala/de/nowchess/ws/config/RedisConfig.scala` — class RedisConfig
- `modules/ws/src/main/scala/de/nowchess/ws/config/RedissonProducer.scala`
- class RedissonProducer
- function produceRedissonClient
- function shutdown
- `modules/ws/src/main/scala/de/nowchess/ws/resource/GameWebSocketResource.scala`
- class GameWebSocketResource
- function onOpen
- function onMessage
- function onTextMessage
- function onClose
+44
View File
@@ -0,0 +1,44 @@
# Routes
## gRPC
- `/CoordinatorService/BatchResubscribeGames` (BatchResubscribeRequest) → BatchResubscribeResponse
- `/CoordinatorService/UnsubscribeGames` (UnsubscribeGamesRequest) → UnsubscribeGamesResponse
- `/CoordinatorService/EvictGames` (EvictGamesRequest) → EvictGamesResponse
- `/CoordinatorService/DrainInstance` (DrainInstanceRequest) → DrainInstanceResponse
- `/CoordinatorService/BatchResubscribeGames` (BatchResubscribeRequest) → BatchResubscribeResponse
- `/CoordinatorService/UnsubscribeGames` (UnsubscribeGamesRequest) → UnsubscribeGamesResponse
- `/CoordinatorService/EvictGames` (EvictGamesRequest) → EvictGamesResponse
- `/CoordinatorService/DrainInstance` (DrainInstanceRequest) → DrainInstanceResponse
- `/IoService/ImportFen` (ProtoImportFenRequest) → ProtoGameContext
- `/IoService/ImportPgn` (ProtoImportPgnRequest) → ProtoGameContext
- `/IoService/ExportCombined` (ProtoGameContext) → ProtoCombinedExport
- `/IoService/ExportFen` (ProtoGameContext) → ProtoStringResult
- `/IoService/ExportPgn` (ProtoGameContext) → ProtoStringResult
- `/RuleService/CandidateMoves` (ProtoSquareRequest) → ProtoMoveList
- `/RuleService/LegalMoves` (ProtoSquareRequest) → ProtoMoveList
- `/RuleService/AllLegalMoves` (ProtoGameContext) → ProtoMoveList
- `/RuleService/IsCheck` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsCheckmate` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsStalemate` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsInsufficientMaterial` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsFiftyMoveRule` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsThreefoldRepetition` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/ApplyMove` (ProtoMoveRequest) → ProtoGameContext
- `/RuleService/PostMoveStatus` (ProtoGameContext) → ProtoPostMoveStatus
- `/IoService/ImportFen` (ProtoImportFenRequest) → ProtoGameContext
- `/IoService/ImportPgn` (ProtoImportPgnRequest) → ProtoGameContext
- `/IoService/ExportCombined` (ProtoGameContext) → ProtoCombinedExport
- `/IoService/ExportFen` (ProtoGameContext) → ProtoStringResult
- `/IoService/ExportPgn` (ProtoGameContext) → ProtoStringResult
- `/RuleService/CandidateMoves` (ProtoSquareRequest) → ProtoMoveList
- `/RuleService/LegalMoves` (ProtoSquareRequest) → ProtoMoveList
- `/RuleService/AllLegalMoves` (ProtoGameContext) → ProtoMoveList
- `/RuleService/IsCheck` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsCheckmate` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsStalemate` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsInsufficientMaterial` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsFiftyMoveRule` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/IsThreefoldRepetition` (ProtoGameContext) → ProtoBoolResult
- `/RuleService/ApplyMove` (ProtoMoveRequest) → ProtoGameContext
- `/RuleService/PostMoveStatus` (ProtoGameContext) → ProtoPostMoveStatus
@@ -0,0 +1,27 @@
{
"reflection": [
{ "type": "scala.Tuple1[]" },
{ "type": "scala.Tuple2[]" },
{ "type": "scala.Tuple3[]" },
{ "type": "scala.Tuple4[]" },
{ "type": "scala.Tuple5[]" },
{ "type": "scala.Tuple6[]" },
{ "type": "scala.Tuple7[]" },
{ "type": "scala.Tuple8[]" },
{ "type": "scala.Tuple9[]" },
{ "type": "scala.Tuple10[]" },
{ "type": "scala.Tuple11[]" },
{ "type": "scala.Tuple12[]" },
{ "type": "scala.Tuple13[]" },
{ "type": "scala.Tuple14[]" },
{ "type": "scala.Tuple15[]" },
{ "type": "scala.Tuple16[]" },
{ "type": "scala.Tuple17[]" },
{ "type": "scala.Tuple18[]" },
{ "type": "scala.Tuple19[]" },
{ "type": "scala.Tuple20[]" },
{ "type": "scala.Tuple21[]" },
{ "type": "scala.Tuple22[]" },
{ "type": "com.fasterxml.jackson.module.scala.introspect.PropertyDescriptor[]" }
]
}
+3
View File
@@ -63,12 +63,15 @@ dependencies {
implementation(enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")) implementation(enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}"))
implementation("io.quarkus:quarkus-rest") implementation("io.quarkus:quarkus-rest")
implementation("io.quarkus:quarkus-rest-jackson")
implementation("io.quarkus:quarkus-grpc") implementation("io.quarkus:quarkus-grpc")
implementation("io.quarkus:quarkus-arc") implementation("io.quarkus:quarkus-arc")
implementation("io.quarkus:quarkus-config-yaml") implementation("io.quarkus:quarkus-config-yaml")
implementation("io.quarkus:quarkus-smallrye-health") implementation("io.quarkus:quarkus-smallrye-health")
implementation("io.quarkus:quarkus-smallrye-openapi")
implementation("io.quarkus:quarkus-rest-client") implementation("io.quarkus:quarkus-rest-client")
implementation("io.quarkus:quarkus-rest-client-jackson") implementation("io.quarkus:quarkus-rest-client-jackson")
implementation("com.fasterxml.jackson.module:jackson-module-scala_3:${versions["JACKSON_SCALA"]!!}")
implementation("org.redisson:redisson:${versions["REDISSON"]!!}") implementation("org.redisson:redisson:${versions["REDISSON"]!!}")
implementation("io.fabric8:kubernetes-client:6.13.0") implementation("io.fabric8:kubernetes-client:6.13.0")
@@ -0,0 +1,27 @@
{
"reflection": [
{ "type": "scala.Tuple1[]" },
{ "type": "scala.Tuple2[]" },
{ "type": "scala.Tuple3[]" },
{ "type": "scala.Tuple4[]" },
{ "type": "scala.Tuple5[]" },
{ "type": "scala.Tuple6[]" },
{ "type": "scala.Tuple7[]" },
{ "type": "scala.Tuple8[]" },
{ "type": "scala.Tuple9[]" },
{ "type": "scala.Tuple10[]" },
{ "type": "scala.Tuple11[]" },
{ "type": "scala.Tuple12[]" },
{ "type": "scala.Tuple13[]" },
{ "type": "scala.Tuple14[]" },
{ "type": "scala.Tuple15[]" },
{ "type": "scala.Tuple16[]" },
{ "type": "scala.Tuple17[]" },
{ "type": "scala.Tuple18[]" },
{ "type": "scala.Tuple19[]" },
{ "type": "scala.Tuple20[]" },
{ "type": "scala.Tuple21[]" },
{ "type": "scala.Tuple22[]" },
{ "type": "com.fasterxml.jackson.module.scala.introspect.PropertyDescriptor[]" }
]
}
@@ -1,10 +1,22 @@
quarkus: quarkus:
application.name: nowchess-coordinator application:
http.port: 8086 name: nowchess-coordinator
grpc.server.port: 9086 http:
config.yaml.enabled: true port: 8086
rest-client.connection-timeout: 5000 grpc:
rest-client.read-timeout: 10000 server:
port: 9086
rest-client:
connection-timeout: 5000
read-timeout: 10000
smallrye-openapi:
info-title: NowChess Coordinator Service
info-version: 1.0.0
info-description: Coordination endpoints for instance health, balancing, failover, and scaling
path: /openapi
swagger-ui:
always-include: true
path: /swagger-ui
nowchess: nowchess:
redis: redis:
@@ -18,7 +30,7 @@ nowchess:
rebalance-interval: 30s rebalance-interval: 30s
rebalance-min-interval: 60s rebalance-min-interval: 60s
heartbeat-ttl: 5s heartbeat-ttl: 5s
stream-heartbeat-interval: 200ms stream-heartbeat-interval: PT0.2S
cache-eviction-interval: 10m cache-eviction-interval: 10m
game-idle-threshold: 45m game-idle-threshold: 45m
auto-scale-enabled: false auto-scale-enabled: false
@@ -34,6 +46,5 @@ nowchess:
# dev profile # dev profile
"%dev": "%dev":
quarkus: quarkus:
log.level: DEBUG log:
log.category: level: DEBUG
"de.nowchess": DEBUG
@@ -5,51 +5,51 @@ import io.smallrye.config.WithName
import java.time.Duration import java.time.Duration
@ConfigMapping(prefix = "nowchess.coordinator") @ConfigMapping(prefix = "nowchess.coordinator")
class CoordinatorConfig: trait CoordinatorConfig:
@WithName("max-games-per-core") @WithName("max-games-per-core")
def maxGamesPerCore: Int = ??? def maxGamesPerCore: Int
@WithName("max-deviation-percent") @WithName("max-deviation-percent")
def maxDeviationPercent: Int = ??? def maxDeviationPercent: Int
@WithName("rebalance-interval") @WithName("rebalance-interval")
def rebalanceInterval: Duration = ??? def rebalanceInterval: Duration
@WithName("rebalance-min-interval") @WithName("rebalance-min-interval")
def rebalanceMinInterval: Duration = ??? def rebalanceMinInterval: Duration
@WithName("heartbeat-ttl") @WithName("heartbeat-ttl")
def heartbeatTtl: Duration = ??? def heartbeatTtl: Duration
@WithName("stream-heartbeat-interval") @WithName("stream-heartbeat-interval")
def streamHeartbeatInterval: Duration = ??? def streamHeartbeatInterval: Duration
@WithName("cache-eviction-interval") @WithName("cache-eviction-interval")
def cacheEvictionInterval: Duration = ??? def cacheEvictionInterval: Duration
@WithName("game-idle-threshold") @WithName("game-idle-threshold")
def gameIdleThreshold: Duration = ??? def gameIdleThreshold: Duration
@WithName("auto-scale-enabled") @WithName("auto-scale-enabled")
def autoScaleEnabled: Boolean = ??? def autoScaleEnabled: Boolean
@WithName("scale-up-threshold") @WithName("scale-up-threshold")
def scaleUpThreshold: Double = ??? def scaleUpThreshold: Double
@WithName("scale-down-threshold") @WithName("scale-down-threshold")
def scaleDownThreshold: Double = ??? def scaleDownThreshold: Double
@WithName("scale-min-replicas") @WithName("scale-min-replicas")
def scaleMinReplicas: Int = ??? def scaleMinReplicas: Int
@WithName("scale-max-replicas") @WithName("scale-max-replicas")
def scaleMaxReplicas: Int = ??? def scaleMaxReplicas: Int
@WithName("k8s-namespace") @WithName("k8s-namespace")
def k8sNamespace: String = ??? def k8sNamespace: String
@WithName("k8s-rollout-name") @WithName("k8s-rollout-name")
def k8sRolloutName: String = ??? def k8sRolloutName: String
@WithName("k8s-rollout-label-selector") @WithName("k8s-rollout-label-selector")
def k8sRolloutLabelSelector: String = ??? def k8sRolloutLabelSelector: String
@@ -0,0 +1,18 @@
package de.nowchess.coordinator.config
import com.fasterxml.jackson.core.Version
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import io.quarkus.jackson.ObjectMapperCustomizer
import jakarta.inject.Singleton
@Singleton
class JacksonConfig extends ObjectMapperCustomizer:
def customize(mapper: ObjectMapper): Unit =
mapper.registerModule(new DefaultScalaModule() {
override def version(): Version =
// scalafix:off DisableSyntax.null
new Version(2, 21, 1, null, "com.fasterxml.jackson.module", "jackson-module-scala")
// scalafix:on DisableSyntax.null
})
@@ -0,0 +1,14 @@
package de.nowchess.coordinator.config
import de.nowchess.coordinator.dto.InstanceMetadata
import de.nowchess.coordinator.resource.MetricsDto
import io.quarkus.runtime.annotations.RegisterForReflection
@RegisterForReflection(
targets = Array(
classOf[InstanceMetadata],
classOf[MetricsDto],
),
)
class NativeReflectionConfig
@@ -24,6 +24,7 @@ nowchess:
prefix: nowchess prefix: nowchess
coordinator: coordinator:
enabled: ${NOWCHESS_COORDINATOR_ENABLED:false}
host: localhost host: localhost
grpc-port: 9086 grpc-port: 9086
stream-heartbeat-interval: 200ms stream-heartbeat-interval: 200ms
@@ -99,6 +100,7 @@ nowchess:
prefix: ${REDIS_PREFIX:nowchess} prefix: ${REDIS_PREFIX:nowchess}
coordinator: coordinator:
enabled: ${NOWCHESS_COORDINATOR_ENABLED:true}
host: ${COORDINATOR_SERVICE_HOST:localhost} host: ${COORDINATOR_SERVICE_HOST:localhost}
grpc-port: ${COORDINATOR_SERVICE_GRPC_PORT:9086} grpc-port: ${COORDINATOR_SERVICE_GRPC_PORT:9086}
stream-heartbeat-interval: 200ms stream-heartbeat-interval: 200ms
@@ -4,5 +4,5 @@ sealed trait C2sMessage
object C2sMessage: object C2sMessage:
case object Connected extends C2sMessage case object Connected extends C2sMessage
case class Move(uci: String) extends C2sMessage case class Move(uci: String, playerId: Option[String] = None) extends C2sMessage
case object Ping extends C2sMessage case object Ping extends C2sMessage
@@ -1,7 +1,9 @@
package de.nowchess.chess.redis package de.nowchess.chess.redis
import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.ObjectMapper
import de.nowchess.api.board.Color
import de.nowchess.api.dto.GameFullEventDto import de.nowchess.api.dto.GameFullEventDto
import de.nowchess.api.game.GameMode
import de.nowchess.chess.config.RedisConfig import de.nowchess.chess.config.RedisConfig
import de.nowchess.chess.grpc.IoGrpcClientWrapper import de.nowchess.chess.grpc.IoGrpcClientWrapper
import de.nowchess.chess.observer.Observer import de.nowchess.chess.observer.Observer
@@ -83,7 +85,7 @@ class GameRedisSubscriberManager:
private def handleC2sMessage(gameId: String, msg: String): Unit = private def handleC2sMessage(gameId: String, msg: String): Unit =
parseC2sMessage(msg) match parseC2sMessage(msg) match
case Some(C2sMessage.Connected) => handleConnected(gameId) case Some(C2sMessage.Connected) => handleConnected(gameId)
case Some(C2sMessage.Move(uci)) => handleMove(gameId, uci) case Some(C2sMessage.Move(uci, playerId)) => handleMove(gameId, uci, playerId)
case Some(C2sMessage.Ping) => () case Some(C2sMessage.Ping) => ()
case None => () case None => ()
@@ -94,16 +96,30 @@ class GameRedisSubscriberManager:
redisson.getTopic(s2cTopicName(gameId)).publish(json) redisson.getTopic(s2cTopicName(gameId)).publish(json)
} }
private def handleMove(gameId: String, uci: String): Unit = private def handleMove(gameId: String, uci: String, playerId: Option[String]): Unit =
registry.get(gameId).foreach { entry => registry.get(gameId).foreach { entry =>
entry.engine.processUserInput(uci) entry.mode match
case GameMode.Open => entry.engine.processUserInput(uci)
case GameMode.Authenticated =>
playerId match
case None => ()
case Some(pid) =>
val turn = entry.engine.context.turn
val authorised =
(entry.white.id.value == pid && turn == Color.White) ||
(entry.black.id.value == pid && turn == Color.Black)
if authorised then entry.engine.processUserInput(uci)
} }
private def parseC2sMessage(msg: String): Option[C2sMessage] = private def parseC2sMessage(msg: String): Option[C2sMessage] =
Try(objectMapper.readTree(msg)).toOption.flatMap { node => Try(objectMapper.readTree(msg)).toOption.flatMap { node =>
Option(node.get("type")).map(_.asText()).flatMap { Option(node.get("type")).map(_.asText()).flatMap {
case "CONNECTED" => Some(C2sMessage.Connected) case "CONNECTED" => Some(C2sMessage.Connected)
case "MOVE" => Option(node.get("uci")).map(u => C2sMessage.Move(u.asText())) case "MOVE" =>
Option(node.get("uci")).map { u =>
val pid = Option(node.get("playerId")).map(_.asText()).filter(_.nonEmpty)
C2sMessage.Move(u.asText(), pid)
}
case "PING" => Some(C2sMessage.Ping) case "PING" => Some(C2sMessage.Ping)
case _ => None case _ => None
} }
@@ -33,6 +33,9 @@ class InstanceHeartbeatService:
@ConfigProperty(name = "quarkus.grpc.server.port", defaultValue = "9000") @ConfigProperty(name = "quarkus.grpc.server.port", defaultValue = "9000")
private var grpcPort: Int = 0 private var grpcPort: Int = 0
@ConfigProperty(name = "nowchess.coordinator.enabled", defaultValue = "true")
private var coordinatorEnabled: Boolean = true
private var coordinatorStub: CoordinatorServiceStub = uninitialized private var coordinatorStub: CoordinatorServiceStub = uninitialized
private val log = Logger.getLogger(classOf[InstanceHeartbeatService]) private val log = Logger.getLogger(classOf[InstanceHeartbeatService])
@@ -45,20 +48,36 @@ class InstanceHeartbeatService:
private var redisHeartbeatExecutor = Executors.newScheduledThreadPool(1) private var redisHeartbeatExecutor = Executors.newScheduledThreadPool(1)
private var subscriptionCount = 0 private var subscriptionCount = 0
private var localCacheSize = 0 private var localCacheSize = 0
private var serviceActive = false
private var shuttingDown = false
def onStart(@Observes event: StartupEvent): Unit = def onStart(@Observes event: StartupEvent): Unit =
if !coordinatorEnabled then
log.info("Coordinator support disabled via config; skipping heartbeat service startup")
return
try try
shuttingDown = false
generateInstanceId() generateInstanceId()
initializeHeartbeatStream() initializeHeartbeatStream()
scheduleHeartbeats() scheduleHeartbeats()
serviceActive = true
log.infof("Instance heartbeat service started with ID: %s", instanceId) log.infof("Instance heartbeat service started with ID: %s", instanceId)
catch catch
case ex: Exception => case ex: Exception =>
serviceActive = false
log.errorf(ex, "Failed to start instance heartbeat service") log.errorf(ex, "Failed to start instance heartbeat service")
def onShutdown(@Observes event: ShutdownEvent): Unit = def onShutdown(@Observes event: ShutdownEvent): Unit =
shuttingDown = true
if !serviceActive then
log.info("Instance heartbeat service stopped")
return
try try
cleanup() cleanup()
serviceActive = false
log.info("Instance heartbeat service stopped") log.info("Instance heartbeat service stopped")
catch catch
case ex: Exception => case ex: Exception =>
@@ -74,12 +93,16 @@ class InstanceHeartbeatService:
localCacheSize = count localCacheSize = count
def addGameSubscription(gameId: String): Unit = def addGameSubscription(gameId: String): Unit =
if !coordinatorEnabled then return
val setKey = s"$redisPrefix:instance:$instanceId:games" val setKey = s"$redisPrefix:instance:$instanceId:games"
val gameSet = redissonClient.getSet[String](setKey) val gameSet = redissonClient.getSet[String](setKey)
gameSet.add(gameId) gameSet.add(gameId)
subscriptionCount += 1 subscriptionCount += 1
def removeGameSubscription(gameId: String): Unit = def removeGameSubscription(gameId: String): Unit =
if !coordinatorEnabled then return
val setKey = s"$redisPrefix:instance:$instanceId:games" val setKey = s"$redisPrefix:instance:$instanceId:games"
val gameSet = redissonClient.getSet[String](setKey) val gameSet = redissonClient.getSet[String](setKey)
gameSet.remove(gameId) gameSet.remove(gameId)
@@ -103,6 +126,7 @@ class InstanceHeartbeatService:
override def onError(t: Throwable): Unit = override def onError(t: Throwable): Unit =
log.warnf(t, "Heartbeat stream error") log.warnf(t, "Heartbeat stream error")
streamObserver = None streamObserver = None
if !shuttingDown then
heartbeatExecutor.schedule((() => initializeHeartbeatStream()): Runnable, 5, TimeUnit.SECONDS) heartbeatExecutor.schedule((() => initializeHeartbeatStream()): Runnable, 5, TimeUnit.SECONDS)
override def onCompleted: Unit = override def onCompleted: Unit =
@@ -182,6 +206,7 @@ class InstanceHeartbeatService:
streamObserver.foreach(_.onCompleted()) streamObserver.foreach(_.onCompleted())
streamObserver = None streamObserver = None
if instanceId.nonEmpty then
val key = s"$redisPrefix:instances:$instanceId" val key = s"$redisPrefix:instances:$instanceId"
redissonClient.getBucket[String](key).delete() redissonClient.getBucket[String](key).delete()
@@ -12,6 +12,8 @@ quarkus:
url: http://localhost:8085 url: http://localhost:8085
nowchess: nowchess:
coordinator:
enabled: false
redis: redis:
host: localhost host: localhost
port: 6379 port: 6379
@@ -0,0 +1,17 @@
package de.nowchess.chess.config
import jakarta.annotation.Priority
import jakarta.enterprise.context.ApplicationScoped
import jakarta.enterprise.inject.Alternative
import jakarta.enterprise.inject.Produces
import org.mockito.Mockito
import org.redisson.api.RedissonClient
@Alternative
@Priority(1)
@ApplicationScoped
class MockRedissonProducer:
@Produces
@ApplicationScoped
def produceRedissonClient(): RedissonClient =
Mockito.mock(classOf[RedissonClient], Mockito.RETURNS_DEEP_STUBS)
@@ -0,0 +1,27 @@
{
"reflection": [
{ "type": "scala.Tuple1[]" },
{ "type": "scala.Tuple2[]" },
{ "type": "scala.Tuple3[]" },
{ "type": "scala.Tuple4[]" },
{ "type": "scala.Tuple5[]" },
{ "type": "scala.Tuple6[]" },
{ "type": "scala.Tuple7[]" },
{ "type": "scala.Tuple8[]" },
{ "type": "scala.Tuple9[]" },
{ "type": "scala.Tuple10[]" },
{ "type": "scala.Tuple11[]" },
{ "type": "scala.Tuple12[]" },
{ "type": "scala.Tuple13[]" },
{ "type": "scala.Tuple14[]" },
{ "type": "scala.Tuple15[]" },
{ "type": "scala.Tuple16[]" },
{ "type": "scala.Tuple17[]" },
{ "type": "scala.Tuple18[]" },
{ "type": "scala.Tuple19[]" },
{ "type": "scala.Tuple20[]" },
{ "type": "scala.Tuple21[]" },
{ "type": "scala.Tuple22[]" },
{ "type": "com.fasterxml.jackson.module.scala.introspect.PropertyDescriptor[]" }
]
}
@@ -0,0 +1,18 @@
package de.nowchess.store.config
import com.fasterxml.jackson.core.Version
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import io.quarkus.jackson.ObjectMapperCustomizer
import jakarta.inject.Singleton
@Singleton
class JacksonConfig extends ObjectMapperCustomizer:
def customize(mapper: ObjectMapper): Unit =
mapper.registerModule(new DefaultScalaModule() {
override def version(): Version =
// scalafix:off DisableSyntax.null
new Version(2, 21, 1, null, "com.fasterxml.jackson.module", "jackson-module-scala")
// scalafix:on DisableSyntax.null
})
@@ -0,0 +1,14 @@
package de.nowchess.store.config
import de.nowchess.store.domain.GameRecord
import de.nowchess.store.redis.GameWritebackEventDto
import io.quarkus.runtime.annotations.RegisterForReflection
@RegisterForReflection(
targets = Array(
classOf[GameRecord],
classOf[GameWritebackEventDto],
),
)
class NativeReflectionConfig
+3
View File
@@ -48,9 +48,12 @@ dependencies {
implementation(enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")) implementation(enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}"))
implementation("io.quarkus:quarkus-websockets-next") implementation("io.quarkus:quarkus-websockets-next")
implementation("io.quarkus:quarkus-jackson")
implementation("io.quarkus:quarkus-arc") implementation("io.quarkus:quarkus-arc")
implementation("io.quarkus:quarkus-smallrye-jwt")
implementation("io.quarkus:quarkus-config-yaml") implementation("io.quarkus:quarkus-config-yaml")
implementation("io.quarkus:quarkus-smallrye-health") implementation("io.quarkus:quarkus-smallrye-health")
implementation("com.fasterxml.jackson.module:jackson-module-scala_3:${versions["JACKSON_SCALA"]!!}")
implementation("org.redisson:redisson:${versions["REDISSON"]!!}") implementation("org.redisson:redisson:${versions["REDISSON"]!!}")
testImplementation(platform("org.junit:junit-bom:${versions["JUNIT_BOM"]!!}")) testImplementation(platform("org.junit:junit-bom:${versions["JUNIT_BOM"]!!}"))
@@ -3,6 +3,9 @@ quarkus:
port: 8084 port: 8084
application: application:
name: nowchess-ws name: nowchess-ws
swagger-ui:
always-include: true
path: /swagger-ui
grpc: grpc:
server: server:
use-separate-server: false use-separate-server: false
@@ -19,6 +22,12 @@ nowchess:
host: localhost host: localhost
port: 6379 port: 6379
prefix: nowchess prefix: nowchess
mp:
jwt:
verify:
publickey:
location: keys/public.pem
issuer: nowchess
"%deployed": "%deployed":
nowchess: nowchess:
@@ -26,3 +35,9 @@ nowchess:
host: ${REDIS_HOST} host: ${REDIS_HOST}
port: ${REDIS_PORT:6379} port: ${REDIS_PORT:6379}
prefix: ${REDIS_PREFIX:nowchess} prefix: ${REDIS_PREFIX:nowchess}
mp:
jwt:
verify:
publickey:
location: ${JWT_PUBLIC_KEY_PATH:keys/public.pem}
issuer: nowchess
@@ -0,0 +1,9 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxDsnsCAl0vQx7Vu9CLDZ
g0SG05NgUzu9T+3DTEaHGq60T2uriO8BenwyvsF3BnDqTbKf4voohZ1DNfzdbT1J
Fj8B62FrDmxcO+sp1/b5HUCJP6y2uSRCmzOHe5k7Pk1IEi72FgBpKXSRkFibRlVf
634g7mgsPZAQ9PJEsv4Qvm05T9L6+Gmq6N3bMVLKRXs4RhDhaFbYH9GtUg1eI0yH
YjGyRfqzW/nqVMstOLHt8CuPouq4p7eMzeDH3YHkxPm4GG5foCXMOd2DZrW0SCcr
7dhFeNVWzQ2m53eOhBzNQX+v3pgjVStsePhBRt2LyGfwkNzmqDgqWsMzSHRMY+cn
WQIDAQAB
-----END PUBLIC KEY-----
@@ -0,0 +1,18 @@
package de.nowchess.ws.config
import com.fasterxml.jackson.core.Version
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import io.quarkus.jackson.ObjectMapperCustomizer
import jakarta.inject.Singleton
@Singleton
class JacksonConfig extends ObjectMapperCustomizer:
def customize(mapper: ObjectMapper): Unit =
mapper.registerModule(new DefaultScalaModule() {
override def version(): Version =
// scalafix:off DisableSyntax.null
new Version(2, 21, 1, null, "com.fasterxml.jackson.module", "jackson-module-scala")
// scalafix:on DisableSyntax.null
})
@@ -0,0 +1,12 @@
package de.nowchess.ws.config
import de.nowchess.ws.resource.ConnectionMeta
import io.quarkus.runtime.annotations.RegisterForReflection
@RegisterForReflection(
targets = Array(
classOf[ConnectionMeta],
),
)
class NativeReflectionConfig
@@ -0,0 +1,7 @@
package de.nowchess.ws.resource
final case class ConnectionMeta(
gameId: String,
listenerId: Int,
playerId: Option[String],
)
@@ -2,10 +2,13 @@ package de.nowchess.ws.resource
import de.nowchess.ws.config.RedisConfig import de.nowchess.ws.config.RedisConfig
import io.quarkus.websockets.next.* import io.quarkus.websockets.next.*
import io.smallrye.jwt.auth.principal.JWTParser
import jakarta.inject.Inject import jakarta.inject.Inject
import org.redisson.api.listener.MessageListener import org.redisson.api.listener.MessageListener
import org.redisson.api.RedissonClient import org.redisson.api.RedissonClient
import scala.compiletime.uninitialized import scala.compiletime.uninitialized
import scala.util.Try
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
@WebSocket(path = "/api/board/game/{gameId}/ws") @WebSocket(path = "/api/board/game/{gameId}/ws")
@@ -17,9 +20,12 @@ class GameWebSocketResource:
@Inject @Inject
var redisConfig: RedisConfig = uninitialized var redisConfig: RedisConfig = uninitialized
@Inject
var jwtParser: JWTParser = uninitialized
// scalafix:on DisableSyntax.var // scalafix:on DisableSyntax.var
private val listenerIds = new ConcurrentHashMap[String, (String, Int)]() private val connections = new ConcurrentHashMap[String, ConnectionMeta]()
private def s2cTopic(gameId: String): String = private def s2cTopic(gameId: String): String =
s"${redisConfig.prefix}:game:$gameId:s2c" s"${redisConfig.prefix}:game:$gameId:s2c"
@@ -28,8 +34,12 @@ class GameWebSocketResource:
s"${redisConfig.prefix}:game:$gameId:c2s" s"${redisConfig.prefix}:game:$gameId:c2s"
@OnOpen @OnOpen
def onOpen(connection: WebSocketConnection): Unit = def onOpen(connection: WebSocketConnection, handshake: HandshakeRequest): Unit =
val gameId = connection.pathParam("gameId") val gameId = connection.pathParam("gameId")
val playerId = Option(handshake.header("Authorization"))
.filter(_.nonEmpty)
.flatMap(token => Try(jwtParser.parse(token)).toOption)
.map(_.getSubject)
val topic = redisson.getTopic(s2cTopic(gameId)) val topic = redisson.getTopic(s2cTopic(gameId))
val listenerId = topic.addListener( val listenerId = topic.addListener(
classOf[String], classOf[String],
@@ -37,18 +47,28 @@ class GameWebSocketResource:
def onMessage(channel: CharSequence, msg: String): Unit = def onMessage(channel: CharSequence, msg: String): Unit =
connection.sendText(msg).subscribe().`with`(_ => (), _ => ()), connection.sendText(msg).subscribe().`with`(_ => (), _ => ()),
) )
listenerIds.put(connection.id(), (gameId, listenerId)) connections.put(connection.id(), ConnectionMeta(gameId, listenerId, playerId))
val connectedMsg = s"""{"type":"CONNECTED","gameId":"$gameId"}""" val connectedMsg = playerId match
case Some(pid) => s"""{"type":"CONNECTED","gameId":"$gameId","playerId":"$pid"}"""
case None => s"""{"type":"CONNECTED","gameId":"$gameId"}"""
redisson.getTopic(c2sTopic(gameId)).publish(connectedMsg) redisson.getTopic(c2sTopic(gameId)).publish(connectedMsg)
@OnTextMessage @OnTextMessage
def onTextMessage(connection: WebSocketConnection, message: String): Unit = def onTextMessage(connection: WebSocketConnection, message: String): Unit =
Option(listenerIds.get(connection.id())).foreach { case (gameId, _) => Option(connections.get(connection.id())).foreach { meta =>
redisson.getTopic(c2sTopic(gameId)).publish(message) val enriched = meta.playerId match
case Some(pid) => injectPlayerId(message, pid)
case None => message
redisson.getTopic(c2sTopic(meta.gameId)).publish(enriched)
} }
@OnClose @OnClose
def onClose(connection: WebSocketConnection): Unit = def onClose(connection: WebSocketConnection): Unit =
Option(listenerIds.remove(connection.id())).foreach { case (gameId, listenerId) => Option(connections.remove(connection.id())).foreach { meta =>
redisson.getTopic(s2cTopic(gameId)).removeListener(listenerId) redisson.getTopic(s2cTopic(meta.gameId)).removeListener(meta.listenerId)
} }
private def injectPlayerId(msg: String, pid: String): String =
val trimmed = msg.trim
if trimmed.endsWith("}") then trimmed.dropRight(1) + s""","playerId":"$pid"}"""
else msg