GS2-Distributor Deploy/CDK 레퍼런스
엔티티
Deploy 처리에서 조작 대상이 되는 리소스
Namespace
네임스페이스
네임스페이스는 하나의 프로젝트 내에서 동일한 서비스를 서로 다른 용도로 여러 개 이용하기 위한 엔티티입니다.
GS2의 각 서비스는 네임스페이스 단위로 관리됩니다. 네임스페이스가 다르면 동일한 서비스라도 완전히 독립된 데이터 공간으로 취급됩니다.
따라서 각 서비스의 이용을 시작하려면 먼저 네임스페이스를 생성해야 합니다.
Request
리소스 생성·갱신 요청
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| description | string | ~ 1024자 | 설명문 | |||
| transactionSettingV2 | TransactionSettingV2 | 트랜잭션 설정(V2) 이 네임스페이스가 발행하는 트랜잭션을 어떻게 실행할지 정하는 설정입니다. 설정하는 항목은 실행에 사용하는 GS2-Distributor 네임스페이스와, 트랜잭션에 포함된 액션을 한 건씩 실행해 앞서 실행된 액션의 결과를 후속 액션에서 사용할 수 있게 할지, 한꺼번에 동시에 실행해 응답 시간을 줄일지의 2가지뿐입니다. 새로 생성하는 네임스페이스에서는 이쪽을 설정하십시오. 이것으로 대체되어 비권장이 된 transactionSetting은 이쪽이 설정되어 있지 않은 동안에만 사용됩니다. | ||||
| assumeUserId | string | ~ 1024자 | GS2-Identifier 사용자 GRN | |||
| autoRunStampSheetNotification | NotificationSetting | ✓ | 트랜잭션 자동 실행이 완료되었을 때의 푸시 알림(구 사양) 트랜잭션이 서버사이드에서 자동 실행 완료되었을 때 GS2-Gateway를 통해 푸시 알림을 전송하기 위한 설정입니다. 이는 구 사양이며, 신 사양에서는 autoRunTransactionNotification을 사용하세요. | |||
| autoRunTransactionNotification | NotificationSetting | ✓ | 트랜잭션 자동 실행이 완료되었을 때의 푸시 알림 분산 트랜잭션이 서버사이드에서 자동 실행 완료되었을 때 GS2-Gateway를 통해 푸시 알림을 전송하기 위한 설정입니다. 트랜잭션 결과를 클라이언트에 통지하여 로컬 상태를 적절히 갱신할 수 있도록 합니다. | |||
| logSetting | LogSetting | 로그 출력 설정 디스트리뷰터 조작의 로그 데이터를 GS2-Log에 출력하기 위한 설정입니다. GS2-Log의 네임스페이스를 지정함으로써 리소스 배포·입수 액션 실행·트랜잭션 처리의 API 요청·응답 로그를 수집할 수 있습니다. |
GetAttr
!GetAttr 태그로 취득 가능한 리소스 생성 결과
| 타입 | 설명 | |
|---|---|---|
| Item | Namespace | 생성한 네임스페이스 |
구현 예제
Type: GS2::Distributor::Namespace
Properties:
Name: namespace-0001
Description: null
TransactionSettingV2: null
AssumeUserId: grn:gs2::YourOwnerId:identifier:user:user-0001
AutoRunStampSheetNotification: null
AutoRunTransactionNotification: null
LogSetting:
LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001import (
"github.com/gs2io/gs2-golang-cdk/core"
"github.com/gs2io/gs2-golang-cdk/distributor"
"github.com/openlyinc/pointy"
)
SampleStack := core.NewStack()
distributor.NewNamespace(
&SampleStack,
"namespace-0001",
distributor.NamespaceOptions{
AssumeUserId: pointy.String("grn:gs2::YourOwnerId:identifier:user:user-0001"),
LogSetting: &core.LogSetting{
LoggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
},
)
println(SampleStack.Yaml()) // Generate Templateclass SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
new \Gs2Cdk\Distributor\Model\Namespace_(
stack: $this,
name: "namespace-0001",
options: new \Gs2Cdk\Distributor\Model\Options\NamespaceOptions(
assumeUserId: "grn:gs2::YourOwnerId:identifier:user:user-0001",
logSetting: new \Gs2Cdk\Core\Model\LogSetting(
loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
)
)
);
}
}
print((new SampleStack())->yaml()); // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.distributor.model.Namespace(
this,
"namespace-0001",
new io.gs2.cdk.distributor.model.options.NamespaceOptions()
.withAssumeUserId("grn:gs2::YourOwnerId:identifier:user:user-0001")
.withLogSetting(new io.gs2.cdk.core.model.LogSetting(
"grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
))
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Templatepublic class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Distributor.Model.Namespace(
stack: this,
name: "namespace-0001",
options: new Gs2Cdk.Gs2Distributor.Model.Options.NamespaceOptions
{
assumeUserId = "grn:gs2::YourOwnerId:identifier:user:user-0001",
logSetting = new Gs2Cdk.Core.Model.LogSetting(
loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
)
}
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Templateimport core from "@/gs2cdk/core";
import distributor from "@/gs2cdk/distributor";
class SampleStack extends core.Stack
{
public constructor() {
super();
new distributor.model.Namespace(
this,
"namespace-0001",
{
assumeUserId: "grn:gs2::YourOwnerId:identifier:user:user-0001",
logSetting: new core.LogSetting(
"grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
)
}
);
}
}
console.log(new SampleStack().yaml()); // Generate Template
from gs2_cdk import Stack, core, distributor
class SampleStack(Stack):
def __init__(self):
super().__init__()
distributor.Namespace(
stack=self,
name='namespace-0001',
options=distributor.NamespaceOptions(
assume_user_id='grn:gs2::YourOwnerId:identifier:user:user-0001',
log_setting=core.LogSetting(
logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
),
),
)
print(SampleStack().yaml()) # Generate TemplateTransactionSettingV2
트랜잭션 설정(V2)
트랜잭션 설정(V2)은 네임스페이스가 발행하는 트랜잭션을 어떻게 실행할지 정하는 설정입니다.
설정하는 항목은 다음 2가지뿐입니다.
distributorNamespaceId: 트랜잭션 실행에 사용하는 GS2-Distributor 네임스페이스enableParallelExecution: 트랜잭션에 포함된 액션을 한 건씩 실행할지, 한꺼번에 동시에 실행할지
어느 쪽을 선택하더라도 트랜잭션은 발행된 시점에 서버가 실행하며, 성패는 트랜잭션 전체가 하나입니다. 어떤 액션이 실패한 경우에는 그때까지 실행된 액션까지 함께 취소되어 하나도 반영되지 않습니다. 트랜잭션의 실행 방법에 관한 그 밖의 항목은 권장 구성으로 고정되어 있으므로 설정할 필요가 없습니다.
한 건씩 실행하는 경우(기본값 / enableParallelExecution이 false), 각 액션은 앞서 실행된 액션의 쓰기를 바탕으로 동작합니다. 액션은 verify・consume・acquire 순서로 실행되며, 다음을 할 수 있습니다.
- 하나의 트랜잭션 안에서 같은 행을 여러 액션에서 갱신한다(한꺼번에 동시에 실행하는 경우에는 실패합니다)
- 앞서 실행된 액션의 쓰기를 읽는다. List나 Query의 결과에서도, 중첩된 트랜잭션 내부에서도 읽을 수 있습니다
%{Gs2Xxx:ActionName.path[0].field}를 사용해 앞서 실행된 verify나 consume 액션의 결과를 후속 verify・consume・acquire 액션의 인수로 넘긴다
그 대신 응답 시간은 각 액션의 실행 시간의 합계가 되고, 하나의 트랜잭션에 포함할 수 있는 액션은 최대 20건이 됩니다. 또한 각 페이즈 안에서의 실행 순서는 액션 이름, 그다음 대상 리소스로 결정되므로 요청에 나열한 순서로 실행 순서를 지정할 수는 없습니다. 실행은 가장 먼저 실패한 액션에서 중지됩니다.
한꺼번에 동시에 실행하는 경우(enableParallelExecution이 true), 액션은 동일한 데이터 스냅샷에 대해 병렬로 실행되므로 응답 시간은 가장 느린 액션 1건분이면 되고 액션 수의 상한도 없습니다.
그 대신 어떤 액션에서 다른 액션의 쓰기를 읽을 수 없으며, 두 액션이 같은 행을 갱신하면 트랜잭션은 database:transaction:same.resource(400)로 실패합니다. 같은 트랜잭션 안에서 두 개 이상의 액션이 같은 데이터를 갱신하지 않는다는 것을 보장할 수 있는 경우에만 선택하십시오. %{...}는 앞선 단계(verify → consume → acquire 순)의 결과만 참조할 수 있으며, 같은 단계 안의 액션에 대한 참조는 해결되지 않고 그대로 남습니다. %{...}를 포함하는 단계는 앞선 단계의 완료를 기다린 후 실행되므로 그만큼 응답 시간이 길어집니다.
트랜잭션 설정은 트랜잭션 설정(V2)으로 대체된 비권장 설정으로, 트랜잭션 설정(V2)이 존재하지 않던 시기에 생성된 네임스페이스를 위해 남아 있습니다. 트랜잭션 설정(V2)이 설정되어 있지 않은 동안에만 적용되며, 트랜잭션 설정(V2)을 설정하면 그쪽이 우선합니다. 트랜잭션 설정에서 가능했던, 트랜잭션을 클라이언트 실행 스탬프 시트로 실행하는 것・GS2-Distributor를 통한 AutoRun의 비동기 실행・입수 액션의 GS2-JobQueue로의 통합이라는 3가지 동작은 여기에서는 의도적으로 제공하지 않습니다.
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| distributorNamespaceId | string | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024자 | 트랜잭션 실행에 사용하는 GS2-Distributor 네임스페이스 GRN | ||
| enableParallelExecution | bool | false | 액션을 직렬이 아닌 병렬로 실행할지 여부 |
NotificationSetting
푸시 통지에 관한 설정
GS2의 마이크로서비스 내에서 어떠한 이벤트가 발생했을 때, 푸시 통지를 전송하기 위한 설정입니다.
여기서 말하는 푸시 통지란 GS2-Gateway가 제공하는 WebSocket 인터페이스를 경유하는 처리이며, 스마트폰의 푸시 통지와는 성질이 다릅니다.
예를 들어 매치메이킹이 완료되었을 때나 친구 요청이 도착했을 때 등, 게임 클라이언트의 조작과는 관계없이 상태가 변화했을 때 GS2-Gateway를 경유하여 푸시 통지를 함으로써, 게임 클라이언트는 상태 변화를 감지할 수 있습니다.
GS2-Gateway의 푸시 통지는 통지 대상 디바이스가 오프라인이었을 때 추가 처리로 모바일 푸시 통지를 전송할 수 있습니다.
모바일 푸시 통지를 잘 활용하면, 매치메이킹 중에 게임을 종료하더라도 모바일 푸시 통지를 사용하여 플레이어에게 알리고, 게임으로 복귀하도록 하는 흐름을 구현할 수 있을 가능성이 있습니다.
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| gatewayNamespaceId | string | “grn:gs2:{region}:{ownerId}:gateway:default” | ~ 1024자 | 푸시 통지에 사용할 GS2-Gateway의 네임스페이스 “grn:gs2:“로 시작하는 GRN 형식으로 GS2-Gateway의 네임스페이스 ID를 지정합니다. | ||||||||
| enableTransferMobileNotification | bool? | false | 모바일 푸시 통지로 전달할지 여부 이 통지를 전송하려 할 때, 통지 대상 디바이스가 오프라인일 경우 모바일 푸시 통지로 전달할지 여부를 지정합니다. | |||||||||
| sound | string | {enableTransferMobileNotification} == true | ~ 1024자 | 모바일 푸시 통지에서 사용할 사운드 파일명 여기서 지정한 사운드 파일명은 모바일 푸시 통지를 전송할 때 사용되며, 특별한 사운드로 통지를 출력할 수 있습니다. ※ enableTransferMobileNotification이(가) true 이면 활성화 | ||||||||
| mobileNotificationMessages | List<MobileNotificationMessage> | {enableTransferMobileNotification} == true | 0 ~ 100 items | 모바일 푸시 알림으로 전달할 때의 언어별 제목과 본문 오프라인 상태인 플레이어에게 모바일 푸시 알림으로 전달할 때 사용하는 언어별 제목과 본문입니다. 디바이스 토큰에 등록된 locale과 일치하는 엔트리 → default → 첫 번째 엔트리 순으로 채택합니다.설정하지 않은 경우에는 통지 payload의 mobile 배열을, 그것도 없으면 payload를 그대로 본문으로 사용합니다.※ enableTransferMobileNotification이(가) true 이면 활성화 | ||||||||
| enable | 문자열 열거형 enum { “Enabled”, “Disabled” } | “Enabled” | 푸시 통지를 활성화할지 여부
|
LogSetting
로그의 출력 설정
로그 데이터의 출력 설정을 관리합니다. 이 타입은 로그 데이터를 출력하는 데 사용되는 로그 네임스페이스의 식별자(Namespace ID)를 보유합니다.
로그 네임스페이스 ID는 로그 데이터를 집계하여 저장할 대상 GS2-Log 의 네임스페이스를 지정합니다.
이 설정을 통해 이 네임스페이스 이하의 API 요청·응답 로그 데이터가 대상 GS2-Log 로 출력됩니다.
GS2-Log 에서는 실시간으로 로그가 제공되며, 시스템 모니터링, 분석, 디버깅 등에 활용할 수 있습니다.
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| loggingNamespaceId | string | ✓ | ~ 1024자 | 로그를 출력할 GS2-Log의 네임스페이스
GRN
“grn:gs2:“로 시작하는 GRN 형식의 ID로 지정해야 합니다. |
TransactionSetting
트랜잭션 설정
트랜잭션 설정은 비권장입니다. 트랜잭션 설정(V2)이 이를 대체합니다. 트랜잭션 설정(V2)이 존재하지 않던 시기에 생성된 네임스페이스를 위해 남아 있으며, 트랜잭션 설정(V2)이 설정되어 있지 않은 동안에만 적용됩니다. 새로 생성하는 네임스페이스에서는 사용하지 마십시오.
이 설정은 트랜잭션 실행에 관련된 요소――자동 실행(AutoRun), 원자적 실행(AtomicCommit), GS2-Distributor를 이용한 비동기 실행, 스크립트 결과의 일괄 적용, GS2-JobQueue를 통한 입수 액션의 비동기화, 직렬 실행――를 각각 개별 항목으로 공개하고 있기 때문에 권장 구성 이외의 조합도 만들 수 있습니다. 그 권장 구성을 하나의 설정으로 정리한 것이 트랜잭션 설정(V2)입니다. 트랜잭션 설정을 계속 사용하는 것은, 트랜잭션 설정(V2)이 제공하지 않는 동작――트랜잭션을 클라이언트 실행 스탬프 시트로 실행하는 것, GS2-Distributor를 통한 AutoRun의 비동기 실행, 입수 액션의 GS2-JobQueue로의 통합――에 이미 의존하고 있는 네임스페이스에 한정하십시오.
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| enableAutoRun | bool | false | 발행한 트랜잭션을 서버 사이드에서 자동으로 실행할지 여부 | |||
| enableAtomicCommit | bool | {enableAutoRun} == true | false | 트랜잭션의 실행을 원자적으로 커밋할지 여부 ※ enableAutoRun이(가) true 이면 활성화 | ||
| transactionUseDistributor | bool | {enableAtomicCommit} == true | false | 트랜잭션을 비동기 처리로 실행할지 여부 ※ enableAtomicCommit이(가) true 이면 활성화 | ||
| commitScriptResultInUseDistributor | bool | {transactionUseDistributor} == true | false | 스크립트의 결과 커밋 처리를 비동기 처리로 실행할지 여부 ※ transactionUseDistributor이(가) true 이면 활성화 | ||
| acquireActionUseJobQueue | bool | {enableAtomicCommit} == true | false | 입수 액션을 실행할 때 GS2-JobQueue를 사용할지 여부 ※ enableAtomicCommit이(가) true 이면 활성화 | ||
| enableSequentialExecution | bool | {enableAtomicCommit} == true | false | 원자적 커밋의 액션을 직렬로 실행하여 여러 액션이 같은 행을 갱신할 수 있도록 할지 여부 ※ enableAtomicCommit이(가) true 이면 활성화 | ||
| distributorNamespaceId | string | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024자 | 트랜잭션 실행에 사용하는 GS2-Distributor 네임스페이스 GRN | ||
| queueNamespaceId | string | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024자 | 트랜잭션 실행에 사용하는 GS2-JobQueue의 네임스페이스 GRN |
MobileNotificationMessage
모바일 푸시 알림의 언어별 메시지
통지를 모바일 푸시 알림으로 전달할 때 사용하는 언어별 메시지 목록의 한 요소입니다. 하나의 요소가 하나의 로케일에 대한 제목과 본문을 보유합니다.
채택되는 요소는 Firebase 디바이스 토큰에 등록된 로케일과 locale이 일치하는 요소 → locale이 default인 요소 → 목록의 첫 번째 요소 순으로 선택됩니다.
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| locale | string | ~ 32자 | 메시지의 언어 이 요소가 어떤 언어를 위한 것인지를 나타냅니다. Firebase 디바이스 토큰에 등록된 로케일과 대조됩니다. ja나 en과 같은 임의의 문자열을 지정할 수 있습니다. default는 특별한 값으로, 단말의 로케일과 일치하는 요소가 없을 때 사용되는 폴백 요소임을 나타냅니다. | |||
| title | string | ~ 256자 | 푸시 알림의 제목 이 요소가 채택되었을 때 모바일 푸시 알림의 제목으로 표시되는 텍스트입니다. 생략한 경우에는 통지의 제목이 사용됩니다. | |||
| message | string | ~ 1024자 | 푸시 알림의 본문 이 요소가 채택되었을 때 모바일 푸시 알림의 본문으로 표시되는 텍스트입니다. |
CurrentDistributorMaster
현재 활성화된 배포 모델의 마스터 데이터
현재 네임스페이스 내에서 유효한 배포 모델의 정의를 기술한 마스터 데이터입니다.
GS2에서는 마스터 데이터 관리에 JSON 형식의 파일을 사용합니다.
파일을 업로드함으로써 실제로 서버에 설정을 반영할 수 있습니다.
JSON 파일을 작성하는 방법으로, 관리 콘솔 내에 마스터 데이터 에디터를 제공하고 있습니다.
또한 게임 운영에 더 적합한 도구를 직접 제작하여 적절한 포맷의 JSON 파일을 작성함으로써도 서비스를 이용할 수 있습니다.
JSON 파일 형식에 대해서는 GS2-Distributor 마스터 데이터 레퍼런스를 참조해 주세요.
Request
리소스 생성·갱신 요청
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||||||||
| mode | 문자열 열거형 enum { “direct”, “preUpload” } | “direct” | 업데이트 모드
| |||||||||
| settings | string | {mode} == “direct” | ✓※ | ~ 5242880 바이트 (5MB) | 마스터 데이터 ※ mode이(가) “direct” 이면 필수 | |||||||
| uploadToken | string | {mode} == “preUpload” | ✓※ | ~ 1024자 | 사전 업로드로 획득한 토큰 업로드한 마스터 데이터를 적용하기 위해 사용됩니다. ※ mode이(가) “preUpload” 이면 필수 |
GetAttr
!GetAttr 태그로 취득 가능한 리소스 생성 결과
| 타입 | 설명 | |
|---|---|---|
| Item | CurrentDistributorMaster | 업데이트된 현재 활성화된 배포 모델의 마스터 데이터 |
구현 예제
Type: GS2::Distributor::CurrentDistributorMaster
Properties:
NamespaceName: namespace-0001
Mode: direct
Settings: {
"version": "2019-03-01",
"distributorModels": [
{
"name": "basic",
"metadata": "BASIC",
"inboxNamespaceId": "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001"
},
{
"name": "special",
"metadata": "SPECIAL",
"inboxNamespaceId": "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001",
"whiteListTargetIds": [
"test"
]
}
]
}
UploadToken: nullimport (
"github.com/gs2io/gs2-golang-cdk/core"
"github.com/gs2io/gs2-golang-cdk/distributor"
"github.com/openlyinc/pointy"
)
SampleStack := core.NewStack()
distributor.NewNamespace(
&SampleStack,
"namespace-0001",
distributor.NamespaceOptions{},
).MasterData(
[]distributor.DistributorModel{
distributor.NewDistributorModel(
"basic",
distributor.DistributorModelOptions{
Metadata: pointy.String("BASIC"),
InboxNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001"),
},
),
distributor.NewDistributorModel(
"special",
distributor.DistributorModelOptions{
Metadata: pointy.String("SPECIAL"),
InboxNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001"),
WhiteListTargetIds: []string{
"test",
},
},
),
},
)
println(SampleStack.Yaml()) // Generate Templateclass SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
(new \Gs2Cdk\Distributor\Model\Namespace_(
stack: $this,
name: "namespace-0001"
))->masterData(
[
new \Gs2Cdk\Distributor\Model\DistributorModel(
name:"basic",
options: new \Gs2Cdk\Distributor\Model\Options\DistributorModelOptions(
metadata:"BASIC",
inboxNamespaceId:"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001"
)
),
new \Gs2Cdk\Distributor\Model\DistributorModel(
name:"special",
options: new \Gs2Cdk\Distributor\Model\Options\DistributorModelOptions(
metadata:"SPECIAL",
inboxNamespaceId:"grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001",
whiteListTargetIds:[
"test",
]
)
)
]
);
}
}
print((new SampleStack())->yaml()); // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.distributor.model.Namespace(
this,
"namespace-0001"
).masterData(
Arrays.asList(
new io.gs2.cdk.distributor.model.DistributorModel(
"basic",
new io.gs2.cdk.distributor.model.options.DistributorModelOptions()
.withMetadata("BASIC")
.withInboxNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001")
),
new io.gs2.cdk.distributor.model.DistributorModel(
"special",
new io.gs2.cdk.distributor.model.options.DistributorModelOptions()
.withMetadata("SPECIAL")
.withInboxNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001")
.withWhiteListTargetIds(Arrays.asList(
"test"
))
)
)
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Templatepublic class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Distributor.Model.Namespace(
stack: this,
name: "namespace-0001"
).MasterData(
new Gs2Cdk.Gs2Distributor.Model.DistributorModel[] {
new Gs2Cdk.Gs2Distributor.Model.DistributorModel(
name: "basic",
options: new Gs2Cdk.Gs2Distributor.Model.Options.DistributorModelOptions
{
metadata = "BASIC",
inboxNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001"
}
),
new Gs2Cdk.Gs2Distributor.Model.DistributorModel(
name: "special",
options: new Gs2Cdk.Gs2Distributor.Model.Options.DistributorModelOptions
{
metadata = "SPECIAL",
inboxNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001",
whiteListTargetIds = new string[]
{
"test"
}
}
)
}
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Templateimport core from "@/gs2cdk/core";
import distributor from "@/gs2cdk/distributor";
class SampleStack extends core.Stack
{
public constructor() {
super();
new distributor.model.Namespace(
this,
"namespace-0001",
).masterData(
[
new distributor.model.DistributorModel(
"basic",
{
metadata: "BASIC",
inboxNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001"
}
),
new distributor.model.DistributorModel(
"special",
{
metadata: "SPECIAL",
inboxNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001",
whiteListTargetIds: [
"test",
]
}
)
]
);
}
}
console.log(new SampleStack().yaml()); // Generate Template
from gs2_cdk import Stack, core, distributor
class SampleStack(Stack):
def __init__(self):
super().__init__()
distributor.Namespace(
stack=self,
name="namespace-0001",
).master_data(
distributor_models=[
distributor.DistributorModel(
name='basic',
options=distributor.DistributorModelOptions(
metadata = 'BASIC',
inbox_namespace_id = 'grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001'
),
),
distributor.DistributorModel(
name='special',
options=distributor.DistributorModelOptions(
metadata = 'SPECIAL',
inbox_namespace_id = 'grn:gs2:ap-northeast-1:YourOwnerId:inbox:inbox-0001',
white_list_target_ids = [
'test',
]
),
),
],
)
print(SampleStack().yaml()) # Generate TemplateDistributorModel
배포 모델
배포 모델이란 리소스 입수 시 소지 한도를 초과하여 입수했을 때의 정책을 설정하는 엔티티입니다.
GS2-Distributor를 통해 입수 처리를 수행함으로써, 넘친 리소스를 GS2-Inbox의 메시지로 전송할 수 있습니다.
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| distributorModelId | string | ※ | ~ 1024자 | 배포 모델 GRN
※ 서버가 자동으로 설정 | ||
| name | string | ✓ | ~ 128자 | 배포 모델 이름 배포 모델 고유의 이름. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| metadata | string | ~ 2048자 | 메타데이터 메타데이터에는 임의의 값을 설정할 수 있습니다. 이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다. | |||
| inboxNamespaceId | string | ~ 1024자 | 넘친 리소스를 전송할 GS2-Inbox 네임스페이스 GRN
리소스 입수가 플레이어의 소지 한도를 초과한 경우, 넘친 리소스는 지정된 GS2-Inbox 네임스페이스에 메시지로 전송됩니다. 플레이어는 이후 수신함에서 리소스를 수령할 수 있습니다. | |||
| whiteListTargetIds | List<string> | [] | 0 ~ 1000 items | GS2-Distributor를 통해 처리할 수 있는 대상 리소스 GRN의 화이트리스트 이 배포 모델을 사용하여 입수 처리를 수행할 수 있는 대상 리소스의 GRN 프리픽스를 지정합니다. |