146 lines
3.8 KiB
Protocol Buffer
146 lines
3.8 KiB
Protocol Buffer
//========================================================================================
|
||
// @file FileSynch.proto
|
||
// @brief 文件同步服务结构体
|
||
// @author shijianquan
|
||
//========================================================================================
|
||
|
||
syntax="proto2";
|
||
package iot_idl;
|
||
|
||
/*********服务间的同步******************************************************************/
|
||
//文件块
|
||
message DataBlock
|
||
{
|
||
required uint64 index = 1;//文件块的序号
|
||
required uint64 offset = 2;//块偏移位置
|
||
required uint64 len = 3;//块大小
|
||
required bytes buff = 4;//块内容
|
||
}
|
||
|
||
//文件信息命令
|
||
message DataPack
|
||
{
|
||
required string pathFile =1;//带有路径的文件名
|
||
required uint64 blockCount = 2;//块总数
|
||
required int32 isDir = 3;//是否路径
|
||
required uint64 fileSize = 4;//文件大小
|
||
required string checkCode = 5; //文件校验码,md5
|
||
optional DataBlock dataBlock = 6;//文件块
|
||
optional string renamePathFile = 7;//重命名的文件名
|
||
}
|
||
|
||
//文件信息节点
|
||
message FileNode
|
||
{
|
||
required string pathFile = 1;//当前文件路径
|
||
required int32 isDir = 2;//是否路径
|
||
required int32 isConfigPath = 3;//是否配置中的目录
|
||
optional uint64 fileSize = 4;//文件大小
|
||
optional uint64 modifyTime = 5;//文件修改时间
|
||
repeated FileNode childNode = 6;//子节点
|
||
}
|
||
|
||
/********文件结构******************************************************************/
|
||
//请求文件列表命令
|
||
message FileNodeReqMsg
|
||
{
|
||
required string hostName = 1;//发送端主机名
|
||
repeated string pathFile = 2;//请求的文件夹,文件夹则是目录下所有
|
||
}
|
||
|
||
//请求文件列表应答
|
||
message FileNodeRespMsg
|
||
{
|
||
required string hostName = 1;//发送端主机名
|
||
required int32 isRoot = 2;//是否根目录
|
||
repeated FileNode node = 3;//子节点
|
||
}
|
||
|
||
/********文件变化推送******************************************************************/
|
||
//变化请求
|
||
message FileChangeReqMsg
|
||
{
|
||
required string hostName =1;//发送端主机名
|
||
required int32 optType= 2;//操作
|
||
required string pathFile = 3;//带有路径的文件名
|
||
}
|
||
|
||
//变化执行
|
||
message FileChangeExeMsg
|
||
{
|
||
required string hostName =1;//发送端主机名
|
||
required int32 optType= 2;//操作
|
||
required string pathFile = 3;//带有路径的文件名
|
||
required DataPack dataPack = 4;//文件信息包
|
||
}
|
||
|
||
/********广播文件******************************************************************/
|
||
|
||
enum enTaskType
|
||
{
|
||
enTaskType_STOP = 0; //开始
|
||
enTaskType_ONLY_NODE = 1; //只同步结构
|
||
enTaskType_DATA_NODE = 2; //同步数据和结构
|
||
}
|
||
|
||
//创建同步任务
|
||
message BroadcastTaskMsg
|
||
{
|
||
required string hostName = 1;//任务发起的主机名
|
||
required string recvHostName = 2;//执行端主机名,空就广播
|
||
required uint64 taskTime = 3;//任务时间
|
||
repeated string pathFile = 4;//同步的目录
|
||
required enTaskType operate = 5;//0 停止 1 同步目录和文件 2 只同步目录结构
|
||
}
|
||
|
||
//执行广播
|
||
message ExeBroadcastMsg
|
||
{
|
||
required string hostName = 1;//发送端主机名
|
||
required BroadcastTaskMsg task = 2;//任务
|
||
required uint64 taskTime = 3;//任务时间
|
||
required int32 count = 4;//总数
|
||
required int32 sendCount = 5;//已经发送个数
|
||
optional FileNode node = 6;//文件列表
|
||
optional DataPack dataPack = 7;//文件内容
|
||
}
|
||
|
||
//任务状态
|
||
enum enTaskStatusType
|
||
{
|
||
enTask_START = 1; //开始
|
||
enTask_END = 2; //结束
|
||
enTask_EXEING = 3; //执行中
|
||
}
|
||
|
||
//执行任务结果
|
||
message BroadcastResultMsg
|
||
{
|
||
required string hostName = 1;//发送端主机名
|
||
required BroadcastTaskMsg task = 2;//任务
|
||
required bool isSuccess = 3;//是否成功
|
||
required enTaskStatusType status = 4;//状态
|
||
required string resultStr = 5;//信息
|
||
required int32 count = 6;//总数
|
||
required int32 sendCount = 7;//已经发送个数
|
||
required string pathFile = 8;//当前执行文件
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|