Skip to content

Commit f16b743

Browse files
committed
added:st_PermissionFlags a new flag use to upload limit. and now upload file size and enable limit supported
1 parent f7426fd commit f16b743

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

XEngine_Source/StorageModule_APIHelp/APIHelp_Distributed/APIHelp_Distributed.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,24 @@ bool CAPIHelp_Distributed::APIHelp_Distributed_UPStorage(list<XENGINE_STORAGEBUC
292292
APIHelp_dwErrorCode = ERROR_STORAGE_MODULE_APIHELP_NOTFOUND;
293293
return false;
294294
}
295+
if (pSt_StorageBucket->st_PermissionFlags.bUPLimit)
296+
{
297+
if (!pSt_StorageBucket->bEnable)
298+
{
299+
APIHelp_IsErrorOccur = true;
300+
APIHelp_dwErrorCode = ERROR_STORAGE_MODULE_APIHELP_DISABLE;
301+
return false;
302+
}
303+
__int64u nDirCount = 0; //当前目录大小
304+
APIHelp_Api_GetDIRSize(pSt_StorageBucket->tszFilePath, &nDirCount);
305+
//如果当前目录大小大于设定的大小.
306+
if (nDirCount >= APIHelp_Distributed_GetSize(stl_ListIterator->tszBuckSize))
307+
{
308+
APIHelp_IsErrorOccur = true;
309+
APIHelp_dwErrorCode = ERROR_STORAGE_MODULE_APIHELP_SIZE;
310+
return false;
311+
}
312+
}
295313
}
296314
else
297315
{

XEngine_Source/StorageModule_Config/Config_Define.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ typedef struct
121121
{
122122
bool bCreateDir;
123123
bool bRewrite;
124+
bool bUPLimit;
124125
}st_PermissionFlags;
125126
}XENGINE_STORAGEBUCKET;
126127
typedef struct

XEngine_Source/StorageModule_Config/Config_Json/Config_Json.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ bool CConfig_Json::Config_Json_LoadBalance(LPCXSTR lpszConfigFile, XENGINE_LBCON
355355
Json::Value st_JsonPermission = st_JsonBucket[i]["PermissionFlags"];
356356
st_Bucket.st_PermissionFlags.bCreateDir = st_JsonPermission["CreateDir"].asBool();
357357
st_Bucket.st_PermissionFlags.bRewrite = st_JsonPermission["Rewrite"].asBool();
358+
st_Bucket.st_PermissionFlags.bUPLimit = st_JsonPermission["UPLimit"].asBool();
358359

359360
pSt_ServerConfig->st_LoadBalance.pStl_ListBucket->push_back(st_Bucket);
360361
}

0 commit comments

Comments
 (0)