跳到主要内容

Client PlayerBlobData API Reference

PGOS provides blob type PlayData to support the use of binary large objects in game.

API List

APIDescription
GetPBDInfoGet the player blob data information of the specified key.
UpdateMyPBDFromBuffUpdate blob data of the current player from a memory buffer. The function will create a copy of blob data internally, if the buffer is very large, this may lead to high memory usage. So for the blob buffer with large size, consider using the UpdateMyPBDFromFile API instead.
UpdateMyPBDFromFileUpdate blob data of the current player from a local file.
CancelMyPBDUpdateCancel the blob data update operation of the current player.

API Details

GetPBDInfo

Get the player blob data information of the specified key.

/**
* Get the player blob data information of the specified key.
*
* @param player_id The player to query.
* @param blob_key The blob key to query.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void GetPBDInfo(
const pgos::pstring& player_id,
const pgos::pstring& blob_key,
PgosDataCallback<PlayerBlobDataInfo> result_callback);

Parameters:

ParamTypeDescription
player_idconst std::string&The player to query.
blob_keyconst std::string&The blob key to query.
result_callbackPgosDataCallback<PlayerBlobDataInfo>The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

UpdateMyPBDFromBuff

Update blob data of the current player from a memory buffer. The function will create a copy of blob data internally, if the buffer is very large, this may lead to high memory usage. So for the blob buffer with large size, consider using the UpdateMyPBDFromFile API instead.

/**
* Update blob data of the current player from a memory buffer.
* The function will create a copy of blob data internally, if the buffer is very large, this may lead to high memory usage.
* So for the blob buffer with large size, consider using the UpdateMyPBDFromFile API instead.
*
* @param blob_key The blob key to update.
* @param blob_buff Blob data buffer to set. If the buffer address pointer is nullptr, the blob data will be reset to 0 bytes.
* @param progress_callback Data transfer progress callback, which will be called in an ASYNCHRONOUS CHILD THREAD.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void UpdateMyPBDFromBuff(
const pgos::pstring& blob_key,
const PgosBuffer& blob_buff,
PgosInterCallback<UpdatePBDProgressInfo> progress_callback,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
blob_keyconst std::string&The blob key to update.
blob_buffconst PgosBuffer&Blob data buffer to set. If the buffer address pointer is nullptr, the blob data will be reset to 0 bytes.
progress_callbackPgosInterCallback<UpdatePBDProgressInfo>Data transfer progress callback, which will be called in an ASYNCHRONOUS CHILD THREAD.
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

UpdateMyPBDFromFile

Update blob data of the current player from a local file.

/**
* Update blob data of the current player from a local file.
*
* @param blob_key The blob key to update.
* @param file_path The full path to the file to upload. If it is not a UE project (FString), please pass in a full local path (not in utf8 format).
* @param progress_callback Data transfer progress callback, which will be called in an ASYNCHRONOUS CHILD THREAD.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void UpdateMyPBDFromFile(
const pgos::pstring& blob_key,
const pgos::pstring& file_path,
PgosInterCallback<UpdatePBDProgressInfo> progress_callback,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
blob_keyconst std::string&The blob key to update.
file_pathconst std::string&The full path to the file to upload. If it is not a UE project (FString), please pass in a full local path (not in utf8 format).
progress_callbackPgosInterCallback<UpdatePBDProgressInfo>Data transfer progress callback, which will be called in an ASYNCHRONOUS CHILD THREAD.
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void

CancelMyPBDUpdate

Cancel the blob data update operation of the current player.

/**
* Cancel the blob data update operation of the current player.
*
* @param blob_key The blob key to cancel the update.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void CancelMyPBDUpdate(
const pgos::pstring& blob_key,
PgosCallback result_callback);

Parameters:

ParamTypeDescription
blob_keyconst std::string&The blob key to cancel the update.
result_callbackPgosCallbackThe result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.

Return: void