Skip to content

Commit 0d43ed8

Browse files
authored
Merge pull request #30 from libxengine/develop
V3.11.0.1001 Merge
2 parents 100ca3f + 690fcf8 commit 0d43ed8

File tree

93 files changed

+2281
-2090
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+2281
-2090
lines changed

CHANGELOG

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
XEngine_Storage V3.11.0.1001
2+
3+
更新:匹配XEngine V8.x版本
4+
更新:linux和macos的编译脚本
5+
修改:现在数据库连接都使用utf8版本字符集了
6+
修改:数据库字符集使用utf8mb4_unicode_ci
7+
修改:分离了验证和代理配置
8+
修改:下载和上传以及验证支持单独验证开关了
9+
修正:无法创建数据库表的问题
10+
11+
update:match xengine v8.10
12+
update:linux and macos build makefile
13+
modify:database connect used to utf charset
14+
modify:charset to utf8mb4_unicode_ci
15+
modify:detach auth and proxy configure
16+
modify:download and upload and center support both verification switch
17+
fixed:can't create table of file
18+
======================================================================================
119
XEngine_Storage V3.10.0.1001
220

321
增加:上传文件覆写功能

README.en.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ c c++ 存储服务 c c++ 文件存储服务
88
c c++ file storage service
99
This is an api gateway for uploading and downloading.
1010
The service is for users who have business needs for upload and download services (such as developers who need to upload and download servers).
11-
This server is more inclined to storestorage transfer and API Manage interface
11+
This server is more inclined to storestorage transfer and API Manage interface,the service can be used upload and download management and network file shared and software update service.
1212
best storage service for http,batter than nginx and more convenient to manage,more concise code. On going maintenance
1313

1414
## Software feature
@@ -36,7 +36,7 @@ feature list:
3636
## install
3737

3838
#### XEngine Evn
39-
you must install XEngine,need V7.38 or above,install XEngine can be refer to xengine Readme docment
39+
you must install XEngine,need V8.10 or above,install XEngine can be refer to xengine Readme docment
4040
GITEE:https://gitee.com/xyry/libxengine
4141
GITHUB:https://github.com/libxengine/xengine
4242

@@ -51,11 +51,11 @@ use vs open and compile,suport windows 7sp1 and above
5151
Just Run it,use XEngine_AuthorizeApp
5252

5353
#### Linux
54-
use makefile compile,UBUNTU20.04 x64 or CENTOS8 x64
54+
use makefile compile,UBUNTU22.04 x64 or RockyLinux9 x64
5555
Run it on the terminal
5656

5757
#### Macos
58-
use makefile compile,mac 12 and above
58+
use makefile compile,mac 13 and above
5959
Run it on the terminal
6060

6161
##### complie
@@ -86,7 +86,7 @@ P2P distributed download is the same as the hyper-threaded download of other dow
8686
- XEngine_Docment docment directory
8787
- XEngine_Release install directory
8888
- XEngine_Source code directory
89-
- XEngine_APPClient client code dir
89+
- XEngine_APPClient client code dir(APPClient_UPDate is software update example of client)
9090
- XEngine_SQLFile database sql file
9191

9292
## Example

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ c c++ 存储服务 c c++ 文件存储服务
88
c c++ file storage service
99
这是一个上传下载服务API网关,不是文件同步服务,也不是云存储.
1010
这个服务的主要目的是为了给有上传下载服务业务需求的用户使用(比如需要开发上传下载服务的开发人员).
11-
此服务器更偏向于存储传输与API接口管理.
11+
此服务器更偏向于存储传输与API接口管理,此服务可以用于上传下载的管理,网络文件共享或者软件更新服务.
1212
目前最好的HTTP存储服务,比NGINX更优秀,更方便管理,代码更简洁.持续维护中...
1313

1414
## 软件特性
@@ -35,7 +35,7 @@ c c++ file storage service
3535
## 安装教程
3636

3737
#### XEngine环境
38-
必须安装XEngine,版本需要V7.38或者以上版本,安装XEngine可以参考其Readme文档
38+
必须安装XEngine,版本需要V8.10或者以上版本,安装XEngine可以参考其Readme文档
3939
GITEE:https://gitee.com/xyry/libxengine
4040
GITHUB:https://github.com/libxengine/xengine
4141

@@ -50,11 +50,11 @@ macos执行:./XEngine_LINEnv.sh -i 3
5050
直接运行即可,使用XEngine_AuthorizeApp
5151

5252
#### Linux
53-
Linux使用Makefile编译,UBUNTU20.04 x64或者CENTOS8 x64
53+
Linux使用Makefile编译,UBUNTU22.04 x64或者RockyLinux x64
5454
在控制台运行
5555

5656
#### Macos
57-
使用makefile编译,控制台运行,需要mac 12以及以上版本
57+
使用makefile编译,控制台运行,需要mac 13以及以上版本
5858
在控制台运行
5959

6060
##### 编译命令
@@ -76,7 +76,7 @@ make FLAGS=CleanAll 清理编译
7676
- XEngine_Docment 文档目录结构
7777
- XEngine_Release 安装目录结构
7878
- XEngine_Source 源代目录结构
79-
- XEngine_APPClient 客户端演示代码
79+
- XEngine_APPClient 客户端演示代码(APPClient_UPDate为软件更新演示客户端)
8080
- XEngine_SQLFile 数据库脚本文件
8181

8282
## 示例

XEngine_APPClient/APPClient_Download/APPClient_Download.cpp

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55
#ifdef _MSC_BUILD
66
#include <windows.h>
77
#include <tchar.h>
8-
#pragma comment(lib,"x86/XEngine_BaseLib/XEngine_BaseLib")
9-
#pragma comment(lib,"x86/XEngine_NetHelp/NetHelp_APIClient")
10-
#pragma comment(lib,"x86/XEngine_SystemSdk/XEngine_SystemApi")
8+
#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib")
9+
#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIClient")
10+
#pragma comment(lib,"XEngine_SystemSdk/XEngine_SystemApi")
1111
#pragma comment(lib,"Ws2_32")
12+
#ifdef _WIN64
13+
#pragma comment(lib,"../../XEngine_Source/x64/Debug/jsoncpp")
14+
#else
1215
#pragma comment(lib,"../../XEngine_Source/Debug/jsoncpp")
16+
#endif
1317
#else
1418
#endif
1519
#include <list>
@@ -29,19 +33,19 @@
2933
using namespace std;
3034

3135
//需要优先配置XEngine
32-
//WINDOWS使用VS2022 x86 debug 编译
36+
//WINDOWS使用VS2022 x86 或者 x64 debug 编译
3337
//linux::g++ -std=c++17 -Wall -g APPClient_Download.cpp -o APPClient_Download.exe -I ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -L /usr/local/lib/XEngine_Release/XEngine_BaseLib -L /usr/local/lib/XEngine_Release/XEngine_NetHelp -L /usr/local/lib/XEngine_Release/XEngine_SystemSdk -L ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -lXEngine_BaseLib -lNetHelp_APIClient -lXEngine_SystemApi -ljsoncpp
3438
//macos::g++ -std=c++17 -Wall -g APPClient_Download.cpp -o APPClient_Download.exe -I ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -L ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -lXEngine_BaseLib -lNetHelp_APIClient -lXEngine_SystemApi -ljsoncpp
3539

3640
typedef struct
3741
{
3842
XENGINE_PROTOCOL_FILE st_ProtocolFile;
39-
CHAR tszBuckKey[128];
40-
CHAR tszIPAddr[64];
43+
XCHAR tszBuckKey[128];
44+
XCHAR tszIPAddr[64];
4145
}P2PFILE_INFO;
4246

4347
//解析局域网中所有文件
44-
void P2PParse_List(LPCTSTR lpszMsgBuffer, int nMsgLen, list<P2PFILE_INFO>* pStl_ListFile)
48+
void P2PParse_List(LPCXSTR lpszMsgBuffer, int nMsgLen, list<P2PFILE_INFO>* pStl_ListFile)
4549
{
4650
Json::Value st_JsonRoot;
4751
Json::CharReaderBuilder st_JsonBuild;
@@ -64,13 +68,13 @@ void P2PParse_List(LPCTSTR lpszMsgBuffer, int nMsgLen, list<P2PFILE_INFO>* pStl_
6468
memset(&st_P2PFile, '\0', sizeof(P2PFILE_INFO));
6569

6670
st_P2PFile.st_ProtocolFile.nFileSize = st_JsonArray[i]["nFileSize"].asInt();
67-
_tcscpy(st_P2PFile.st_ProtocolFile.tszFileHash, st_JsonArray[i]["tszFileHash"].asCString());
68-
_tcscpy(st_P2PFile.st_ProtocolFile.tszFileName, st_JsonArray[i]["tszFileName"].asCString());
69-
_tcscpy(st_P2PFile.st_ProtocolFile.tszFilePath, st_JsonArray[i]["tszFilePath"].asCString());
70-
_tcscpy(st_P2PFile.st_ProtocolFile.tszFileTime, st_JsonArray[i]["tszFileTime"].asCString());
71-
_tcscpy(st_P2PFile.st_ProtocolFile.tszFileUser, st_JsonArray[i]["tszFileUser"].asCString());
72-
_tcscpy(st_P2PFile.tszIPAddr, st_JsonArray[i]["tszTableName"].asCString());
73-
_tcscpy(st_P2PFile.tszBuckKey, st_JsonArray[i]["tszBuckKey"].asCString());
71+
_tcsxcpy(st_P2PFile.st_ProtocolFile.tszFileHash, st_JsonArray[i]["tszFileHash"].asCString());
72+
_tcsxcpy(st_P2PFile.st_ProtocolFile.tszFileName, st_JsonArray[i]["tszFileName"].asCString());
73+
_tcsxcpy(st_P2PFile.st_ProtocolFile.tszFilePath, st_JsonArray[i]["tszFilePath"].asCString());
74+
_tcsxcpy(st_P2PFile.st_ProtocolFile.tszFileTime, st_JsonArray[i]["tszFileTime"].asCString());
75+
_tcsxcpy(st_P2PFile.st_ProtocolFile.tszFileUser, st_JsonArray[i]["tszFileUser"].asCString());
76+
_tcsxcpy(st_P2PFile.tszIPAddr, st_JsonArray[i]["tszTableName"].asCString());
77+
_tcsxcpy(st_P2PFile.tszBuckKey, st_JsonArray[i]["tszBuckKey"].asCString());
7478

7579
pStl_ListFile->push_back(st_P2PFile);
7680
}
@@ -82,7 +86,7 @@ typedef struct
8286
__int64x nPosStart;
8387
__int64x nPosEnd;
8488
}P2PFILE_PIECE;
85-
void P2PFile_Create(list<P2PFILE_INFO>* pStl_ListFile, LPCTSTR lpszFile)
89+
void P2PFile_Create(list<P2PFILE_INFO>* pStl_ListFile, LPCXSTR lpszFile)
8690
{
8791
P2PFILE_PIECE* pSt_P2PFile = new P2PFILE_PIECE[pStl_ListFile->size()];
8892

@@ -93,38 +97,38 @@ void P2PFile_Create(list<P2PFILE_INFO>* pStl_ListFile, LPCTSTR lpszFile)
9397
list<P2PFILE_INFO>::const_iterator stl_ListIterator = pStl_ListFile->begin();
9498
for (int i = 0; stl_ListIterator != pStl_ListFile->end(); stl_ListIterator++, i++)
9599
{
96-
TCHAR tszDLUrl[1024];
97-
TCHAR tszRange[128];
100+
XCHAR tszDLUrl[1024];
101+
XCHAR tszRange[128];
98102

99103
memset(tszDLUrl, '\0', sizeof(tszDLUrl));
100104
memset(tszRange, '\0', sizeof(tszRange));
101105

102-
_stprintf(tszDLUrl, _T("%s/%s/%s"), stl_ListIterator->tszIPAddr, stl_ListIterator->tszBuckKey, stl_ListIterator->st_ProtocolFile.tszFileName);
106+
_xstprintf(tszDLUrl, _X("%s/%s/%s"), stl_ListIterator->tszIPAddr, stl_ListIterator->tszBuckKey, stl_ListIterator->st_ProtocolFile.tszFileName);
103107
//是否是最后一块
104108
if ((int)pStl_ListFile->size() == (i + 1))
105109
{
106110
pSt_P2PFile[i].nPosStart = nPos;
107111
pSt_P2PFile[i].nPosEnd = 0;
108-
_stprintf(tszRange, _T("%lld-"), pSt_P2PFile[i].nPosStart);
112+
_xstprintf(tszRange, _X("%lld-"), pSt_P2PFile[i].nPosStart);
109113
}
110114
else
111115
{
112116
pSt_P2PFile[i].nPosStart = nPos;
113117
pSt_P2PFile[i].nPosEnd = nPiece;
114118
nPos += nPiece;
115-
_stprintf(tszRange, _T("%lld-%lld"), pSt_P2PFile[i].nPosStart, pSt_P2PFile[i].nPosEnd);
119+
_xstprintf(tszRange, _X("%lld-%lld"), pSt_P2PFile[i].nPosStart, pSt_P2PFile[i].nPosEnd);
116120
}
117-
pSt_P2PFile[i].xhToken = APIClient_File_Create(tszDLUrl, lpszFile, TRUE, tszRange);
121+
pSt_P2PFile[i].xhToken = APIClient_File_Create(tszDLUrl, lpszFile, true, tszRange);
118122
if (NULL == pSt_P2PFile[i].xhToken)
119123
{
120-
printf("create download task is failed:%X\n", APIClient_GetLastError());
124+
_xtprintf("create download task is failed:%X\n", APIClient_GetLastError());
121125
}
122126
APIClient_File_Start(pSt_P2PFile[i].xhToken);
123127
}
124128
//直到所有完成
125129
while (1)
126130
{
127-
BOOL bComplete = TRUE;
131+
bool bComplete = true;
128132
for (unsigned int i = 0; i < pStl_ListFile->size(); i++)
129133
{
130134
NETHELP_FILEINFO st_TaskInfo;
@@ -135,7 +139,7 @@ void P2PFile_Create(list<P2PFILE_INFO>* pStl_ListFile, LPCTSTR lpszFile)
135139
{
136140
bComplete = FALSE;
137141
}
138-
printf("DLToken:%p DLTotal:%lf DLNow:%lf DLStatus:%d\n", pSt_P2PFile[i].xhToken, st_TaskInfo.dlTotal, st_TaskInfo.dlNow, st_TaskInfo.en_DownStatus);
142+
_xtprintf("DLToken:%p DLTotal:%lf DLNow:%lf DLStatus:%d\n", pSt_P2PFile[i].xhToken, st_TaskInfo.dlTotal, st_TaskInfo.dlNow, st_TaskInfo.en_DownStatus);
139143
}
140144
if (bComplete)
141145
{
@@ -161,22 +165,22 @@ int main()
161165

162166
int nHTTPCode = 0;
163167
int nBodyLen = 0;
164-
TCHAR *ptszMsgBody = NULL;
168+
XCHAR *ptszMsgBody = NULL;
165169
//请求分布式存储文件所有位置
166-
LPCTSTR lpszUrl = _T("http://127.0.0.1:5100/Api/Manage/Query");
167-
LPCTSTR lpszFile = _T("D:\\XEngine_Storage\\XEngine_APPClient\\Debug\\qq.exe");
170+
LPCXSTR lpszUrl = _X("http://127.0.0.1:5100/Api/Manage/Query");
171+
LPCXSTR lpszFile = _X("D:\\XEngine_Storage\\XEngine_APPClient\\Debug\\qq.exe");
168172

169173
Json::Value st_JsonRoot;
170174
st_JsonRoot["nMode"] = 1; //使用P2P下载
171175
st_JsonRoot["lpszBuckKey"] = "storagekey2";
172176
//st_JsonRoot["lpszFileName"] = "qq.exe";
173177
st_JsonRoot["lpszFileHash"] = "781E5E245D69B566979B86E28D23F2C7";
174178

175-
if (!APIClient_Http_Request(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBody, &nBodyLen))
179+
if (!APIClient_Http_Request(_X("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBody, &nBodyLen))
176180
{
177181
return -1;
178182
}
179-
printf("%s\n", ptszMsgBody);
183+
_xtprintf("%s\n", ptszMsgBody);
180184

181185
list<P2PFILE_INFO> stl_ListFile;
182186
P2PParse_List(ptszMsgBody, nBodyLen, &stl_ListFile);

XEngine_APPClient/APPClient_Download/APPClient_Download.vcxproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@
7373
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
7474
<LinkIncremental>true</LinkIncremental>
7575
<IncludePath>$(XEngine_Include);../../XEngine_Source/XEngine_ThirdPart/jsoncpp;$(IncludePath)</IncludePath>
76-
<LibraryPath>$(XEngine_Library);$(LibraryPath)</LibraryPath>
76+
<LibraryPath>$(XEngine_Lib32);$(LibraryPath)</LibraryPath>
7777
</PropertyGroup>
7878
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
7979
<LinkIncremental>false</LinkIncremental>
8080
</PropertyGroup>
8181
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
8282
<LinkIncremental>true</LinkIncremental>
83+
<IncludePath>$(XEngine_Include);../../XEngine_Source/XEngine_ThirdPart/jsoncpp;$(IncludePath)</IncludePath>
84+
<LibraryPath>$(XEngine_Lib64);$(LibraryPath)</LibraryPath>
8385
</PropertyGroup>
8486
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
8587
<LinkIncremental>false</LinkIncremental>
@@ -116,7 +118,7 @@
116118
<ClCompile>
117119
<WarningLevel>Level3</WarningLevel>
118120
<SDLCheck>true</SDLCheck>
119-
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
121+
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
120122
<ConformanceMode>true</ConformanceMode>
121123
</ClCompile>
122124
<Link>

0 commit comments

Comments
 (0)