초기커밋

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,94 @@
using Amazon.DynamoDBv2;
using Amazon.DynamoDBv2.DocumentModel;
using Amazon.DynamoDBv2.Model;
using ServerCore;
using ServerBase;
using ServerCommon;
namespace GameServer;
public class CaliumEventTicker : EntityTicker
{
private DynamoDbClient? m_dynamoDb_client { get; set; } = null;
public CaliumEventTicker(double onTickIntervalMilliseconds, CancellationTokenSource? cts)
: base(EntityType.CaliumEventTicker, onTickIntervalMilliseconds, cts)
{
var server_logic = GameServerApp.getServerLogic();
m_dynamoDb_client = server_logic.getDynamoDbClient();
}
public override async Task onTaskTick()
{
NullReferenceCheckHelper.throwIfNull(m_dynamoDb_client, () => $"dynamodb client is null !!! ");
var calium_storage_entity = GameServerApp.getServerLogic().findGlobalEntity<CaliumStorageEntity>();
NullReferenceCheckHelper.throwIfNull(calium_storage_entity, () => "calium storage entity is null !!!");
var calium_event_action = calium_storage_entity.getEntityAction<CaliumEventAction>();
NullReferenceCheckHelper.throwIfNull(calium_event_action, () => $"calium_event_action is null !!! - {calium_storage_entity.toBasicString()}");
// 1. doc 가져오기
var search = await searchDocuments();
foreach (var doc in search.list)
{
var (result, change_doc) = await calium_event_action.updateCaliumEventStatus(doc, CaliumEventStatus.Regist, CaliumEventStatus.Sending);
if (result.isFail() || null == change_doc) continue;
// 2. 재전송 처리
_ = await sendCaliumEventAsync(change_doc);
}
}
public override string toBasicString()
{
return $"{this.getTypeName()}";
}
public override string toSummaryString()
{
return $"{this.getTypeName()}";
}
private async Task<Result> sendCaliumEventAsync(CaliumEventDoc sendDoc)
{
var server_logic = GameServerApp.getServerLogic();
var calium_event_entity = server_logic.findGlobalEntity<CaliumStorageEntity>();
NullReferenceCheckHelper.throwIfNull(calium_event_entity, () => "calium_event_entity is null !!!");
var calium_event_action = calium_event_entity.getEntityAction<CaliumEventAction>();
NullReferenceCheckHelper.throwIfNull(calium_event_action, () => $"calium_event_action is null !!! - {calium_event_entity.toBasicString()}");
var result = await calium_event_action.sendCaliumEventFromDB(sendDoc);
return result;
}
private async Task<(Result result, List<CaliumEventDoc> list)> searchDocuments()
{
NullReferenceCheckHelper.throwIfNull(m_dynamoDb_client, () => $"dynamodb client is null !!! ");
var query_config = new QueryOperationConfig();
query_config.Filter.AddCondition(PrimaryKey.PK_Define, QueryOperator.Equal, CaliumEventDoc.pk);
query_config.Limit = 10;
query_config.FilterExpression = new Expression
{
ExpressionStatement = "CaliumEventAttrib.#status = :statusValue",
ExpressionAttributeNames = new Dictionary<string, string>
{
{ "#status", "status" }
},
ExpressionAttributeValues = new Dictionary<string, DynamoDBEntry>
{
{ ":statusValue", CaliumEventStatus.Regist.ToString() }
}
};
var list = await m_dynamoDb_client.simpleQueryDocTypesWithQueryOperationConfig<CaliumEventDoc>(query_config);
return list;
}
}