From 3977fe64a5f2bf47d132c71f75389c1a752147c4 Mon Sep 17 00:00:00 2001 From: averak Date: Tue, 16 Jan 2024 16:39:08 +0900 Subject: [PATCH 01/15] =?UTF-8?q?refs=20#91=20PR=E3=83=9E=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E5=BE=8C=E3=81=ABDocker=E3=82=A4=E3=83=A1=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=82=92GHCR=E3=81=ABpush=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 39 +++++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4afb034 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +name: Build + +on: + push: + branches: + - master + - develop + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v3 + + - name: login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + + - name: determine git tag + id: git_describe + run: | + TAG=$(git describe --tags --abbrev=1) + echo "::set-output name=tag::$TAG" + + - name: build docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ghcr.io/${{ github.repository }}:latest + ghcr.io/${{ github.repository }}:${{ steps.git_describe.outputs.tag }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf4516e..7fe8455 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: - uses: actions/checkout@v3 - name: build docker image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: context: . push: false From 97c65e1b7fac2984b72601da467648fd845712fc Mon Sep 17 00:00:00 2001 From: averak Date: Tue, 16 Jan 2024 16:42:30 +0900 Subject: [PATCH 02/15] =?UTF-8?q?Revert=20"PR=E3=83=9E=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E5=BE=8C=E3=81=ABDocker=E3=82=A4=E3=83=A1=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=82=92GHCR=E3=81=ABpush=E3=81=99=E3=82=8B"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 39 ------------------------------------- .github/workflows/ci.yml | 2 +- 2 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 4afb034..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Build - -on: - push: - branches: - - master - - develop - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - uses: actions/checkout@v3 - - - name: login to GHCR - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ github.token }} - - - name: determine git tag - id: git_describe - run: | - TAG=$(git describe --tags --abbrev=1) - echo "::set-output name=tag::$TAG" - - - name: build docker image - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: | - ghcr.io/${{ github.repository }}:latest - ghcr.io/${{ github.repository }}:${{ steps.git_describe.outputs.tag }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fe8455..bf4516e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: - uses: actions/checkout@v3 - name: build docker image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v3 with: context: . push: false From 4a41792c69c83941774331ba57b60a4c4176f3ef Mon Sep 17 00:00:00 2001 From: averak Date: Wed, 17 Jan 2024 08:52:53 +0900 Subject: [PATCH 03/15] =?UTF-8?q?refs=20#94=20=E3=83=9E=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E6=99=82=E3=81=ABDocker=E3=82=A4=E3=83=A1=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=82=92=E3=83=93=E3=83=AB=E3=83=89=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 43 +++++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 12 +++++------ 2 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e1c1624 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,43 @@ +name: Build + +on: + release: + types: + - created + +jobs: + docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + + - name: determine docker tag + id: docker_tag + uses: actions/github-script@v7 + with: + result-encoding: string + script: | + const tagExec = await exec.getExecOutput('git', ['describe', '--tags', '--abbrev=0']); + return tagExec.stdout || tagExec.stderr; + + - name: build docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ghcr.io/${{ github.repository }}:latest + ghcr.io/${{ github.repository }}:${{ steps.docker_tag.outputs.result }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf4516e..ffaa672 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: distribution: corretto java-version: 17 @@ -50,8 +50,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: corretto java-version: 17 @@ -65,10 +65,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: build docker image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: context: . push: false From 14d24b8f21a5364c4d9623e3cae02bc4a87c66bc Mon Sep 17 00:00:00 2001 From: averak Date: Wed, 17 Jan 2024 09:04:45 +0900 Subject: [PATCH 04/15] wip --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e1c1624..7081ecf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,10 @@ on: release: types: - created + pull_request: + branches: + - master + - develop jobs: docker: From 3eda7afcc669696fea5f746d851406739579a04c Mon Sep 17 00:00:00 2001 From: averak Date: Wed, 17 Jan 2024 09:08:41 +0900 Subject: [PATCH 05/15] =?UTF-8?q?refs=20#94=20=E3=83=AA=E3=83=AA=E3=83=BC?= =?UTF-8?q?=E3=82=B9=E6=99=82=E3=81=AE=E3=81=BFDocker=E3=82=A4=E3=83=A1?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=82=92push=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7081ecf..e1c1624 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,10 +4,6 @@ on: release: types: - created - pull_request: - branches: - - master - - develop jobs: docker: From d5ed0d03896c2dd7e668ab42bff664466bc793af Mon Sep 17 00:00:00 2001 From: averak Date: Wed, 17 Jan 2024 16:24:13 +0900 Subject: [PATCH 06/15] =?UTF-8?q?refs=20#100=20gRPC=E3=81=AE=E3=82=A2?= =?UTF-8?q?=E3=82=AF=E3=82=BB=E3=82=B9=E3=83=AD=E3=82=B0=E3=82=92=E5=87=BA?= =?UTF-8?q?=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin_api/GlobalRestControllerAdvice.kt | 2 +- .../admin_api/HealthCheckController.kt | 2 +- .../{HttpRequestScope.kt => RequestScope.kt} | 2 +- .../interceptor/AccessLogInterceptor.kt | 4 +- .../interceptor/ClientVersionInterceptor.kt | 4 +- .../interceptor/GameContextInterceptor.kt | 4 +- .../adapter/handler/player_api/EchoHandler.kt | 2 +- .../player_api/PlayerStorageHandler.kt | 2 +- .../interceptor/AccessLogInterceptor.kt | 75 +++++++++++++++++++ ...ptor.kt => IncomingMetadataInterceptor.kt} | 24 +++--- .../IncomingHeaderKey.kt} | 4 +- .../player_api/mdval/OutgoingTrailerKey.kt | 6 ++ .../handler/player_api/mdval/RequestScope.kt | 30 ++++++++ .../scope/GrpcMetadataNotFoundException.kt | 3 - .../handler/player_api/scope/RequestScope.kt | 32 -------- .../scope/RequestScopeAttributes.kt | 12 --- .../net/averak/gsync/core/logger/Logger.kt | 8 +- build.gradle.kts | 1 + gradle/libs.versions.toml | 1 + src/test/resources/logback-test.xml | 2 +- .../gsync/testkit/api/grpc/GrpcTester.kt | 16 ++-- .../gsync/testkit/api/rest/RequestBuilder.kt | 12 +-- 22 files changed, 159 insertions(+), 89 deletions(-) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/{HttpRequestScope.kt => RequestScope.kt} (99%) create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/AccessLogInterceptor.kt rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/{MetadataInterceptor.kt => IncomingMetadataInterceptor.kt} (64%) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/{scope/IncomingMD.kt => mdval/IncomingHeaderKey.kt} (79%) create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/mdval/OutgoingTrailerKey.kt create mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/mdval/RequestScope.kt delete mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/GrpcMetadataNotFoundException.kt delete mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScope.kt delete mode 100644 app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScopeAttributes.kt diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/GlobalRestControllerAdvice.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/GlobalRestControllerAdvice.kt index 1ee09f9..ad14c8f 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/GlobalRestControllerAdvice.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/GlobalRestControllerAdvice.kt @@ -16,7 +16,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExcep @RestControllerAdvice class GlobalRestControllerAdvice( private val customLogger: Logger, - private val requestScope: HttpRequestScope, + private val requestScope: RequestScope, ) : ResponseEntityExceptionHandler() { @RequestMapping("/**") diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/HealthCheckController.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/HealthCheckController.kt index 49b03b8..e1a7715 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/HealthCheckController.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/HealthCheckController.kt @@ -13,7 +13,7 @@ import java.time.LocalDateTime @RestController @RequestMapping(path = ["/api/health"], produces = [MediaType.APPLICATION_JSON_VALUE]) class HealthCheckController( - private val requestScope: HttpRequestScope, + private val requestScope: RequestScope, private val echoUsecase: EchoUsecase, ) { diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/HttpRequestScope.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/RequestScope.kt similarity index 99% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/HttpRequestScope.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/RequestScope.kt index 9962b95..cd5e8db 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/HttpRequestScope.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/RequestScope.kt @@ -10,7 +10,7 @@ import java.time.format.DateTimeFormatter import java.util.* @Component -class HttpRequestScope( +class RequestScope( private val config: Config, private val httpServletRequest: HttpServletRequest, ) { diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/AccessLogInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/AccessLogInterceptor.kt index 77d2f98..9d6f1e9 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/AccessLogInterceptor.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/AccessLogInterceptor.kt @@ -2,7 +2,7 @@ package net.averak.gsync.adapter.handler.admin_api.interceptor import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletResponse -import net.averak.gsync.adapter.handler.admin_api.HttpRequestScope +import net.averak.gsync.adapter.handler.admin_api.RequestScope import net.averak.gsync.core.logger.Logger import org.springframework.http.HttpStatusCode import org.springframework.stereotype.Component @@ -16,7 +16,7 @@ import java.time.LocalDateTime @Component class AccessLogInterceptor( private val logger: Logger, - private val requestScope: HttpRequestScope, + private val requestScope: RequestScope, ) : IRequestInterceptor { override fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean { diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor.kt index 4214f2a..d5ff1ab 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor.kt @@ -5,7 +5,7 @@ import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletResponse import net.averak.gsync.adapter.dao.dto.base.RequiredClientVersionExample import net.averak.gsync.adapter.dao.mapper.base.RequiredClientVersionBaseMapper -import net.averak.gsync.adapter.handler.admin_api.HttpRequestScope +import net.averak.gsync.adapter.handler.admin_api.RequestScope import net.averak.gsync.core.exception.ErrorCode import net.averak.gsync.core.exception.GsyncException import net.averak.gsync.domain.model.Platform @@ -15,7 +15,7 @@ import java.util.* @Component open class ClientVersionInterceptor( - private val requestScope: HttpRequestScope, + private val requestScope: RequestScope, private val requiredClientVersionBaseMapper: RequiredClientVersionBaseMapper, ) : IRequestInterceptor { diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt index a0a85cb..df57d5a 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt @@ -2,7 +2,7 @@ package net.averak.gsync.adapter.handler.admin_api.interceptor import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletResponse -import net.averak.gsync.adapter.handler.admin_api.HttpRequestScope +import net.averak.gsync.adapter.handler.admin_api.RequestScope import net.averak.gsync.adapter.handler.utils.MasterVersionUtils import net.averak.gsync.core.daterange.Dateline import net.averak.gsync.core.game_context.GameContext @@ -13,7 +13,7 @@ import java.util.* @Component open class GameContextInterceptor( - private val requestScope: HttpRequestScope, + private val requestScope: RequestScope, private val masterVersionUtils: MasterVersionUtils, ) : IRequestInterceptor { diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt index 6560cf8..d83c358 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/EchoHandler.kt @@ -1,7 +1,7 @@ package net.averak.gsync.adapter.handler.player_api +import net.averak.gsync.adapter.handler.player_api.mdval.RequestScope import net.averak.gsync.adapter.handler.player_api.pbconv.EchoConverter -import net.averak.gsync.adapter.handler.player_api.scope.RequestScope import net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 import net.averak.gsync.schema.protobuf.player_api.EchoGrpc import net.averak.gsync.usecase.EchoUsecase diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt index cee2792..82b8945 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler.kt @@ -1,8 +1,8 @@ package net.averak.gsync.adapter.handler.player_api import io.grpc.stub.StreamObserver +import net.averak.gsync.adapter.handler.player_api.mdval.RequestScope import net.averak.gsync.adapter.handler.player_api.pbconv.PlayerStorageConverter -import net.averak.gsync.adapter.handler.player_api.scope.RequestScope import net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 import net.averak.gsync.schema.protobuf.player_api.PlayerStorageGrpc import net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/AccessLogInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/AccessLogInterceptor.kt new file mode 100644 index 0000000..53e99c1 --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/AccessLogInterceptor.kt @@ -0,0 +1,75 @@ +package net.averak.gsync.adapter.handler.player_api.interceptor + +import com.google.protobuf.GeneratedMessageV3 +import com.google.protobuf.util.JsonFormat +import io.grpc.* +import net.averak.gsync.adapter.handler.player_api.mdval.OutgoingTrailerKey +import net.averak.gsync.adapter.handler.player_api.mdval.RequestScope +import net.averak.gsync.core.logger.Logger +import net.averak.gsync.infrastructure.json.JsonUtils +import org.springframework.core.annotation.Order +import org.springframework.stereotype.Component +import java.time.Duration +import java.time.LocalDateTime + +@Component +@Order(1) +class AccessLogInterceptor( + private val logger: Logger, + private val requestScope: RequestScope, +) : ServerInterceptor { + + override fun interceptCall( + call: ServerCall, + headers: Metadata, + next: ServerCallHandler, + ): ServerCall.Listener { + val begin = LocalDateTime.now() + return next.startCall( + object : ForwardingServerCall.SimpleForwardingServerCall(call) { + + lateinit var end: LocalDateTime + + @Suppress("kotlin:S108") + override fun sendMessage(message: RespT) { + end = LocalDateTime.now() + val logMessage = mutableMapOf() + logMessage["method"] = call.methodDescriptor.fullMethodName + logMessage["requested_at"] = begin.toString() + logMessage["elapsed_ms"] = Duration.between(begin, end).toMillis() + logMessage["metadata"] = headers.keys().associateWith { + headers[Metadata.Key.of(it, Metadata.ASCII_STRING_MARSHALLER)] + } + if (message is GeneratedMessageV3) { + logMessage["response"] = JsonUtils.decode( + JsonFormat.printer().print(message), + Map::class.java, + ) + } + val hint = mutableMapOf() + try { + hint["game_context"] = requestScope.gctx + hint["auth_context"] = mapOf( + "player_id" to requestScope.playerID, + "game_id" to requestScope.gameID, + ) + } catch (_: NullPointerException) { + } + logMessage["hint"] = hint + + logger.info("access log", logMessage) + super.sendMessage(message) + } + + override fun close(status: Status, trailers: Metadata) { + trailers.put( + Metadata.Key.of(OutgoingTrailerKey.RESPOND_TIMESTAMP.key, Metadata.ASCII_STRING_MARSHALLER), + end.toString(), + ) + super.close(status, trailers) + } + }, + headers, + ) + } +} diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/MetadataInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/IncomingMetadataInterceptor.kt similarity index 64% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/MetadataInterceptor.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/IncomingMetadataInterceptor.kt index 6bdfaa0..49d7a9e 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/MetadataInterceptor.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/IncomingMetadataInterceptor.kt @@ -1,18 +1,20 @@ package net.averak.gsync.adapter.handler.player_api.interceptor import io.grpc.* -import net.averak.gsync.adapter.handler.player_api.scope.IncomingMD -import net.averak.gsync.adapter.handler.player_api.scope.RequestScopeAttributes +import net.averak.gsync.adapter.handler.player_api.mdval.IncomingHeaderKey +import net.averak.gsync.adapter.handler.player_api.mdval.RequestScope import net.averak.gsync.adapter.handler.utils.MasterVersionUtils import net.averak.gsync.core.config.Config import net.averak.gsync.core.daterange.Dateline import net.averak.gsync.core.game_context.GameContext +import org.springframework.core.annotation.Order import org.springframework.stereotype.Component import java.time.LocalDateTime import java.util.* @Component -class MetadataInterceptor( +@Order(0) +class IncomingMetadataInterceptor( private val config: Config, private val masterVersionUtils: MasterVersionUtils, ) : ServerInterceptor { @@ -25,7 +27,7 @@ class MetadataInterceptor( // デバッグモードの場合のみ、なりすましを許容する val spoofingMasterVersion = if (config.debug) { - headers[Metadata.Key.of(IncomingMD.DEBUG_SPOOFING_MASTER_VERSION.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { + headers[Metadata.Key.of(IncomingHeaderKey.DEBUG_SPOOFING_MASTER_VERSION.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { UUID.fromString(it) } } else { @@ -33,21 +35,21 @@ class MetadataInterceptor( } val spoofingCurrentTime = if (config.debug) { - headers[Metadata.Key.of(IncomingMD.DEBUG_SPOOFING_CURRENT_TIME.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { + headers[Metadata.Key.of(IncomingHeaderKey.DEBUG_SPOOFING_CURRENT_TIME.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { LocalDateTime.parse(it) } } else { null } - val playerID = headers[Metadata.Key.of(IncomingMD.DEBUG_SPOOFING_PLAYER_ID.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { + val playerID = headers[Metadata.Key.of(IncomingHeaderKey.DEBUG_SPOOFING_PLAYER_ID.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { UUID.fromString(it) } - val gameID = headers[Metadata.Key.of(IncomingMD.GAME_ID.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { + val gameID = headers[Metadata.Key.of(IncomingHeaderKey.GAME_ID.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { UUID.fromString(it) } val idempotencyKey = - headers[Metadata.Key.of(IncomingMD.IDEMPOTENCY_KEY.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { + headers[Metadata.Key.of(IncomingHeaderKey.IDEMPOTENCY_KEY.key, Metadata.ASCII_STRING_MARSHALLER)]?.let { UUID.fromString(it) } @@ -60,9 +62,9 @@ class MetadataInterceptor( ) val context = Context.current() - .withValue(RequestScopeAttributes.GAME_CONTEXT, gctx) - .withValue(RequestScopeAttributes.PLAYER_ID, playerID) - .withValue(RequestScopeAttributes.GAME_ID, gameID) + .withValue(RequestScope.Attributes.GAME_CONTEXT, gctx) + .withValue(RequestScope.Attributes.PLAYER_ID, playerID) + .withValue(RequestScope.Attributes.GAME_ID, gameID) return Contexts.interceptCall(context, call, headers, next) } } diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/IncomingMD.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/mdval/IncomingHeaderKey.kt similarity index 79% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/IncomingMD.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/mdval/IncomingHeaderKey.kt index 9c78389..93c688c 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/IncomingMD.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/mdval/IncomingHeaderKey.kt @@ -1,6 +1,6 @@ -package net.averak.gsync.adapter.handler.player_api.scope +package net.averak.gsync.adapter.handler.player_api.mdval -enum class IncomingMD(val key: String) { +enum class IncomingHeaderKey(val key: String) { CLIENT_VERSION("x-client-version"), PLATFORM("x-platform"), diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/mdval/OutgoingTrailerKey.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/mdval/OutgoingTrailerKey.kt new file mode 100644 index 0000000..49ef15d --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/mdval/OutgoingTrailerKey.kt @@ -0,0 +1,6 @@ +package net.averak.gsync.adapter.handler.player_api.mdval + +enum class OutgoingTrailerKey(val key: String) { + + RESPOND_TIMESTAMP("x-respond-timestamp"), +} diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/mdval/RequestScope.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/mdval/RequestScope.kt new file mode 100644 index 0000000..cadc8bd --- /dev/null +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/mdval/RequestScope.kt @@ -0,0 +1,30 @@ +package net.averak.gsync.adapter.handler.player_api.mdval + +import io.grpc.Context +import net.averak.gsync.core.game_context.GameContext +import org.springframework.stereotype.Component +import java.util.* + +@Component +@SuppressWarnings("kotlin:S6518") +class RequestScope { + + object Attributes { + + val GAME_CONTEXT: Context.Key = Context.key("x-game-context") + val PLAYER_ID: Context.Key = Context.key("x-player-id") + val GAME_ID: Context.Key = Context.key("x-game-id") + } + + val gctx: GameContext + @Throws(NullPointerException::class) + get() = Attributes.GAME_CONTEXT.get(Context.current()) + + val playerID: UUID + @Throws(NullPointerException::class) + get() = Attributes.PLAYER_ID.get(Context.current()) + + val gameID: UUID + @Throws(NullPointerException::class) + get() = Attributes.GAME_ID.get(Context.current()) +} diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/GrpcMetadataNotFoundException.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/GrpcMetadataNotFoundException.kt deleted file mode 100644 index 9f09bb9..0000000 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/GrpcMetadataNotFoundException.kt +++ /dev/null @@ -1,3 +0,0 @@ -package net.averak.gsync.adapter.handler.player_api.scope - -class GrpcMetadataNotFoundException(message: String) : RuntimeException(message) diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScope.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScope.kt deleted file mode 100644 index 65d007f..0000000 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScope.kt +++ /dev/null @@ -1,32 +0,0 @@ -package net.averak.gsync.adapter.handler.player_api.scope - -import io.grpc.Context -import net.averak.gsync.core.game_context.GameContext -import org.springframework.stereotype.Component -import java.util.* - -@Component -@SuppressWarnings("kotlin:S6518") -class RequestScope { - - val gctx: GameContext - get() = try { - RequestScopeAttributes.GAME_CONTEXT.get(Context.current()) - } catch (_: NullPointerException) { - throw GrpcMetadataNotFoundException("Game context is not found in request scope.") - } - - val playerID: UUID - get() = try { - RequestScopeAttributes.PLAYER_ID.get(Context.current()) - } catch (_: NullPointerException) { - throw GrpcMetadataNotFoundException("PlayerID is not found in request scope.") - } - - val gameID: UUID - get() = try { - RequestScopeAttributes.GAME_ID.get(Context.current()) - } catch (_: NullPointerException) { - throw GrpcMetadataNotFoundException("GameID is not found in request scope.") - } -} diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScopeAttributes.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScopeAttributes.kt deleted file mode 100644 index 4755aef..0000000 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/scope/RequestScopeAttributes.kt +++ /dev/null @@ -1,12 +0,0 @@ -package net.averak.gsync.adapter.handler.player_api.scope - -import io.grpc.Context -import net.averak.gsync.core.game_context.GameContext -import java.util.* - -object RequestScopeAttributes { - - val GAME_CONTEXT: Context.Key = Context.key("x-game-context") - val PLAYER_ID: Context.Key = Context.key("x-player-id") - val GAME_ID: Context.Key = Context.key("x-game-id") -} diff --git a/app/core/src/main/kotlin/net/averak/gsync/core/logger/Logger.kt b/app/core/src/main/kotlin/net/averak/gsync/core/logger/Logger.kt index 141b531..50e9baf 100644 --- a/app/core/src/main/kotlin/net/averak/gsync/core/logger/Logger.kt +++ b/app/core/src/main/kotlin/net/averak/gsync/core/logger/Logger.kt @@ -14,15 +14,15 @@ class Logger( private val logger = LoggerFactory.getLogger(Logger::class.java) - fun info(gctx: GameContext, message: String) { + fun info(message: String, payload: Map) { this.logger.info( message, makeServerInfoPayload(), - makeGameContextPayload(gctx), + StructuredArguments.value("payload", payload), ) } - fun info(gctx: GameContext, message: String, payload: Map) { + fun info(gctx: GameContext, message: String, payload: Map) { this.logger.info( message, makeServerInfoPayload(), @@ -61,7 +61,9 @@ class Logger( return StructuredArguments.value( "game_context", mapOf( + "master_version" to gctx.masterVersion.toString(), "idempotencyKey" to gctx.idempotencyKey.toString(), + "dateline" to gctx.dateline.toString(), "currentTime" to gctx.currentTime.toString(), ), ) diff --git a/build.gradle.kts b/build.gradle.kts index 7549b08..09c72b2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -221,6 +221,7 @@ project(":protobuf") { api(rootProject.libs.io.grpc.protobuf) api(rootProject.libs.io.grpc.services) api(rootProject.libs.io.grpc.stub) + api(rootProject.libs.google.protobuf.util) } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6e1362c..d3dadb2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -15,6 +15,7 @@ flyway-gradle-plugin = { module = "org.flywaydb:flyway-gradle-plugin", version.r flyway-spanner = { module = "org.flywaydb:flyway-gcp-spanner", version.ref = "flyway" } google-cloud-spanner-jdbc = "com.google.cloud:google-cloud-spanner-jdbc:2.15.0" google-cloud-spanner-spring = "com.google.cloud:spring-cloud-gcp-starter-data-spanner:5.0.0" +google-protobuf-util = "com.google.protobuf:protobuf-java-util:3.25.2" groovy = { module = "org.apache.groovy:groovy", version.ref = "groovy" } groovy-sql = { module = "org.apache.groovy:groovy-sql", version.ref = "groovy" } guava = "com.google.guava:guava:33.0.0-jre" diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml index f1eafcf..aa463c8 100644 --- a/src/test/resources/logback-test.xml +++ b/src/test/resources/logback-test.xml @@ -11,7 +11,7 @@ - + diff --git a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt index de18b9f..d5b1701 100644 --- a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt +++ b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt @@ -6,7 +6,7 @@ import io.grpc.ManagedChannelBuilder import io.grpc.Metadata import io.grpc.stub.MetadataUtils import jakarta.annotation.PostConstruct -import net.averak.gsync.adapter.handler.player_api.scope.IncomingMD +import net.averak.gsync.adapter.handler.player_api.mdval.IncomingHeaderKey import net.averak.gsync.core.config.Config import net.averak.gsync.schema.protobuf.player_api.EchoGrpc import net.averak.gsync.schema.protobuf.player_api.PlayerStorageGrpc @@ -19,7 +19,7 @@ class GrpcTester( private val config: Config, ) { - private var metadata: MutableMap = mutableMapOf() + private var metadata: MutableMap = mutableMapOf() private lateinit var channel: ManagedChannel @@ -50,28 +50,28 @@ class GrpcTester( } fun withSession(playerID: UUID, gameID: UUID) { - metadata[IncomingMD.DEBUG_SPOOFING_PLAYER_ID] = playerID.toString() - metadata[IncomingMD.GAME_ID] = gameID.toString() + metadata[IncomingHeaderKey.DEBUG_SPOOFING_PLAYER_ID] = playerID.toString() + metadata[IncomingHeaderKey.GAME_ID] = gameID.toString() initStubs() } fun withGameID(value: UUID) { - metadata[IncomingMD.GAME_ID] = value.toString() + metadata[IncomingHeaderKey.GAME_ID] = value.toString() initStubs() } fun withSpoofingPlayerID(value: UUID) { - metadata[IncomingMD.DEBUG_SPOOFING_PLAYER_ID] = value.toString() + metadata[IncomingHeaderKey.DEBUG_SPOOFING_PLAYER_ID] = value.toString() initStubs() } fun withSpoofingMasterVersion(value: UUID) { - metadata[IncomingMD.DEBUG_SPOOFING_MASTER_VERSION] = value.toString() + metadata[IncomingHeaderKey.DEBUG_SPOOFING_MASTER_VERSION] = value.toString() initStubs() } fun withSpoofingCurrentTime(value: LocalDateTime) { - metadata[IncomingMD.DEBUG_SPOOFING_CURRENT_TIME] = value.toString() + metadata[IncomingHeaderKey.DEBUG_SPOOFING_CURRENT_TIME] = value.toString() initStubs() } } diff --git a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/RequestBuilder.kt b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/RequestBuilder.kt index 89d4f65..93f4bbb 100644 --- a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/RequestBuilder.kt +++ b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/RequestBuilder.kt @@ -1,7 +1,7 @@ package net.averak.gsync.testkit.api.rest import net.averak.gsync.adapter.handler.admin_api.GlobalRestControllerAdvice -import net.averak.gsync.adapter.handler.admin_api.HttpRequestScope +import net.averak.gsync.adapter.handler.admin_api.RequestScope import net.averak.gsync.domain.model.Platform import net.averak.gsync.infrastructure.json.JsonUtils import org.springframework.http.HttpStatus @@ -47,23 +47,23 @@ data class RequestBuilder( } fun idempotencyKey(value: UUID): RequestBuilder { - return header(HttpRequestScope.HeaderName.IDEMPOTENCY_KEY.key, value.toString()) + return header(RequestScope.HeaderName.IDEMPOTENCY_KEY.key, value.toString()) } fun clientVersion(value: String): RequestBuilder { - return header(HttpRequestScope.HeaderName.CLIENT_VERSION.key, value) + return header(RequestScope.HeaderName.CLIENT_VERSION.key, value) } fun platform(value: Platform): RequestBuilder { - return header(HttpRequestScope.HeaderName.PLATFORM.key, value.name) + return header(RequestScope.HeaderName.PLATFORM.key, value.name) } fun spoofingMasterVersion(value: UUID): RequestBuilder { - return header(HttpRequestScope.HeaderName.SPOOFING_MASTER_VERSION.key, value.toString()) + return header(RequestScope.HeaderName.SPOOFING_MASTER_VERSION.key, value.toString()) } fun spoofingCurrentTime(value: LocalDateTime): RequestBuilder { - return header(HttpRequestScope.HeaderName.SPOOFING_CURRENT_TIME.key, value.toString()) + return header(RequestScope.HeaderName.SPOOFING_CURRENT_TIME.key, value.toString()) } private fun header(key: String, value: String): RequestBuilder { From 6661f24413aeb08fb8889923fe19721c2ff5a645 Mon Sep 17 00:00:00 2001 From: averak Date: Thu, 18 Jan 2024 02:17:12 +0900 Subject: [PATCH 07/15] =?UTF-8?q?refs=20#91=20github=20actions=E3=81=AE?= =?UTF-8?q?=E3=83=AF=E3=83=BC=E3=82=AF=E3=83=95=E3=83=AD=E3=83=BC=E5=90=8D?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/{build.yml => cd.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{build.yml => cd.yml} (98%) diff --git a/.github/workflows/build.yml b/.github/workflows/cd.yml similarity index 98% rename from .github/workflows/build.yml rename to .github/workflows/cd.yml index e1c1624..c1e45a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/cd.yml @@ -1,4 +1,4 @@ -name: Build +name: CD on: release: From 4af8eef8184210959bd49c960fa00eacf7730eb7 Mon Sep 17 00:00:00 2001 From: averak Date: Thu, 18 Jan 2024 02:22:33 +0900 Subject: [PATCH 08/15] =?UTF-8?q?refs=20#91=20semver=E3=81=AEv=E3=83=97?= =?UTF-8?q?=E3=83=AC=E3=83=95=E3=82=A3=E3=83=83=E3=82=AF=E3=82=B9=E3=82=92?= =?UTF-8?q?=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interceptor/ClientVersionInterceptor.kt | 17 +++++++------ .../ClientVersionInterceptor_UT.groovy | 24 +++++++++---------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor.kt index d5ff1ab..7c433de 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor.kt @@ -59,14 +59,17 @@ open class ClientVersionInterceptor( /** * ver1 >= ver2 を判定する + * + * @param semver1 x.y.z 形式のバージョン文字列 + * @param semver2 x.y.z 形式のバージョン文字列 */ - private fun compareSemver(ver1: String, ver2: String): Boolean { - val major1 = ver1.trim('v').split(".")[0].toInt() - val minor1 = ver1.trim('v').split(".")[1].toInt() - val patch1 = ver1.trim('v').split(".")[2].toInt() - val major2 = ver2.trim('v').split(".")[0].toInt() - val minor2 = ver2.trim('v').split(".")[1].toInt() - val patch2 = ver2.trim('v').split(".")[2].toInt() + private fun compareSemver(semver1: String, semver2: String): Boolean { + val major1 = semver1.split(".")[0].toInt() + val minor1 = semver1.split(".")[1].toInt() + val patch1 = semver1.split(".")[2].toInt() + val major2 = semver2.split(".")[0].toInt() + val minor2 = semver2.split(".")[1].toInt() + val patch2 = semver2.split(".")[2].toInt() return major1 > major2 || (major1 == major2 && minor1 > minor2) || (major1 == major2 && minor1 == minor2 && patch1 >= patch2) } diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor_UT.groovy index c728dd4..255f569 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor_UT.groovy @@ -19,13 +19,13 @@ class ClientVersionInterceptor_UT extends AbstractDatabaseSpec { def "不正なクライアントバージョンの場合はエラーを返す"() { given: Fixture.setup( - Faker.fake(RequiredClientVersionDto, [masterVersion: Faker.uuidv5("active").toString(), clientVersion: "v1.1.0", platform: Platform.IOS.id.toLong()]), + Faker.fake(RequiredClientVersionDto, [masterVersion: Faker.uuidv5("active").toString(), clientVersion: "1.1.0", platform: Platform.IOS.id.toLong()]), ) when: final response = this.restTester.get("/api/health") .spoofingMasterVersion(Faker.uuidv5("active")) - .clientVersion("v1.0.0") + .clientVersion("1.0.0") .platform(Platform.IOS) .invoke() @@ -37,8 +37,8 @@ class ClientVersionInterceptor_UT extends AbstractDatabaseSpec { def "verifyClientVersion: 正常系 - データが存在する場合は正しく判定できる"() { given: Fixture.setup( - Faker.fake(RequiredClientVersionDto, [masterVersion: Faker.uuidv5("active").toString(), clientVersion: "v1.0.0", platform: Platform.IOS.id.toLong()]), - Faker.fake(RequiredClientVersionDto, [masterVersion: Faker.uuidv5("active").toString(), clientVersion: "v1.1.0", platform: Platform.ANDROID.id.toLong()]), + Faker.fake(RequiredClientVersionDto, [masterVersion: Faker.uuidv5("active").toString(), clientVersion: "1.0.0", platform: Platform.IOS.id.toLong()]), + Faker.fake(RequiredClientVersionDto, [masterVersion: Faker.uuidv5("active").toString(), clientVersion: "1.1.0", platform: Platform.ANDROID.id.toLong()]), ) when: @@ -49,11 +49,11 @@ class ClientVersionInterceptor_UT extends AbstractDatabaseSpec { where: masterVersion | clientVersion | platform || expected - Faker.uuidv5("active") | "v1.0.0" | Platform.IOS || true - Faker.uuidv5("active") | "v0.0.9" | Platform.IOS || false - Faker.uuidv5("active") | "v1.1.0" | Platform.ANDROID || true - Faker.uuidv5("active") | "v1.0.9" | Platform.ANDROID || false - Faker.uuidv5("active") | "v0.999.999" | Platform.IOS || false + Faker.uuidv5("active") | "1.0.0" | Platform.IOS || true + Faker.uuidv5("active") | "0.0.9" | Platform.IOS || false + Faker.uuidv5("active") | "1.1.0" | Platform.ANDROID || true + Faker.uuidv5("active") | "1.0.9" | Platform.ANDROID || false + Faker.uuidv5("active") | "0.999.999" | Platform.IOS || false Faker.uuidv5("active") | null | null || true } @@ -73,9 +73,9 @@ class ClientVersionInterceptor_UT extends AbstractDatabaseSpec { where: masterVersion | clientVersion | platform || expected - Faker.uuidv5("active") | "v1.0.0" | null || new GsyncException(ErrorCode.PLATFORM_MUST_BE_SPECIFIED) + Faker.uuidv5("active") | "1.0.0" | null || new GsyncException(ErrorCode.PLATFORM_MUST_BE_SPECIFIED) Faker.uuidv5("active") | null | Platform.IOS || new GsyncException(ErrorCode.CLIENT_VERSION_MUST_BE_SPECIFIED) - Faker.uuidv5("outdated") | "v1.0.0" | Platform.IOS || new GsyncException(ErrorCode.REQUIRED_CLIENT_VERSION_DEFINITION_IS_NOT_FOUND) - Faker.uuidv5("outdated") | "v1.0.0" | Platform.ANDROID || new GsyncException(ErrorCode.REQUIRED_CLIENT_VERSION_DEFINITION_IS_NOT_FOUND) + Faker.uuidv5("outdated") | "1.0.0" | Platform.IOS || new GsyncException(ErrorCode.REQUIRED_CLIENT_VERSION_DEFINITION_IS_NOT_FOUND) + Faker.uuidv5("outdated") | "1.0.0" | Platform.ANDROID || new GsyncException(ErrorCode.REQUIRED_CLIENT_VERSION_DEFINITION_IS_NOT_FOUND) } } From b939fb5e8641613766eb289fcc55fe1d0a15556f Mon Sep 17 00:00:00 2001 From: averak Date: Thu, 18 Jan 2024 02:49:57 +0900 Subject: [PATCH 09/15] =?UTF-8?q?refs=20#91=20=E4=B8=8D=E6=AD=A3=E3=81=AA?= =?UTF-8?q?=E3=82=AF=E3=83=A9=E3=82=A4=E3=82=A2=E3=83=B3=E3=83=88=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92=E5=BC=BE=E3=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interceptor/ClientVersionInterceptor.kt | 63 +++++++++++-------- .../handler/player_api/EchoHandler_IT.groovy | 4 +- .../player_api/PlayerStorageHandler_IT.groovy | 14 ++--- .../ClientVersionInterceptor_UT.groovy | 24 ++++--- .../gsync/testkit/api/grpc/GrpcTester.kt | 24 ++++--- .../averak/gsync/testkit/api/grpc/Response.kt | 8 +++ .../gsync/testkit/api/rest/RequestBuilder.kt | 9 --- 7 files changed, 85 insertions(+), 61 deletions(-) rename app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/{admin_api => player_api}/interceptor/ClientVersionInterceptor.kt (56%) rename app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/{admin_api => player_api}/interceptor/ClientVersionInterceptor_UT.groovy (82%) create mode 100644 testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/Response.kt diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/ClientVersionInterceptor.kt similarity index 56% rename from app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor.kt rename to app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/ClientVersionInterceptor.kt index 7c433de..2e41e5f 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/ClientVersionInterceptor.kt @@ -1,51 +1,68 @@ -package net.averak.gsync.adapter.handler.admin_api.interceptor +package net.averak.gsync.adapter.handler.player_api.interceptor import com.google.common.annotations.VisibleForTesting -import jakarta.servlet.http.HttpServletRequest -import jakarta.servlet.http.HttpServletResponse +import io.grpc.Metadata +import io.grpc.ServerCall +import io.grpc.ServerCallHandler +import io.grpc.ServerInterceptor import net.averak.gsync.adapter.dao.dto.base.RequiredClientVersionExample import net.averak.gsync.adapter.dao.mapper.base.RequiredClientVersionBaseMapper -import net.averak.gsync.adapter.handler.admin_api.RequestScope +import net.averak.gsync.adapter.handler.player_api.mdval.IncomingHeaderKey +import net.averak.gsync.adapter.handler.player_api.mdval.RequestScope +import net.averak.gsync.core.config.Config import net.averak.gsync.core.exception.ErrorCode import net.averak.gsync.core.exception.GsyncException import net.averak.gsync.domain.model.Platform +import org.springframework.core.annotation.Order import org.springframework.stereotype.Component -import org.springframework.web.servlet.ModelAndView import java.util.* @Component -open class ClientVersionInterceptor( +@Order(1) +class ClientVersionInterceptor( + private val config: Config, private val requestScope: RequestScope, - private val requiredClientVersionBaseMapper: RequiredClientVersionBaseMapper, -) : IRequestInterceptor { + private val requiredClientVersionMapper: RequiredClientVersionBaseMapper, +) : ServerInterceptor { - override fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean { - val clientVersion = requestScope.getClientVersion() - val platform = requestScope.getPlatform() - val gctx = requestScope.getGameContext() - if (!verifyClientVersion(gctx.masterVersion, clientVersion, platform)) { + @SuppressWarnings("kotlin:S6518") + override fun interceptCall( + call: ServerCall, + headers: Metadata, + next: ServerCallHandler, + ): ServerCall.Listener { + val clientVersion = headers.get( + Metadata.Key.of(IncomingHeaderKey.CLIENT_VERSION.key, Metadata.ASCII_STRING_MARSHALLER), + ) + val platform = headers.get( + Metadata.Key.of(IncomingHeaderKey.PLATFORM.key, Metadata.ASCII_STRING_MARSHALLER), + )?.let { Platform.valueOf(it) } + + // デバッグモードの場合のみ、不正なクライアントをバイパスする + if ((clientVersion == null || platform == null) && config.debug) { + return next.startCall(call, headers) + } + + if (!verifyClientVersion(requestScope.gctx.masterVersion, clientVersion, platform)) { throw GsyncException(ErrorCode.CLIENT_VERSION_IS_NOT_SUPPORTED) } - return true + return next.startCall(call, headers) } @Throws(GsyncException::class) @VisibleForTesting fun verifyClientVersion(masterVersion: UUID, clientVersion: String?, platform: Platform?): Boolean { - // REST API の場合は全ての API がクライアントバージョン、プラットフォームを要求するわけではない - // しかし API によっては必須の場合もあるので、そのチェックは個別で行う if (clientVersion == null && platform == null) { return true } - // クライアントバージョン、プラットフォームが片方でも指定された場合は、要求されるバージョンを満たしていることを判定する (両方未指定の場合のみ判定処理をスキップして良い) if (clientVersion == null) { throw GsyncException(ErrorCode.CLIENT_VERSION_MUST_BE_SPECIFIED) } if (platform == null) { throw GsyncException(ErrorCode.PLATFORM_MUST_BE_SPECIFIED) } - val dtos = requiredClientVersionBaseMapper.selectByExample( + val dtos = requiredClientVersionMapper.selectByExample( RequiredClientVersionExample().apply { createCriteria().andMasterVersionEqualTo(masterVersion.toString()).andPlatformEqualTo(platform.id.toLong()) }, @@ -58,7 +75,7 @@ open class ClientVersionInterceptor( } /** - * ver1 >= ver2 を判定する + * semver1 >= semver2 なら true を返す * * @param semver1 x.y.z 形式のバージョン文字列 * @param semver2 x.y.z 形式のバージョン文字列 @@ -72,12 +89,4 @@ open class ClientVersionInterceptor( val patch2 = semver2.split(".")[2].toInt() return major1 > major2 || (major1 == major2 && minor1 > minor2) || (major1 == major2 && minor1 == minor2 && patch1 >= patch2) } - - override fun postHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any, modelAndView: ModelAndView?) { - return - } - - override fun getPriority(): InterceptorPriority { - return InterceptorPriority.MEDIUM - } } diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/EchoHandler_IT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/EchoHandler_IT.groovy index 55583cb..3f9c46e 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/EchoHandler_IT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/EchoHandler_IT.groovy @@ -23,8 +23,8 @@ class EchoHandler_EchoV1_IT extends AbstractDatabaseSpec { ) then: - response.message == message - Assert.timestampIs(response.timestamp, now) + response.message.message == message + Assert.timestampIs(response.message.timestamp, now) with(sql.rows("SELECT * FROM gsync_echo")) { it.size() == 1 it[0].message == message diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy index eb82ecb..66b73bf 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/PlayerStorageHandler_IT.groovy @@ -63,8 +63,8 @@ class PlayerStorageHandler_SearchV1_IT extends AbstractDatabaseSpec { ) then: - response.entriesList*.key == ["group1#key1", "group1#key2"] - response.entriesList*.value*.toByteArray() == ["value1".bytes, "value2".bytes] + response.message.entriesList*.key == ["group1#key1", "group1#key2"] + response.message.entriesList*.value*.toByteArray() == ["value1".bytes, "value2".bytes] } } @@ -92,12 +92,12 @@ class PlayerStorageHandler_SetV1_IT extends AbstractDatabaseSpec { ) then: - response.entry.key == entry.key - response.entry.value.toByteArray() == entry.value + response.message.entry.key == entry.key + response.message.entry.value.toByteArray() == entry.value with(sql.rows("SELECT * FROM gsync_player_storage_revision")) { it.size() == 1 - it[0].player_storage_revision_id == response.nextRevision + it[0].player_storage_revision_id == response.message.nextRevision } with(sql.rows("SELECT * FROM gsync_player_storage_entry")) { it.size() == 1 @@ -159,10 +159,10 @@ class PlayerStorageHandler_ClearV1_IT extends AbstractDatabaseSpec { ) then: - response.nextRevision != Faker.uuidv5("current revision").toString() + response.message.nextRevision != Faker.uuidv5("current revision").toString() with(sql.rows("SELECT * FROM gsync_player_storage_revision")) { it.size() == 2 - it*.player_storage_revision_id.sort() == [Faker.uuidv5("current revision").toString(), response.nextRevision].sort() + it*.player_storage_revision_id.sort() == [Faker.uuidv5("current revision").toString(), response.message.nextRevision].sort() } with(sql.rows("SELECT * FROM gsync_player_storage_entry")) { it.size() == 1 diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/interceptor/ClientVersionInterceptor_UT.groovy similarity index 82% rename from app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor_UT.groovy rename to app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/interceptor/ClientVersionInterceptor_UT.groovy index 255f569..23a93a3 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/admin_api/interceptor/ClientVersionInterceptor_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/player_api/interceptor/ClientVersionInterceptor_UT.groovy @@ -1,15 +1,15 @@ -package net.averak.gsync.adapter.handler.admin_api.interceptor +package net.averak.gsync.adapter.handler.player_api.interceptor import net.averak.gsync.adapter.dao.dto.base.RequiredClientVersionDto import net.averak.gsync.core.exception.ErrorCode import net.averak.gsync.core.exception.GsyncException import net.averak.gsync.domain.model.Platform +import net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 import net.averak.gsync.testkit.AbstractDatabaseSpec import net.averak.gsync.testkit.Assert import net.averak.gsync.testkit.Faker import net.averak.gsync.testkit.Fixture import org.springframework.beans.factory.annotation.Autowired -import org.springframework.http.HttpStatus class ClientVersionInterceptor_UT extends AbstractDatabaseSpec { @@ -20,18 +20,24 @@ class ClientVersionInterceptor_UT extends AbstractDatabaseSpec { given: Fixture.setup( Faker.fake(RequiredClientVersionDto, [masterVersion: Faker.uuidv5("active").toString(), clientVersion: "1.1.0", platform: Platform.IOS.id.toLong()]), + Faker.fake(RequiredClientVersionDto, [masterVersion: Faker.uuidv5("active").toString(), clientVersion: "1.2.0", platform: Platform.ANDROID.id.toLong()]), ) when: - final response = this.restTester.get("/api/health") - .spoofingMasterVersion(Faker.uuidv5("active")) - .clientVersion("1.0.0") - .platform(Platform.IOS) - .invoke() + grpcTester.withSpoofingMasterVersion(Faker.uuidv4()) + grpcTester.withClient(clientVersion, platform) + final response = grpcTester.invoke( + grpcTester.echo.&echoV1, + EchoEchoV1.Request.newBuilder().setMessage("").build(), + ) then: - response.status == HttpStatus.BAD_REQUEST - response.error.code == ErrorCode.CLIENT_VERSION_IS_NOT_SUPPORTED.name() + !response.status.isOk() + + where: + clientVersion | platform + "1.0.0" | Platform.IOS + "1.1.0" | Platform.ANDROID } def "verifyClientVersion: 正常系 - データが存在する場合は正しく判定できる"() { diff --git a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt index d5b1701..01d2513 100644 --- a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt +++ b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/GrpcTester.kt @@ -1,13 +1,12 @@ package net.averak.gsync.testkit.api.grpc import com.google.protobuf.GeneratedMessageV3 -import io.grpc.ManagedChannel -import io.grpc.ManagedChannelBuilder -import io.grpc.Metadata +import io.grpc.* import io.grpc.stub.MetadataUtils import jakarta.annotation.PostConstruct import net.averak.gsync.adapter.handler.player_api.mdval.IncomingHeaderKey import net.averak.gsync.core.config.Config +import net.averak.gsync.domain.model.Platform import net.averak.gsync.schema.protobuf.player_api.EchoGrpc import net.averak.gsync.schema.protobuf.player_api.PlayerStorageGrpc import org.springframework.stereotype.Component @@ -43,10 +42,15 @@ class GrpcTester( playerStorage = PlayerStorageGrpc.newBlockingStub(channel).withInterceptors(interceptor) } - fun invoke(method: (REQ) -> RES, request: REQ): RES { - val response = method(request) - metadata.clear() - return response + fun invoke(method: (REQ) -> RES, request: REQ): Response { + try { + val response = method(request) + return Response(Status.OK, response) + } catch (ex: StatusRuntimeException) { + return Response(ex.status, null) + } finally { + metadata.clear() + } } fun withSession(playerID: UUID, gameID: UUID) { @@ -55,6 +59,12 @@ class GrpcTester( initStubs() } + fun withClient(version: String, platform: Platform) { + metadata[IncomingHeaderKey.CLIENT_VERSION] = version + metadata[IncomingHeaderKey.PLATFORM] = platform.name + initStubs() + } + fun withGameID(value: UUID) { metadata[IncomingHeaderKey.GAME_ID] = value.toString() initStubs() diff --git a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/Response.kt b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/Response.kt new file mode 100644 index 0000000..26e8af0 --- /dev/null +++ b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/grpc/Response.kt @@ -0,0 +1,8 @@ +package net.averak.gsync.testkit.api.grpc + +import io.grpc.Status + +data class Response( + val status: Status, + val message: T?, +) diff --git a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/RequestBuilder.kt b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/RequestBuilder.kt index 93f4bbb..88dabdb 100644 --- a/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/RequestBuilder.kt +++ b/testkit/src/main/kotlin/net/averak/gsync/testkit/api/rest/RequestBuilder.kt @@ -2,7 +2,6 @@ package net.averak.gsync.testkit.api.rest import net.averak.gsync.adapter.handler.admin_api.GlobalRestControllerAdvice import net.averak.gsync.adapter.handler.admin_api.RequestScope -import net.averak.gsync.domain.model.Platform import net.averak.gsync.infrastructure.json.JsonUtils import org.springframework.http.HttpStatus import org.springframework.test.web.servlet.MockMvc @@ -50,14 +49,6 @@ data class RequestBuilder( return header(RequestScope.HeaderName.IDEMPOTENCY_KEY.key, value.toString()) } - fun clientVersion(value: String): RequestBuilder { - return header(RequestScope.HeaderName.CLIENT_VERSION.key, value) - } - - fun platform(value: Platform): RequestBuilder { - return header(RequestScope.HeaderName.PLATFORM.key, value.name) - } - fun spoofingMasterVersion(value: UUID): RequestBuilder { return header(RequestScope.HeaderName.SPOOFING_MASTER_VERSION.key, value.toString()) } From b978846739ba952d5b47886991ec155addb4564e Mon Sep 17 00:00:00 2001 From: averak Date: Fri, 19 Jan 2024 16:15:17 +0900 Subject: [PATCH 10/15] =?UTF-8?q?refs=20#103=20is=5Fenabled=E3=82=92is=5Fv?= =?UTF-8?q?alid=E3=81=AB=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/dto/base/MasterVersionDto.java | 26 +++---- .../dao/dto/base/MasterVersionExample.java | 48 ++++++------- .../interceptor/GameContextInterceptor.kt | 2 +- .../IncomingMetadataInterceptor.kt | 2 +- .../handler/utils/MasterVersionUtils.kt | 8 +-- .../utils/MasterVersionUtils_UT.groovy | 24 +++---- .../averak/gsync/core/exception/ErrorCode.kt | 4 +- .../redis/RedisClient_UT.groovy | 2 +- .../protobuf/player_api/EchoEchoV1.java | 44 +++++------- .../player_api/EchoEchoV1OrBuilder.java | 1 - .../protobuf/player_api/EchoOuterClass.java | 1 - .../player_api/PlayerStorageClearV1.java | 44 +++++------- .../PlayerStorageClearV1OrBuilder.java | 1 - .../player_api/PlayerStorageOuterClass.java | 1 - .../player_api/PlayerStorageSearchV1.java | 44 +++++------- .../PlayerStorageSearchV1OrBuilder.java | 1 - .../player_api/PlayerStorageSetV1.java | 69 +++++++------------ .../PlayerStorageSetV1OrBuilder.java | 1 - .../resource/player_storage/Criteria.java | 7 +- .../player_storage/CriteriaOrBuilder.java | 1 - .../resource/player_storage/Entry.java | 7 +- .../player_storage/EntryOrBuilder.java | 1 - .../player_storage/PlayerStorage.java | 1 - .../dao/base/MasterVersionBaseMapper.xml | 32 ++++----- src/main/resources/db/migration/V1_0_0.sql | 4 +- 25 files changed, 167 insertions(+), 209 deletions(-) diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionDto.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionDto.java index 282f4c6..2e7153f 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionDto.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionDto.java @@ -19,11 +19,11 @@ public class MasterVersionDto extends AbstractDto { /** * * This field was generated by MyBatis Generator. This field corresponds to the - * database column gsync_master_version.is_enabled + * database column gsync_master_version.is_valid * * @mbg.generated */ - private Boolean isEnabled; + private Boolean isValid; /** * @@ -58,10 +58,10 @@ public class MasterVersionDto extends AbstractDto { * * @mbg.generated */ - public MasterVersionDto(@Nonnull String version, @Nonnull Boolean isEnabled, @Nonnull String comment, + public MasterVersionDto(@Nonnull String version, @Nonnull Boolean isValid, @Nonnull String comment, @Nonnull LocalDateTime createdAt, @Nonnull LocalDateTime updatedAt) { this.version = version; - this.isEnabled = isEnabled; + this.isValid = isValid; this.comment = comment; this.createdAt = createdAt; this.updatedAt = updatedAt; @@ -105,28 +105,28 @@ public void setVersion(@Nonnull String version) { /** * This method was generated by MyBatis Generator. This method returns the value - * of the database column gsync_master_version.is_enabled + * of the database column gsync_master_version.is_valid * - * @return the value of gsync_master_version.is_enabled + * @return the value of gsync_master_version.is_valid * * @mbg.generated */ @Nonnull - public Boolean getIsEnabled() { - return isEnabled; + public Boolean getIsValid() { + return isValid; } /** * This method was generated by MyBatis Generator. This method sets the value of - * the database column gsync_master_version.is_enabled + * the database column gsync_master_version.is_valid * - * @param isEnabled - * the value for gsync_master_version.is_enabled + * @param isValid + * the value for gsync_master_version.is_valid * * @mbg.generated */ - public void setIsEnabled(@Nonnull Boolean isEnabled) { - this.isEnabled = isEnabled; + public void setIsValid(@Nonnull Boolean isValid) { + this.isValid = isValid; } /** diff --git a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionExample.java b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionExample.java index 0c3c59c..4b941d2 100644 --- a/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionExample.java +++ b/app/adapter/src/main/java/net/averak/gsync/adapter/dao/dto/base/MasterVersionExample.java @@ -266,63 +266,63 @@ public Criteria andVersionNotBetween(String value1, String value2) { return (Criteria) this; } - public Criteria andIsEnabledIsNull() { - addCriterion("`is_enabled` is null"); + public Criteria andIsValidIsNull() { + addCriterion("`is_valid` is null"); return (Criteria) this; } - public Criteria andIsEnabledIsNotNull() { - addCriterion("`is_enabled` is not null"); + public Criteria andIsValidIsNotNull() { + addCriterion("`is_valid` is not null"); return (Criteria) this; } - public Criteria andIsEnabledEqualTo(Boolean value) { - addCriterion("`is_enabled` =", value, "isEnabled"); + public Criteria andIsValidEqualTo(Boolean value) { + addCriterion("`is_valid` =", value, "isValid"); return (Criteria) this; } - public Criteria andIsEnabledNotEqualTo(Boolean value) { - addCriterion("`is_enabled` <>", value, "isEnabled"); + public Criteria andIsValidNotEqualTo(Boolean value) { + addCriterion("`is_valid` <>", value, "isValid"); return (Criteria) this; } - public Criteria andIsEnabledGreaterThan(Boolean value) { - addCriterion("`is_enabled` >", value, "isEnabled"); + public Criteria andIsValidGreaterThan(Boolean value) { + addCriterion("`is_valid` >", value, "isValid"); return (Criteria) this; } - public Criteria andIsEnabledGreaterThanOrEqualTo(Boolean value) { - addCriterion("`is_enabled` >=", value, "isEnabled"); + public Criteria andIsValidGreaterThanOrEqualTo(Boolean value) { + addCriterion("`is_valid` >=", value, "isValid"); return (Criteria) this; } - public Criteria andIsEnabledLessThan(Boolean value) { - addCriterion("`is_enabled` <", value, "isEnabled"); + public Criteria andIsValidLessThan(Boolean value) { + addCriterion("`is_valid` <", value, "isValid"); return (Criteria) this; } - public Criteria andIsEnabledLessThanOrEqualTo(Boolean value) { - addCriterion("`is_enabled` <=", value, "isEnabled"); + public Criteria andIsValidLessThanOrEqualTo(Boolean value) { + addCriterion("`is_valid` <=", value, "isValid"); return (Criteria) this; } - public Criteria andIsEnabledIn(List values) { - addCriterion("`is_enabled` in", values, "isEnabled"); + public Criteria andIsValidIn(List values) { + addCriterion("`is_valid` in", values, "isValid"); return (Criteria) this; } - public Criteria andIsEnabledNotIn(List values) { - addCriterion("`is_enabled` not in", values, "isEnabled"); + public Criteria andIsValidNotIn(List values) { + addCriterion("`is_valid` not in", values, "isValid"); return (Criteria) this; } - public Criteria andIsEnabledBetween(Boolean value1, Boolean value2) { - addCriterion("`is_enabled` between", value1, value2, "isEnabled"); + public Criteria andIsValidBetween(Boolean value1, Boolean value2) { + addCriterion("`is_valid` between", value1, value2, "isValid"); return (Criteria) this; } - public Criteria andIsEnabledNotBetween(Boolean value1, Boolean value2) { - addCriterion("`is_enabled` not between", value1, value2, "isEnabled"); + public Criteria andIsValidNotBetween(Boolean value1, Boolean value2) { + addCriterion("`is_valid` not between", value1, value2, "isValid"); return (Criteria) this; } diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt index df57d5a..02c5e08 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/admin_api/interceptor/GameContextInterceptor.kt @@ -19,7 +19,7 @@ open class GameContextInterceptor( override fun preHandle(request: HttpServletRequest, response: HttpServletResponse, handler: Any): Boolean { val gctx = GameContext( - masterVersionUtils.getEnabledMasterVersion(requestScope.getSpoofingMasterVersion()), + masterVersionUtils.getValidMasterVersion(requestScope.getSpoofingMasterVersion()), // クライアントが Idempotency-Key を必ず設定してくるとは限らないので、未設定の場合はサーバ側でユニークキーを発行し、毎回異なるリクエストとして扱う requestScope.getIdempotencyKey() ?: UUID.randomUUID(), Dateline.DEFAULT, diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/IncomingMetadataInterceptor.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/IncomingMetadataInterceptor.kt index 49d7a9e..4346418 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/IncomingMetadataInterceptor.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/player_api/interceptor/IncomingMetadataInterceptor.kt @@ -54,7 +54,7 @@ class IncomingMetadataInterceptor( } val gctx = GameContext( - masterVersionUtils.getEnabledMasterVersion(spoofingMasterVersion), + masterVersionUtils.getValidMasterVersion(spoofingMasterVersion), // クライアントが Idempotency-Key を必ず設定してくるとは限らないので、未設定の場合はサーバ側でユニークキーを発行し、毎回異なるリクエストとして扱う idempotencyKey ?: UUID.randomUUID(), Dateline.DEFAULT, diff --git a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/utils/MasterVersionUtils.kt b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/utils/MasterVersionUtils.kt index 5670c2d..5b481ee 100644 --- a/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/utils/MasterVersionUtils.kt +++ b/app/adapter/src/main/kotlin/net/averak/gsync/adapter/handler/utils/MasterVersionUtils.kt @@ -13,18 +13,18 @@ class MasterVersionUtils( ) { @Throws(GsyncException::class) - fun getEnabledMasterVersion(spoofingMasterVersion: UUID?): UUID { + fun getValidMasterVersion(spoofingMasterVersion: UUID?): UUID { return if (spoofingMasterVersion == null) { val dtos = masterVersionMapper.selectByExample( MasterVersionExample().apply { - createCriteria().andIsEnabledEqualTo(true) + createCriteria().andIsValidEqualTo(true) }, ) if (dtos.isEmpty()) { - throw GsyncException(ErrorCode.ENABLED_MASTER_VERSION_DEFINITION_IS_NOT_FOUND) + throw GsyncException(ErrorCode.VALID_MASTER_VERSION_DEFINITION_IS_NOT_FOUND) } if (dtos.size > 1) { - throw GsyncException(ErrorCode.MULTIPLE_ENABLED_MASTER_VERSIONS_ARE_DEFINED) + throw GsyncException(ErrorCode.MULTIPLE_VALID_MASTER_VERSIONS_ARE_DEFINED) } UUID.fromString(dtos[0].version) } else { diff --git a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/utils/MasterVersionUtils_UT.groovy b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/utils/MasterVersionUtils_UT.groovy index bb5f18d..4eadae7 100644 --- a/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/utils/MasterVersionUtils_UT.groovy +++ b/app/adapter/src/test/groovy/net/averak/gsync/adapter/handler/utils/MasterVersionUtils_UT.groovy @@ -14,12 +14,12 @@ class MasterVersionUtils_UT extends AbstractDatabaseSpec { @Autowired MasterVersionUtils sut - def "getEnabledMasterVersion: 正常系 - 有効なマスターバージョンを取得できる"() { + def "getValidMasterVersion: 正常系 - 有効なマスターバージョンを取得できる"() { given: testcase.given() when: - final actual = this.sut.getEnabledMasterVersion(testcase.when.spoofingMasterVersion) + final actual = this.sut.getValidMasterVersion(testcase.when.spoofingMasterVersion) then: testcase.then(actual) @@ -30,8 +30,8 @@ class MasterVersionUtils_UT extends AbstractDatabaseSpec { name : "有効なマスターバージョンが1つだけ存在する場合、正常に取得できる", given: () -> { Fixture.setup( - Faker.fake(MasterVersionDto, [version: Faker.uuidv5("m1").toString(), isEnabled: true]), - Faker.fake(MasterVersionDto, [version: Faker.uuidv5("m2").toString(), isEnabled: false]), + Faker.fake(MasterVersionDto, [version: Faker.uuidv5("m1").toString(), isValid: true]), + Faker.fake(MasterVersionDto, [version: Faker.uuidv5("m2").toString(), isValid: false]), ) }, when : [ @@ -56,12 +56,12 @@ class MasterVersionUtils_UT extends AbstractDatabaseSpec { ] } - def "getEnabledMasterVersion: 異常系"() { + def "getValidMasterVersion: 異常系"() { given: testcase.given() when: - this.sut.getEnabledMasterVersion(testcase.when.spoofingMasterVersion) + this.sut.getValidMasterVersion(testcase.when.spoofingMasterVersion) then: final ex = thrown(GsyncException) @@ -73,15 +73,15 @@ class MasterVersionUtils_UT extends AbstractDatabaseSpec { name : "有効なマスターバージョンが複数存在する場合", given: () -> { Fixture.setup( - Faker.fake(MasterVersionDto, [version: Faker.uuidv5("m1").toString(), isEnabled: true]), - Faker.fake(MasterVersionDto, [version: Faker.uuidv5("m2").toString(), isEnabled: true]), + Faker.fake(MasterVersionDto, [version: Faker.uuidv5("m1").toString(), isValid: true]), + Faker.fake(MasterVersionDto, [version: Faker.uuidv5("m2").toString(), isValid: true]), ) }, when : [ spoofingMasterVersion: null, ], then : (GsyncException v) -> { - Assert.exceptionIs(v, new GsyncException(ErrorCode.MULTIPLE_ENABLED_MASTER_VERSIONS_ARE_DEFINED)) + Assert.exceptionIs(v, new GsyncException(ErrorCode.MULTIPLE_VALID_MASTER_VERSIONS_ARE_DEFINED)) return true }, ], @@ -89,15 +89,15 @@ class MasterVersionUtils_UT extends AbstractDatabaseSpec { name : "有効なマスターバージョンが1つも存在しない場合", given: () -> { Fixture.setup( - Faker.fake(MasterVersionDto, [version: Faker.uuidv5("m1").toString(), isEnabled: false]), - Faker.fake(MasterVersionDto, [version: Faker.uuidv5("m2").toString(), isEnabled: false]), + Faker.fake(MasterVersionDto, [version: Faker.uuidv5("m1").toString(), isValid: false]), + Faker.fake(MasterVersionDto, [version: Faker.uuidv5("m2").toString(), isValid: false]), ) }, when : [ spoofingMasterVersion: null, ], then : (GsyncException v) -> { - Assert.exceptionIs(v, new GsyncException(ErrorCode.ENABLED_MASTER_VERSION_DEFINITION_IS_NOT_FOUND)) + Assert.exceptionIs(v, new GsyncException(ErrorCode.VALID_MASTER_VERSION_DEFINITION_IS_NOT_FOUND)) return true }, ], diff --git a/app/core/src/main/kotlin/net/averak/gsync/core/exception/ErrorCode.kt b/app/core/src/main/kotlin/net/averak/gsync/core/exception/ErrorCode.kt index 2e5dbff..48f5e7e 100644 --- a/app/core/src/main/kotlin/net/averak/gsync/core/exception/ErrorCode.kt +++ b/app/core/src/main/kotlin/net/averak/gsync/core/exception/ErrorCode.kt @@ -3,8 +3,8 @@ package net.averak.gsync.core.exception enum class ErrorCode(val summary: String) { UNKNOWN("Unknown error is thrown."), - ENABLED_MASTER_VERSION_DEFINITION_IS_NOT_FOUND("Enabled master version definition is not found."), - MULTIPLE_ENABLED_MASTER_VERSIONS_ARE_DEFINED("Multiple enabled master versions are defined."), + VALID_MASTER_VERSION_DEFINITION_IS_NOT_FOUND("Valid master version definition is not found."), + MULTIPLE_VALID_MASTER_VERSIONS_ARE_DEFINED("Multiple valid master versions are defined."), REQUIRED_CLIENT_VERSION_DEFINITION_IS_NOT_FOUND("Required client version definition is not found."), PLATFORM_MUST_BE_SPECIFIED("Platform must be specified."), diff --git a/app/infrastructure/src/test/groovy/net/averak/gsync/infrastructure/redis/RedisClient_UT.groovy b/app/infrastructure/src/test/groovy/net/averak/gsync/infrastructure/redis/RedisClient_UT.groovy index b29f44b..165449b 100644 --- a/app/infrastructure/src/test/groovy/net/averak/gsync/infrastructure/redis/RedisClient_UT.groovy +++ b/app/infrastructure/src/test/groovy/net/averak/gsync/infrastructure/redis/RedisClient_UT.groovy @@ -4,7 +4,6 @@ import net.averak.gsync.testkit.AbstractDatabaseSpec import org.springframework.beans.factory.annotation.Autowired import org.springframework.transaction.annotation.Transactional -@Transactional class RedisClient_UT extends AbstractDatabaseSpec { @Autowired @@ -191,6 +190,7 @@ class RedisClient_UT extends AbstractDatabaseSpec { this.redis.get("k2") == null } + @Transactional def "transaction: トランザクション内で処理を実行する"() { when: final result = this.sut.transaction { diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1.java index f0435fc..50f3b11 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: player_api/echo.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.player_api; /** @@ -25,6 +24,10 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new EchoEchoV1(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_descriptor; } @@ -76,6 +79,10 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new Request(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_Request_descriptor; } @@ -228,12 +235,10 @@ public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request par throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Request parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -627,6 +632,10 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new Response(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return net.averak.gsync.schema.protobuf.player_api.EchoOuterClass.internal_static_gsync_player_api_EchoEchoV1_Response_descriptor; } @@ -639,7 +648,6 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response.Builder.class); } - private int bitField0_; public static final int MESSAGE_FIELD_NUMBER = 1; @SuppressWarnings("serial") private volatile java.lang.Object message_ = ""; @@ -686,7 +694,7 @@ public com.google.protobuf.ByteString getMessageBytes() { */ @java.lang.Override public boolean hasTimestamp() { - return ((bitField0_ & 0x00000001) != 0); + return timestamp_ != null; } /** * .google.protobuf.Timestamp timestamp = 2; @@ -723,7 +731,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, message_); } - if (((bitField0_ & 0x00000001) != 0)) { + if (timestamp_ != null) { output.writeMessage(2, getTimestamp()); } getUnknownFields().writeTo(output); @@ -739,7 +747,7 @@ public int getSerializedSize() { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, message_); } - if (((bitField0_ & 0x00000001) != 0)) { + if (timestamp_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getTimestamp()); } size += getUnknownFields().getSerializedSize(); @@ -824,12 +832,10 @@ public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response pa throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -888,17 +894,12 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF // Construct using // net.averak.gsync.schema.protobuf.player_api.EchoEchoV1.Response.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getTimestampFieldBuilder(); - } + } @java.lang.Override public Builder clear() { @@ -948,12 +949,9 @@ private void buildPartial0(net.averak.gsync.schema.protobuf.player_api.EchoEchoV if (((from_bitField0_ & 0x00000001) != 0)) { result.message_ = message_; } - int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000002) != 0)) { result.timestamp_ = timestampBuilder_ == null ? timestamp_ : timestampBuilder_.build(); - to_bitField0_ |= 0x00000001; } - result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -1197,10 +1195,8 @@ public Builder mergeTimestamp(com.google.protobuf.Timestamp value) { } else { timestampBuilder_.mergeFrom(value); } - if (timestamp_ != null) { - bitField0_ |= 0x00000002; - onChanged(); - } + bitField0_ |= 0x00000002; + onChanged(); return this; } /** @@ -1396,12 +1392,10 @@ public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseFrom(j com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static net.averak.gsync.schema.protobuf.player_api.EchoEchoV1 parseDelimitedFrom(java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, extensionRegistry); diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1OrBuilder.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1OrBuilder.java index 784431b..34b3941 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1OrBuilder.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoEchoV1OrBuilder.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: player_api/echo.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.player_api; public interface EchoEchoV1OrBuilder diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoOuterClass.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoOuterClass.java index 5fc3c89..e9399b9 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoOuterClass.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/EchoOuterClass.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: player_api/echo.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.player_api; public final class EchoOuterClass { diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1.java index 5d81d98..bc6b0a9 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: player_api/player_storage.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.player_api; /** @@ -25,6 +24,10 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new PlayerStorageClearV1(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_descriptor; } @@ -93,6 +96,10 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new Request(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_Request_descriptor; } @@ -105,7 +112,6 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request.Builder.class); } - private int bitField0_; public static final int CRITERIA_FIELD_NUMBER = 1; private net.averak.gsync.schema.protobuf.resource.player_storage.Criteria criteria_; /** @@ -115,7 +121,7 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF */ @java.lang.Override public boolean hasCriteria() { - return ((bitField0_ & 0x00000001) != 0); + return criteria_ != null; } /** * .gsync.resource.player_storage.Criteria criteria = 1; @@ -190,7 +196,7 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (((bitField0_ & 0x00000001) != 0)) { + if (criteria_ != null) { output.writeMessage(1, getCriteria()); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(previousRevision_)) { @@ -206,7 +212,7 @@ public int getSerializedSize() { return size; size = 0; - if (((bitField0_ & 0x00000001) != 0)) { + if (criteria_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCriteria()); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(previousRevision_)) { @@ -294,12 +300,10 @@ public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.R throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -359,17 +363,12 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF // Construct using // net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getCriteriaFieldBuilder(); - } + } @java.lang.Override public Builder clear() { @@ -417,15 +416,12 @@ public net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request private void buildPartial0( net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Request result) { int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { result.criteria_ = criteriaBuilder_ == null ? criteria_ : criteriaBuilder_.build(); - to_bitField0_ |= 0x00000001; } if (((from_bitField0_ & 0x00000002) != 0)) { result.previousRevision_ = previousRevision_; } - result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -596,10 +592,8 @@ public Builder mergeCriteria(net.averak.gsync.schema.protobuf.resource.player_st } else { criteriaBuilder_.mergeFrom(value); } - if (criteria_ != null) { - bitField0_ |= 0x00000001; - onChanged(); - } + bitField0_ |= 0x00000001; + onChanged(); return this; } /** @@ -823,6 +817,10 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new Response(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageClearV1_Response_descriptor; } @@ -975,12 +973,10 @@ public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.R throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1.Response parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -1412,12 +1408,10 @@ public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 p com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageClearV1 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1OrBuilder.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1OrBuilder.java index cd2fcc2..0f5e27b 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1OrBuilder.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageClearV1OrBuilder.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: player_api/player_storage.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.player_api; public interface PlayerStorageClearV1OrBuilder diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageOuterClass.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageOuterClass.java index 75ea527..4d42546 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageOuterClass.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageOuterClass.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: player_api/player_storage.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.player_api; public final class PlayerStorageOuterClass { diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1.java index 59f8e44..83004cb 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: player_api/player_storage.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.player_api; /** @@ -25,6 +24,10 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new PlayerStorageSearchV1(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_descriptor; } @@ -80,6 +83,10 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new Request(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_Request_descriptor; } @@ -92,7 +99,6 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request.Builder.class); } - private int bitField0_; public static final int CRITERIA_FIELD_NUMBER = 1; private net.averak.gsync.schema.protobuf.resource.player_storage.Criteria criteria_; /** @@ -102,7 +108,7 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF */ @java.lang.Override public boolean hasCriteria() { - return ((bitField0_ & 0x00000001) != 0); + return criteria_ != null; } /** * .gsync.resource.player_storage.Criteria criteria = 1; @@ -140,7 +146,7 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (((bitField0_ & 0x00000001) != 0)) { + if (criteria_ != null) { output.writeMessage(1, getCriteria()); } getUnknownFields().writeTo(output); @@ -153,7 +159,7 @@ public int getSerializedSize() { return size; size = 0; - if (((bitField0_ & 0x00000001) != 0)) { + if (criteria_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCriteria()); } size += getUnknownFields().getSerializedSize(); @@ -234,12 +240,10 @@ public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1. throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -299,17 +303,12 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF // Construct using // net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getCriteriaFieldBuilder(); - } + } @java.lang.Override public Builder clear() { @@ -356,12 +355,9 @@ public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request private void buildPartial0( net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Request result) { int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { result.criteria_ = criteriaBuilder_ == null ? criteria_ : criteriaBuilder_.build(); - to_bitField0_ |= 0x00000001; } - result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -522,10 +518,8 @@ public Builder mergeCriteria(net.averak.gsync.schema.protobuf.resource.player_st } else { criteriaBuilder_.mergeFrom(value); } - if (criteria_ != null) { - bitField0_ |= 0x00000001; - onChanged(); - } + bitField0_ |= 0x00000001; + onChanged(); return this; } /** @@ -679,6 +673,10 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new Response(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSearchV1_Response_descriptor; } @@ -835,12 +833,10 @@ public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1. throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1.Response parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -1468,12 +1464,10 @@ public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSearchV1 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1OrBuilder.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1OrBuilder.java index d108240..2bd1dba 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1OrBuilder.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSearchV1OrBuilder.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: player_api/player_storage.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.player_api; public interface PlayerStorageSearchV1OrBuilder diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1.java index aacb21e..7c88ec8 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: player_api/player_storage.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.player_api; /** @@ -25,6 +24,10 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new PlayerStorageSetV1(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_descriptor; } @@ -93,6 +96,10 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new Request(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_Request_descriptor; } @@ -105,7 +112,6 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request.Builder.class); } - private int bitField0_; public static final int ENTRY_FIELD_NUMBER = 1; private net.averak.gsync.schema.protobuf.resource.player_storage.Entry entry_; /** @@ -115,7 +121,7 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF */ @java.lang.Override public boolean hasEntry() { - return ((bitField0_ & 0x00000001) != 0); + return entry_ != null; } /** * .gsync.resource.player_storage.Entry entry = 1; @@ -190,7 +196,7 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (((bitField0_ & 0x00000001) != 0)) { + if (entry_ != null) { output.writeMessage(1, getEntry()); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(previousRevision_)) { @@ -206,7 +212,7 @@ public int getSerializedSize() { return size; size = 0; - if (((bitField0_ & 0x00000001) != 0)) { + if (entry_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getEntry()); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(previousRevision_)) { @@ -294,12 +300,10 @@ public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Req throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -359,17 +363,12 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF // Construct using // net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getEntryFieldBuilder(); - } + } @java.lang.Override public Builder clear() { @@ -416,15 +415,12 @@ public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request bu private void buildPartial0(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Request result) { int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { result.entry_ = entryBuilder_ == null ? entry_ : entryBuilder_.build(); - to_bitField0_ |= 0x00000001; } if (((from_bitField0_ & 0x00000002) != 0)) { result.previousRevision_ = previousRevision_; } - result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -595,10 +591,8 @@ public Builder mergeEntry(net.averak.gsync.schema.protobuf.resource.player_stora } else { entryBuilder_.mergeFrom(value); } - if (entry_ != null) { - bitField0_ |= 0x00000001; - onChanged(); - } + bitField0_ |= 0x00000001; + onChanged(); return this; } /** @@ -839,6 +833,10 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new Response(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return net.averak.gsync.schema.protobuf.player_api.PlayerStorageOuterClass.internal_static_gsync_player_api_PlayerStorageSetV1_Response_descriptor; } @@ -851,7 +849,6 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response.Builder.class); } - private int bitField0_; public static final int ENTRY_FIELD_NUMBER = 1; private net.averak.gsync.schema.protobuf.resource.player_storage.Entry entry_; /** @@ -861,7 +858,7 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF */ @java.lang.Override public boolean hasEntry() { - return ((bitField0_ & 0x00000001) != 0); + return entry_ != null; } /** * .gsync.resource.player_storage.Entry entry = 1; @@ -936,7 +933,7 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (((bitField0_ & 0x00000001) != 0)) { + if (entry_ != null) { output.writeMessage(1, getEntry()); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextRevision_)) { @@ -952,7 +949,7 @@ public int getSerializedSize() { return size; size = 0; - if (((bitField0_ & 0x00000001) != 0)) { + if (entry_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getEntry()); } if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextRevision_)) { @@ -1040,12 +1037,10 @@ public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Res throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -1105,17 +1100,12 @@ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetF // Construct using // net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getEntryFieldBuilder(); - } + } @java.lang.Override public Builder clear() { @@ -1162,15 +1152,12 @@ public net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response b private void buildPartial0(net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1.Response result) { int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { result.entry_ = entryBuilder_ == null ? entry_ : entryBuilder_.build(); - to_bitField0_ |= 0x00000001; } if (((from_bitField0_ & 0x00000002) != 0)) { result.nextRevision_ = nextRevision_; } - result.bitField0_ |= to_bitField0_; } @java.lang.Override @@ -1341,10 +1328,8 @@ public Builder mergeEntry(net.averak.gsync.schema.protobuf.resource.player_stora } else { entryBuilder_.mergeFrom(value); } - if (entry_ != null) { - bitField0_ |= 0x00000001; - onChanged(); - } + bitField0_ |= 0x00000001; + onChanged(); return this; } /** @@ -1620,12 +1605,10 @@ public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 par com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static net.averak.gsync.schema.protobuf.player_api.PlayerStorageSetV1 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1OrBuilder.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1OrBuilder.java index 930fa84..5386764 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1OrBuilder.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/player_api/PlayerStorageSetV1OrBuilder.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: player_api/player_storage.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.player_api; public interface PlayerStorageSetV1OrBuilder diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Criteria.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Criteria.java index 611798a..960339f 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Criteria.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Criteria.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: resource/player_storage.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.resource.player_storage; /** @@ -27,6 +26,10 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new Criteria(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return net.averak.gsync.schema.protobuf.resource.player_storage.PlayerStorage.internal_static_gsync_resource_player_storage_Criteria_descriptor; } @@ -315,12 +318,10 @@ public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static net.averak.gsync.schema.protobuf.resource.player_storage.Criteria parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/CriteriaOrBuilder.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/CriteriaOrBuilder.java index 4fafdca..ef70026 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/CriteriaOrBuilder.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/CriteriaOrBuilder.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: resource/player_storage.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.resource.player_storage; public interface CriteriaOrBuilder diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Entry.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Entry.java index 1070592..447c66b 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Entry.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/Entry.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: resource/player_storage.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.resource.player_storage; /** @@ -27,6 +26,10 @@ protected java.lang.Object newInstance(UnusedPrivateParameter unused) { return new Entry(); } + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return net.averak.gsync.schema.protobuf.resource.player_storage.PlayerStorage.internal_static_gsync_resource_player_storage_Entry_descriptor; } @@ -203,12 +206,10 @@ public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry par com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry parseDelimitedFrom( java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static net.averak.gsync.schema.protobuf.resource.player_storage.Entry parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/EntryOrBuilder.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/EntryOrBuilder.java index 8a5c3f2..cfe3020 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/EntryOrBuilder.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/EntryOrBuilder.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: resource/player_storage.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.resource.player_storage; public interface EntryOrBuilder diff --git a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/PlayerStorage.java b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/PlayerStorage.java index cf6097d..68892a3 100644 --- a/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/PlayerStorage.java +++ b/protobuf/src/main/java/net/averak/gsync/schema/protobuf/resource/player_storage/PlayerStorage.java @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: resource/player_storage.proto -// Protobuf Java Version: 3.25.1 package net.averak.gsync.schema.protobuf.resource.player_storage; public final class PlayerStorage { diff --git a/src/main/resources/dao/base/MasterVersionBaseMapper.xml b/src/main/resources/dao/base/MasterVersionBaseMapper.xml index 6ab5bbf..cfe6267 100644 --- a/src/main/resources/dao/base/MasterVersionBaseMapper.xml +++ b/src/main/resources/dao/base/MasterVersionBaseMapper.xml @@ -8,7 +8,7 @@ --> - + @@ -85,7 +85,7 @@ WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> - `version`, `is_enabled`, `comment`, `created_at`, `updated_at` + `version`, `is_valid`, `comment`, `created_at`, `updated_at`