Skip to content

Commit 5e01f79

Browse files
committed
added:storage load blanace for configure module
1 parent ac81d3b commit 5e01f79

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

XEngine_Source/StorageModule_Config/Config_Define.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ typedef struct tag_XEngine_ServerConfig
6666
BOOL bResumable;
6767
BOOL bUPHash;
6868
int nHashMode;
69-
TCHAR tszFileDir[MAX_PATH];
7069
}st_XStorage;
7170
struct
7271
{
@@ -112,6 +111,15 @@ typedef struct tag_XEngine_ServerConfig
112111
list<string> *pStl_ListStorage;
113112
}st_XVer;
114113
}XENGINE_SERVERCONFIG;
114+
115+
116+
typedef struct
117+
{
118+
TCHAR tszFilePath[MAX_PATH];
119+
TCHAR tszBuckSize[64];
120+
int nLevel;
121+
BOOL bEnable;
122+
}XENGINE_STORAGEBUCKET;
115123
typedef struct
116124
{
117125
TCHAR tszIPAddr[128];
@@ -126,6 +134,7 @@ typedef struct
126134
list<string>* pStl_ListCenter;
127135
list<string>* pStl_ListDownload;
128136
list<string>* pStl_ListUPLoader;
137+
list<XENGINE_STORAGEBUCKET>* pStl_ListBucket;
129138
}st_LoadBalance;
130139
}XENGINE_LBCONFIG;
131140
//////////////////////////////////////////////////////////////////////////

XEngine_Source/StorageModule_Config/Config_Json/Config_Json.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ BOOL CConfig_Json::Config_Json_File(LPCTSTR lpszConfigFile, XENGINE_SERVERCONFIG
153153
pSt_ServerConfig->st_XStorage.nHashMode = st_JsonXStorage["nHashMode"].asInt();
154154
pSt_ServerConfig->st_XStorage.bUPHash = st_JsonXStorage["bUPHash"].asInt();
155155
pSt_ServerConfig->st_XStorage.bResumable = st_JsonXStorage["bResumable"].asInt();
156-
_tcscpy(pSt_ServerConfig->st_XStorage.tszFileDir, st_JsonXStorage["tszFileDir"].asCString());
157156

158157
if (st_JsonRoot["XProxy"].empty() || (2 != st_JsonRoot["XProxy"].size()))
159158
{
@@ -317,20 +316,38 @@ BOOL CConfig_Json::Config_Json_LoadBalance(LPCTSTR lpszConfigFile, XENGINE_LBCON
317316
{
318317
pSt_ServerConfig->st_LoadBalance.pStl_ListUseMode->push_back(st_JsonLoadBalance["nUseMode"][i].asInt());
319318
}
319+
320320
pSt_ServerConfig->st_LoadBalance.pStl_ListCenter = new list<string>;
321321
for (unsigned int i = 0; i < st_JsonLoadBalance["CenterAddr"].size(); i++)
322322
{
323323
pSt_ServerConfig->st_LoadBalance.pStl_ListCenter->push_back(st_JsonLoadBalance["CenterAddr"][i].asCString());
324324
}
325+
325326
pSt_ServerConfig->st_LoadBalance.pStl_ListDownload = new list<string>;
326327
for (unsigned int i = 0; i < st_JsonLoadBalance["DownloadAddr"].size(); i++)
327328
{
328329
pSt_ServerConfig->st_LoadBalance.pStl_ListDownload->push_back(st_JsonLoadBalance["DownloadAddr"][i].asCString());
329330
}
331+
330332
pSt_ServerConfig->st_LoadBalance.pStl_ListUPLoader = new list<string>;
331333
for (unsigned int i = 0; i < st_JsonLoadBalance["UPLoaderAddr"].size(); i++)
332334
{
333335
pSt_ServerConfig->st_LoadBalance.pStl_ListUPLoader->push_back(st_JsonLoadBalance["UPLoaderAddr"][i].asCString());
334336
}
337+
338+
Json::Value st_JsonBucket = st_JsonLoadBalance["StorageAddr"];
339+
pSt_ServerConfig->st_LoadBalance.pStl_ListBucket = new list<XENGINE_STORAGEBUCKET>;
340+
for (unsigned int i = 0; i < st_JsonBucket.size(); i++)
341+
{
342+
XENGINE_STORAGEBUCKET st_Bucket;
343+
memset(&st_Bucket, '\0', sizeof(XENGINE_STORAGEBUCKET));
344+
345+
st_Bucket.bEnable = st_JsonBucket[i]["bEnable"].asInt();
346+
st_Bucket.nLevel = st_JsonBucket[i]["nLevel"].asInt();
347+
_tcscpy(st_Bucket.tszBuckSize, st_JsonBucket[i]["Size"].asCString());
348+
_tcscpy(st_Bucket.tszFilePath, st_JsonBucket[i]["XEngine_File"].asCString());
349+
350+
pSt_ServerConfig->st_LoadBalance.pStl_ListBucket->push_back(st_Bucket);
351+
}
335352
return TRUE;
336353
}

XEngine_Source/StorageModule_Config/pch.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
using namespace std;
3131
#include <XEngine_Include/XEngine_CommHdr.h>
3232
#include <XEngine_Include/XEngine_Types.h>
33+
#include <XEngine_Include/XEngine_SystemSdk/ProcFile_Define.h>
34+
#include <XEngine_Include/XEngine_SystemSdk/SystemApi_Define.h>
35+
#include <XEngine_Include/XEngine_SystemSdk/SystemApi_Error.h>
36+
#include "../StorageModule_Config/Config_Define.h"
3337
#include "Config_Define.h"
3438
#include "Config_Error.h"
3539
/********************************************************************

0 commit comments

Comments
 (0)