|
|
/**
|
||
|
|
* Tencent is pleased to support the open source community by making Tars available.
|
||
|
|
*
|
||
|
|
* Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
|
||
|
|
*
|
||
|
|
* Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
|
||
|
|
* in compliance with the License. You may obtain a copy of the License at
|
||
|
|
*
|
||
|
|
* https://opensource.org/licenses/BSD-3-Clause
|
||
|
|
*
|
||
|
|
* Unless required by applicable law or agreed to in writing, software distributed
|
||
|
|
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||
|
|
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||
|
|
* specific language governing permissions and limitations under the License.
|
||
|
|
*/
|
||
|
|
|
||
|
|
module tars
|
||
|
|
{
|
||
|
|
|
||
|
|
struct FileInfo
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* 文件路径, 相对listFileInfo中path的路径
|
||
|
|
**/
|
||
|
|
0 require string path;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 文件大小, 字节数
|
||
|
|
**/
|
||
|
|
1 require int size;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 文件是否可执行
|
||
|
|
*/
|
||
|
|
2 require bool canExec;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 该文件的MD5值
|
||
|
|
*/
|
||
|
|
3 optional string md5;
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
*
|
||
|
|
* 发布服务的接口
|
||
|
|
*
|
||
|
|
**/
|
||
|
|
interface Patch
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* 获取路径下所有文件列表信息
|
||
|
|
* @param path, 目录路径, 路径中不能包含..
|
||
|
|
* @param vector<FileInfo>, 文件列表信息
|
||
|
|
* @return int, 返回0表示path是目录, 1表示path是文件, -1表示路径错误
|
||
|
|
*/
|
||
|
|
int listFileInfo(string path, out vector<FileInfo> vf);
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 下载文件
|
||
|
|
* @param file, 文件路径
|
||
|
|
* @param pos, 从什么位置开始下载
|
||
|
|
* @param vector<byte>, 文件内容
|
||
|
|
* @param int, 0:读取表示成功, 1:读取到文件末尾了, <0: 读取失败
|
||
|
|
*/
|
||
|
|
int download(string file, int pos, out vector<byte> vb);
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 准备好需要patch的文件
|
||
|
|
* @param patchFile, 需要发布的文件名
|
||
|
|
* @return int, 0: 成功, <0: 失败
|
||
|
|
*/
|
||
|
|
int preparePatchFile(string app, string serverName, string patchFile);
|
||
|
|
};
|
||
|
|
|
||
|
|
};
|