초기커밋

This commit is contained in:
2025-05-01 07:20:41 +09:00
commit 98bb2e3c5c
2747 changed files with 646947 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
using Google.Protobuf;
using Google.Protobuf.WellKnownTypes;
using ServerCore;
using ServerBase;
using ServerCommon;
using ServerCommon.BusinessLogDomain;
using MetaAssets;
namespace GameServer;
public class ReqCreateCaliumContentStorageHandler
{
public async Task<Result> createCaliumContentStorage(string contentId, double calium)
{
var server_logic = GameServerApp.getServerLogic();
var calium_storage_entity = server_logic.findGlobalEntity<CaliumStorageEntity>();
NullReferenceCheckHelper.throwIfNull(calium_storage_entity, () => "calium_storage_entity is null !!!");
// 1. contentId 검사
// Todo(sangyeob.kim) : calium content Id 를 위한 xlxs 등록되면 추가한다.
// 2. calium content storage 생성
var result = await calium_storage_entity.runTransactionRunnerSafely(TransactionIdType.PrivateContents, "CreateCaliumContentStorage", createCaliumContentStorageDelegate);
if (result.isFail())
{
var err_msg = $"Failed to runTransactionRunnerSafely() !!! : {result.toBasicString()} - {calium_storage_entity.toBasicString()}";
Log.getLogger().error(err_msg);
}
return result;
async Task<Result> createCaliumContentStorageDelegate() => await createCaliumContentStorage(calium_storage_entity, contentId, calium);
}
private async Task<Result> createCaliumContentStorage(CaliumStorageEntity caliumStorageEntity, string contentId, double calium)
{
var dynamoDb_client = GameServerApp.getServerLogic().getDynamoDbClient();
NullReferenceCheckHelper.throwIfNull(dynamoDb_client, () => $"dynamoDb_client is null !!! - {caliumStorageEntity.toBasicString()}");
var batch = new QueryBatchEx<QueryRunnerWithItemRequest>(caliumStorageEntity, LogActionType.CreateCaliumContent, dynamoDb_client, true);
batch.addQuery(new DBQStorageCaliumUpdate(CaliumStorageType.Operator, -1 * calium));
batch.addQuery(new DBQContentCaliumCreate(contentId, calium));
var result = await QueryHelper.sendQueryAndBusinessLog(batch);
return result;
}
}