GS2-Distributor Deploy/CDK リファレンス
エンティティ
Deploy処理で操作の対象となるリソース
Namespace
ネームスペース
ネームスペースは、一つのプロジェクト内で同じサービスを異なる用途で複数利用するためのエンティティです。
GS2 の各サービスはネームスペース単位で管理されます。ネームスペースが異なれば、同じサービスでも完全に独立したデータ空間として扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
Request
リソースの生成・更新リクエスト
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128文字 | ネームスペース名 ネームスペース固有の名前。英数字および -(ハイフン) _(アンダースコア) .(ピリオド)で指定します。 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| transactionSettingV2 | TransactionSettingV2 | トランザクション設定(V2) このネームスペースが発行するトランザクションをどのように実行するかを決める設定です。設定する項目は、実行に使用する GS2-Distributor のネームスペースと、トランザクションに含まれるアクションを 1 件ずつ実行して先に実行されたアクションの結果を後続のアクションから使えるようにするか、まとめて同時に実行してレスポンスタイムを短くするか、の 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: トランザクションに含まれるアクションを 1 件ずつ実行するか、まとめて同時に実行するか
どちらを選んでも、トランザクションは発行された時点でサーバーが実行し、成否はトランザクション全体でひとつになります。あるアクションが失敗した場合は、それまでに実行されたアクションもろとも取り消され、1 つも反映されません。トランザクションの実行方法に関するそれ以外の項目は推奨構成に固定されているため、設定する必要はありません。
1 件ずつ実行する場合(既定 / enableParallelExecution が false)、各アクションは先に実行されたアクションの書き込みを踏まえて動作します。アクションは verify・consume・acquire の順に実行され、次のことができます。
- 1 つのトランザクションの中で、同じ行を複数のアクションから更新する(まとめて同時に実行する場合は失敗します)
- 先に実行されたアクションの書き込みを読む。List や Query の結果でも、入れ子になったトランザクションの内側でも読めます
%{Gs2Xxx:ActionName.path[0].field}を使って、先に実行された verify や consume アクションの結果を、後続の verify・consume・acquire アクションの引数として渡す
代わりに、レスポンスタイムは各アクションの実行時間の合計になり、1 つのトランザクションに含められるアクションは最大 20 件になります。また、各フェーズの中での実行順はアクション名、次に対象リソースの順で決まるため、リクエストに並べた順序で実行順を指定することはできません。実行は最初に失敗したアクションで停止します。
まとめて同時に実行する場合(enableParallelExecution が true)、アクションは同一のデータスナップショットに対して並列に実行されるため、レスポンスタイムは最も遅いアクション 1 件分で済み、アクション数の上限もありません。
代わりに、あるアクションから他のアクションの書き込みを読むことはできず、同じ行を 2 つのアクションが書き換えるとトランザクションは database:transaction:same.resource(400)で失敗します。同一トランザクション内で同じデータを 2 つ以上のアクションが書き換えないことを保証できる場合にだけ選択してください。%{...} は先行するフェーズ(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 による入手アクションの非同期化、直列実行――をそれぞれ個別の項目として公開しているため、推奨構成以外の組み合わせも作れます。その推奨構成を 1 つの設定としてまとめたものがトランザクション設定(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
モバイルプッシュ通知の言語別メッセージ
通知をモバイルプッシュ通知へ転送する際に使用する、言語別メッセージリストの 1 要素です。1 つの要素が 1 つのロケールに対するタイトルと本文を保持します。
採用される要素は、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プレフィックスを指定します。 |