Server PlayerBlobData API Reference
PGOS provides blob type PlayData to support the use of binary large objects in game.
API List
| API | Description |
|---|---|
| GetPBDInfo | Get the player blob data information of the specified key. |
| UpdatePBDFromBuff | Update the player blob data 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 UpdatePBDFromFile API instead. |
| UpdatePBDFromFile | Update the player blob data from a local file. |
| CancelPBDUpdate | Cancel the update operation of the player blob data. |
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:
| Param | Type | Description |
|---|---|---|
| player_id | const std::string& | The player to query. |
| blob_key | const std::string& | The blob key to query. |
| result_callback | PgosDataCallback<PlayerBlobDataInfo> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
UpdatePBDFromBuff
Update the player blob data 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 UpdatePBDFromFile API instead.
/**
* Update the player blob data 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 UpdatePBDFromFile API instead.
*
* @param player_id The player to update blob data.
* @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 UpdatePBDFromBuff(
const pgos::pstring& player_id,
const pgos::pstring& blob_key,
const PgosBuffer& blob_buff,
PgosInterCallback<UpdatePBDProgressInfo> progress_callback,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| player_id | const std::string& | The player to update blob data. |
| blob_key | const std::string& | The blob key to update. |
| blob_buff | const PgosBuffer& | Blob data buffer to set. If the buffer address pointer is nullptr, the blob data will be reset to 0 bytes. |
| progress_callback | PgosInterCallback<UpdatePBDProgressInfo> | Data transfer progress callback, which will be called in an ASYNCHRONOUS CHILD THREAD. |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
UpdatePBDFromFile
Update the player blob data from a local file.
/**
* Update the player blob data from a local file.
*
* @param player_id The player to update blob data.
* @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 UpdatePBDFromFile(
const pgos::pstring& player_id,
const pgos::pstring& blob_key,
const pgos::pstring& file_path,
PgosInterCallback<UpdatePBDProgressInfo> progress_callback,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| player_id | const std::string& | The player to update blob data. |
| blob_key | const std::string& | The blob key to update. |
| file_path | const 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_callback | PgosInterCallback<UpdatePBDProgressInfo> | Data transfer progress callback, which will be called in an ASYNCHRONOUS CHILD THREAD. |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
CancelPBDUpdate
Cancel the update operation of the player blob data.
/**
* Cancel the update operation of the player blob data.
*
* @param player_id The player to be cancelled from updating blob data.
* @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 CancelPBDUpdate(
const pgos::pstring& player_id,
const pgos::pstring& blob_key,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| player_id | const std::string& | The player to be cancelled from updating blob data. |
| blob_key | const std::string& | The blob key to cancel the update. |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void