초기커밋
This commit is contained in:
674
ServerBase/0. Base/BaseInterface.cs
Normal file
674
ServerBase/0. Base/BaseInterface.cs
Normal file
@@ -0,0 +1,674 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
using Amazon.DynamoDBv2.DocumentModel;
|
||||
using Axion.Collections.Concurrent;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
|
||||
|
||||
using MODULE_ID = System.UInt32;
|
||||
using SESSION_ID = System.Int32;
|
||||
using META_ID = System.UInt32;
|
||||
using ENTITY_GUID = System.String;
|
||||
using ACCOUNT_ID = System.String;
|
||||
using OWNER_GUID = System.String;
|
||||
using USER_GUID = System.String;
|
||||
using CHARACTER_GUID = System.String;
|
||||
using ITEM_GUID = System.String;
|
||||
|
||||
|
||||
|
||||
|
||||
namespace ServerBase;
|
||||
|
||||
//=============================================================================================
|
||||
// Module 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IModule
|
||||
{
|
||||
ModuleContext getModuleContext();
|
||||
|
||||
Task<Result> startModule();
|
||||
|
||||
Task<Result> stopModule();
|
||||
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// ConfigParam 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IConfigParam
|
||||
{
|
||||
Result tryReadFromJsonOrDefault(JObject jObject);
|
||||
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// IConfiguration 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IWithConfiguration
|
||||
{
|
||||
Result mergeConfiguration(IConfiguration configuration);
|
||||
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Actor 관련 인터페이스 : Root 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IActor
|
||||
{
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// LogActor 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IWithLogActor
|
||||
{
|
||||
ILogActor toLogActor();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// 함수 파라메터 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IWithParam
|
||||
{
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Result 반환 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface IWithResult
|
||||
{
|
||||
Result Result { get; set; }
|
||||
|
||||
bool isResultOnly();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Result + TResultValue 반환 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface IWithResultValue<out TResultValue> : IWithResult
|
||||
{
|
||||
TResultValue ValueOfResult { get; }
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Task Serializer 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IWithTaskSerializer
|
||||
{
|
||||
TaskSerializer getTaskSerializer();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// Owner 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IWithEntityOwner
|
||||
{
|
||||
EntityBase getOwner();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// Tick 관련 제어 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface ITicker
|
||||
{
|
||||
void onTick();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Task 기반 Tick 관련 제어 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface ITaskTicker
|
||||
{
|
||||
Task<Result> onCreateTask();
|
||||
|
||||
Task onTaskTick();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// 초기화 관련 제어 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IInitializer
|
||||
{
|
||||
Task<Result> onInit();
|
||||
}
|
||||
|
||||
public interface IWithInitializers
|
||||
{
|
||||
void appendInitializer(IInitializer initializer);
|
||||
|
||||
List<T> tryConvertInitializes<T>() where T : class;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// Network 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IPacketCommand
|
||||
{
|
||||
string getCommandKey();
|
||||
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
public interface IWithPacketNamespaceVerifier
|
||||
{
|
||||
bool isValidPacketNamespace(string toCheckNamespace, IPacketCommand packetCommand);
|
||||
}
|
||||
|
||||
public interface ISession
|
||||
{
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
public interface IProudNetSession : ISession
|
||||
{
|
||||
Nettention.Proud.IRmiHost getRmiHost();
|
||||
}
|
||||
|
||||
public interface IRabbitMqSession : ISession
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// HelperFunction 관련 제어 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface IHelperFunction
|
||||
{
|
||||
IEntityWithSession getOwner();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// Entity와 연결된 Session 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface IEntityWithSession : ISession
|
||||
{
|
||||
Nettention.Proud.HostID getHostId();
|
||||
|
||||
ListenSessionBase? getListenSessionBase();
|
||||
|
||||
void setListenSessionBase(ListenSessionBase listenSessionBase);
|
||||
|
||||
SESSION_ID getSessionId();
|
||||
|
||||
string getAccountId();
|
||||
|
||||
string getUserGuid();
|
||||
|
||||
string getUserNickname();
|
||||
|
||||
string toSummaryString();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// AttribBase의 Wrapper Class 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface IAttribWrapper
|
||||
{
|
||||
bool onCopyToDynamoDbEntry(ref Amazon.DynamoDBv2.DocumentModel.Document doc);
|
||||
|
||||
bool onCopyFromDynamoDbEntry(Amazon.DynamoDBv2.DocumentModel.Document doc);
|
||||
|
||||
bool onFillupJsonStringToJObject(ref JObject jobject);
|
||||
|
||||
Type getAttribType();
|
||||
|
||||
AttribBase getAttribBase();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// DynamoDbDoc 데이터를 Cache & EntityAttribute & BackupDoc 복사해주는 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface ICopyCacheFromDoc
|
||||
{
|
||||
bool copyCacheFromDoc(DynamoDbDocBase customDoc);
|
||||
}
|
||||
|
||||
public interface ICopyEntityAttributeFromDoc
|
||||
{
|
||||
bool copyEntityAttributeFromDoc(DynamoDbDocBase customDoc);
|
||||
}
|
||||
|
||||
public interface ICopyBackupDocFromDoc
|
||||
{
|
||||
bool copyBackupDocFromDoc(DynamoDbDocBase customDoc);
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Cache 데이터를 특정 데이터 타입으로 복사해주는 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface ICopyDocFromCache
|
||||
{
|
||||
bool copyDocFromCache(CacheBase cacheBase);
|
||||
}
|
||||
|
||||
public interface ICopyEntityAttributeFromCache
|
||||
{
|
||||
bool copyEntityAttributeFromCache(CacheBase cacheBase);
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// EntityAttribute 데이터를 특정 데이터 타입으로 복사해주는 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface ICopyDocFromEntityAttribute
|
||||
{
|
||||
bool copyDocFromEntityAttribute(EntityAttributeBase entityAttributeBase);
|
||||
}
|
||||
|
||||
public interface ICopyCacheFromEntityAttribute
|
||||
{
|
||||
bool copyCacheFromEntityAttribute(EntityAttributeBase entityAttributeBase);
|
||||
}
|
||||
|
||||
// DataCopyHelper.copyEntityAttributeTransactorFromEntityAttribute() 호출하고 있지 않다.
|
||||
// TransactionRunner가 IEntityAttributeTransactor.cloneFromOriginEntityAttribute() 호출하여 복사 하고 있다.
|
||||
// IEntityAttributeTransactor.cloneFromOriginEntityAttribute() 호출시
|
||||
// Origin의 속성값과 비교하여, 초기값이 아니고, 값이 다른 경우만 복사해 주는 로직으로 수정 한다. - kangms
|
||||
public interface ICopyEntityAttributeTransactorFromEntityAttribute
|
||||
{
|
||||
bool copyEntityAttributeTransactorFromEntityAttribute(EntityAttributeBase entityAttributeBase);
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// EntityAttributeTransactor 데이터를 특정 데이터 타입으로 복사해주는 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface ICopyDocFromEntityAttributeTransactor
|
||||
{
|
||||
bool copyDocFromEntityAttributeTransactor(IEntityAttributeTransactor entityAttributeTransactor);
|
||||
}
|
||||
|
||||
public interface ICopyEntityAttributeFromEntityAttributeTransactor
|
||||
{
|
||||
bool copyEntityAttributeFromEntityAttributeTransactor(IEntityAttributeTransactor entityAttributeTransactor);
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Cache 정보 관리를 위한 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface ICache
|
||||
{
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Event Task를 위한 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface IEventTask
|
||||
{
|
||||
void setCompleted();
|
||||
|
||||
bool isCompleted();
|
||||
|
||||
Task<Result> onTriggerEffect();
|
||||
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Rule를 위한 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface IRule : IInitializer
|
||||
{
|
||||
Task<Result> configure();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Slots 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface ISlots
|
||||
{
|
||||
bool onInitSlots(int slotMaxCount);
|
||||
|
||||
ICollection getSlots();
|
||||
|
||||
List<EntityBase> getEntityBases();
|
||||
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// SlotsWithType 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface ISlotsWithType<TSlotType> : ISlots
|
||||
where TSlotType : notnull
|
||||
{
|
||||
ServerErrorCode onIsEquipable(TSlotType targetSlot);
|
||||
|
||||
ServerErrorCode onTryEquip(TSlotType targetSlot);
|
||||
|
||||
ServerErrorCode onTryEquipWithEntityBase(TSlotType targetSlot, EntityBase entityBase);
|
||||
|
||||
ServerErrorCode onIsUnequipable(TSlotType targetSlot);
|
||||
|
||||
ServerErrorCode onTryUnequip(TSlotType targetSlot);
|
||||
|
||||
ServerErrorCode onTryUnequipWithEntityBase(TSlotType targetSlot, out EntityBase? unequipedEntityBase);
|
||||
|
||||
EntityBase? onFindEntityBase(TSlotType targetSlot);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// EntityAttribute 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface IEntityAttribute
|
||||
{
|
||||
EntityBase getOwner();
|
||||
|
||||
EntityAttributeBase? getEntityAttributeBase();
|
||||
|
||||
void onClear();
|
||||
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// EntityDbTransact 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IEntityDbTransact
|
||||
{
|
||||
EntityBase getOwner();
|
||||
|
||||
IEntityDbTransactAttribute? getEntityDbTransactAttribute();
|
||||
|
||||
void onClear();
|
||||
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
public interface IEntityDbTransactAttribute
|
||||
{
|
||||
EntityBase getOwner();
|
||||
|
||||
void onClear();
|
||||
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// IEntityAttributeTransactor 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IEntityAttributeTransactor
|
||||
{
|
||||
bool cloneFromOriginEntityAttribute(EntityAttributeBase fromOriginEntityAttribute);
|
||||
|
||||
EntityAttributeBase? getOriginEntityAttribute();
|
||||
|
||||
EntityAttributeBase? getClonedEntityAttribute();
|
||||
|
||||
bool isReadOnly();
|
||||
|
||||
Task<(Result, DynamoDbDocBase?)> makeDocBase();
|
||||
|
||||
ENTITY_GUID getEntityGuid();
|
||||
|
||||
EntityBase getOwner();
|
||||
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// EntityDeltaRecorder 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IEntityDeltaRecorder
|
||||
{
|
||||
object getEntityDeltaType();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// MergeWithEntityAttribute 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IMergeWithEntityAttribute
|
||||
{
|
||||
// DBQWriteToAttributeAllWithTransactionRunner.onQueryResponseCommit()에서 호출 한다.
|
||||
Result onMerge(EntityAttributeBase otherEntityAttribute);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// DeleteWithEntityAttribute 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IDeleteWithEntityAttribute
|
||||
{
|
||||
Result onDelete();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// WithCommonResultFiller 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IWithCommonResultFiller
|
||||
{
|
||||
void onFillCommonResult(EntityCommonResult commonResult, EntityAttributeBase origin, QueryBatchBase? queryBatch = null);
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// MergeWithInventory 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IMergeWithInventory
|
||||
{
|
||||
Task<Result> onMerge(List<ReservedSlotOnInven> reservedSlotOnInvens, TransactionRunner transactionRunner);
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Notify 관련 인터페이스
|
||||
//
|
||||
// author : chan
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IInitNotifyPacket
|
||||
{
|
||||
void InitNotifyMessage();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// Logic 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface ILogic
|
||||
{
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// 서버 수준의 Logic 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface IServerLogic : ILogic, IActor
|
||||
{
|
||||
string getServerType();
|
||||
|
||||
string getServerName();
|
||||
|
||||
ServerConfig getServerConfig();
|
||||
|
||||
IModule getModule(MODULE_ID moduleId);
|
||||
|
||||
Result registerEntityTicker(EntityTicker entityTicker);
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// 서버 주요 지표 관련 인터페이스
|
||||
//
|
||||
// author : kangms
|
||||
//
|
||||
//=============================================================================================
|
||||
public interface IWithServerMetrics
|
||||
{
|
||||
Task<Result> setupServerMetrics();
|
||||
|
||||
bool isSetupCompleted();
|
||||
|
||||
ServerMetricsCacheRequest getServerMetricsCacheRequest();
|
||||
|
||||
Task<Result> syncServerInfoToCache();
|
||||
|
||||
string toBasicString();
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// 관련 인터페이스
|
||||
//
|
||||
// author : chan
|
||||
//
|
||||
//=============================================================================================
|
||||
|
||||
public interface IRemoteTransaction
|
||||
{
|
||||
Task<Result> callRemoteChargeAIPoint(double beamDelta);
|
||||
Task<Result> callNotifyCaliumEvent(string eventName, CurrencyType currencyType, double delta);
|
||||
}
|
||||
Reference in New Issue
Block a user