Skip to main content

Introduction to Cloud Save validator

Last updated on October 24, 2024

Overview

This article walks you through how to modify the Extend Override app template for Cloud Save validator and transform it into your own app that fits your requirements.

Contract functions

The functions in the contract are as shown in the snippet below:

service CloudsaveValidatorService {
// game record
rpc BeforeWriteGameRecord(GameRecord) returns (GameRecordValidationResult);
rpc AfterReadGameRecord(GameRecord) returns (GameRecordValidationResult);
rpc AfterBulkReadGameRecord(BulkGameRecord) returns (BulkGameRecordValidationResult);

// player record
rpc BeforeWritePlayerRecord(PlayerRecord) returns (PlayerRecordValidationResult);
rpc AfterReadPlayerRecord(PlayerRecord) returns (PlayerRecordValidationResult);
rpc AfterBulkReadPlayerRecord(BulkPlayerRecord) returns (BulkPlayerRecordValidationResult);

// admin game record
rpc BeforeWriteAdminGameRecord(AdminGameRecord) returns (GameRecordValidationResult);

// admin player record
rpc BeforeWriteAdminPlayerRecord(AdminPlayerRecord) returns (PlayerRecordValidationResult);
}

BeforeWriteGameRecord

This method will be called by AccelByte Gaming Services (AGS) before a game record is written into Cloud Save.

In the app, the following function can be found in src/AccelByte.PluginArch.CloudsaveValidator.Demo.Server/Services/CloudSaveValidatorService.cs.

public override Task<GameRecordValidationResult> BeforeWriteGameRecord(GameRecord request, ServerCallContext context)
{
...
}

AfterReadGameRecord

This method will be called by AGS after a game record is read from Cloud Save.

In the app, the following function can be found in src/AccelByte.PluginArch.CloudsaveValidator.Demo.Server/Services/CloudSaveValidatorService.cs.

public override Task<GameRecordValidationResult> AfterReadGameRecord(GameRecord request, ServerCallContext context)
{
...
}

AfterBulkReadGameRecord

This method will be called by AGS after bulk reading game record from Cloud Save.

In the app, the following function can be found in src/AccelByte.PluginArch.CloudsaveValidator.Demo.Server/Services/CloudSaveValidatorService.cs.

public override Task<BulkGameRecordValidationResult> AfterBulkReadGameRecord(BulkGameRecord request, ServerCallContext context)
{
...
}

BeforeWritePlayerRecord

This method will be called by AGS before a player record is written into Cloud Save.

In the app, the following function can be found in src/AccelByte.PluginArch.CloudsaveValidator.Demo.Server/Services/CloudSaveValidatorService.cs.

public override Task<PlayerRecordValidationResult> BeforeWritePlayerRecord(PlayerRecord request, ServerCallContext context)
{
...
}

AfterReadPlayerRecord

This method will be called by AGS after a player record is read from Cloud Save.

In the app, the following function can be found in src/AccelByte.PluginArch.CloudsaveValidator.Demo.Server/Services/CloudSaveValidatorService.cs.

public override Task<PlayerRecordValidationResult> AfterReadPlayerRecord(PlayerRecord request, ServerCallContext context)
{
...
}

AfterBulkReadPlayerRecord

This method will be called by AGS after bulk reading player record from Cloud Save.

In the app, the following function can be found in src/AccelByte.PluginArch.CloudsaveValidator.Demo.Server/Services/CloudSaveValidatorService.cs.

public override Task<BulkPlayerRecordValidationResult> AfterBulkReadPlayerRecord(BulkPlayerRecord request, ServerCallContext context)
{
...
}

BeforeWriteAdminGameRecord

This method will be called by AGS before an admin game record is written to Cloud Save.

In the app, the following function can be found in src/AccelByte.PluginArch.CloudsaveValidator.Demo.Server/Services/CloudSaveValidatorService.cs.

public override Task<GameRecordValidationResult> BeforeWriteAdminGameRecord(AdminGameRecord request, ServerCallContext context)
{
...
}

BeforeWriteAdminPlayerRecord

This method will be called by AGS before an admin player record is written to Cloud Save.

In the app, the following function can be found in src/AccelByte.PluginArch.CloudsaveValidator.Demo.Server/Services/CloudSaveValidatorService.cs.

public override Task<PlayerRecordValidationResult> BeforeWriteAdminPlayerRecord(AdminPlayerRecord request, ServerCallContext context)
{
...
}