跳到主要内容

Server Ect API Reference

ECT(Eventual Consistent Transaction) is used for tracking the game transaction. When a game needs to execute a transaction that contains several ordered actions to modify player data or inventory, the game can create an ECT Instance to track the transaction status on the backend side(game server or virtual server).

API List

APIDescription
CreateEctCreate an ECT. Once created, the status of the ECT will be 'Uncompleted' and the actions will be 'Init'.
UpdateEctUpdate the ECT information and actions. The status of the ECT will be updated to 'Done' if the status of all actions were updated to 'Success'. The possible state transitions for action are as follows: Init->Failed, Init->Success, Failed->Success, Failed->Failed, Success->Success. Any other state transition will result in an error.
UpdateEctActionsUpdate the ECT's actions. The status of the ECT will be updated to 'Done' if the status of all actions are updated to 'Success'. The possible state transitions for action are as follows: Init->Failed, Init->Success, Failed->Success, Failed->Failed, Success->Success. Any other state transition will result in an error.
CancelEctCancel the ECT. Once canceled, it will not trigger a auto retry event, and the game will not be able to update it either.
GetEctInfoGet information about the specified ECT. When the ECT status is Uncompleted it can always be queried. If the ECT status changes to a terminal state (Done, Canceled, or Expired) and more than a few days pass, it can no longer be queried. However, the ECT details can still be viewed on the Portal at this time.
GetPlayerUncompletedEctsRetrieve ECTs of a player that are in an Uncompleted status.

API Details

CreateEct

Create an ECT. Once created, the status of the ECT will be 'Uncompleted' and the actions will be 'Init'.

/**
* Create an ECT. Once created, the status of the ECT will be 'Uncompleted' and the actions will be 'Init'.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void CreateEct(
const CreateEctParams& params,
PgosDataCallback<EctInfo> result_callback);

Parameters:

ParamTypeDescription
paramsconst CreateEctParams&
result_callbackPgosDataCallback<EctInfo>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

UpdateEct

Update the ECT information and actions. The status of the ECT will be updated to 'Done' if the status of all actions were updated to 'Success'. The possible state transitions for action are as follows: Init->Failed, Init->Success, Failed->Success, Failed->Failed, Success->Success. Any other state transition will result in an error.

/**
* Update the ECT information and actions. The status of the ECT will be updated to 'Done' if the status of all actions were updated to 'Success'.
* The possible state transitions for `action` are as follows: Init->Failed, Init->Success, Failed->Success, Failed->Failed, Success->Success. Any other state transition will result in an error.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void UpdateEct(
const UpdateEctParams& params,
PgosDataCallback<EctInfo> result_callback);

Parameters:

ParamTypeDescription
paramsconst UpdateEctParams&
result_callbackPgosDataCallback<EctInfo>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

UpdateEctActions

Update the ECT's actions. The status of the ECT will be updated to 'Done' if the status of all actions are updated to 'Success'. The possible state transitions for action are as follows: Init->Failed, Init->Success, Failed->Success, Failed->Failed, Success->Success. Any other state transition will result in an error.

/**
* Update the ECT's actions. The status of the ECT will be updated to 'Done' if the status of all actions are updated to 'Success'.
* The possible state transitions for `action` are as follows: Init->Failed, Init->Success, Failed->Success, Failed->Failed, Success->Success. Any other state transition will result in an error.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void UpdateEctActions(
const UpdateEctActionsParams& params,
PgosDataCallback<EctInfo> result_callback);

Parameters:

ParamTypeDescription
paramsconst UpdateEctActionsParams&
result_callbackPgosDataCallback<EctInfo>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

CancelEct

Cancel the ECT. Once canceled, it will not trigger a auto retry event, and the game will not be able to update it either.

/**
* Cancel the ECT. Once canceled, it will not trigger a auto retry event, and the game will not be able to update it either.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void CancelEct(
const CancelEctParams& params,
PgosDataCallback<EctInfo> result_callback);

Parameters:

ParamTypeDescription
paramsconst CancelEctParams&
result_callbackPgosDataCallback<EctInfo>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

GetEctInfo

Get information about the specified ECT. When the ECT status is Uncompleted it can always be queried. If the ECT status changes to a terminal state (Done, Canceled, or Expired) and more than a few days pass, it can no longer be queried. However, the ECT details can still be viewed on the Portal at this time.

/**
* Get information about the specified ECT.
* When the ECT status is `Uncompleted` it can always be queried.
* If the ECT status changes to a terminal state (`Done`, `Canceled`, or `Expired`) and more than a few days pass, it can no longer be queried. However, the ECT details can still be viewed on the Portal at this time.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void GetEctInfo(
const GetEctInfoParams& params,
PgosDataCallback<EctInfo> result_callback);

Parameters:

ParamTypeDescription
paramsconst GetEctInfoParams&
result_callbackPgosDataCallback<EctInfo>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

GetPlayerUncompletedEcts

Retrieve ECTs of a player that are in an Uncompleted status.

/**
* Retrieve ECTs of a player that are in an `Uncompleted` status.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void GetPlayerUncompletedEcts(
const GetPlayerUncompletedEctsParams& params,
PgosDataCallback<GetPlayerUncompletedEctsResult> result_callback);

Parameters:

ParamTypeDescription
paramsconst GetPlayerUncompletedEctsParams&
result_callbackPgosDataCallback<GetPlayerUncompletedEctsResult>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void