分享
分享赚钱 收藏 举报 版权申诉 / 11

类型Communicator概要设计.docx

  • 上传人:精品资料
  • 文档编号:7650373
  • 上传时间:2019-05-23
  • 格式:DOCX
  • 页数:11
  • 大小:328.36KB
  • 配套讲稿:

    如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

    特殊限制:

    部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

    关 键  词:
    Communicator概要设计.docx
    资源描述:

    1、Communicator 概要设计版本 日期 内容/修改V0.0 6/13/2016 草稿1 结构Communicator基 础 模 块 , 提 供 通 用 请 求 、 同 步 文 件 上 传 下 载 接 口功 能 模 块 , 提 供 异 步 LOG上 传 、 文 件 上 传 下 载 接 口LOG接收线程LOG上传线程文件下载线程文件上传线程基 础 组 件配 置组 件日 志组 件LOG 接收线程: Communicator 将各客户端发送过来的 LOG 存放到数据库中。LOG 上传线程: Communicator 从数据库中取出 LOG 发送到管理平台。文件下载线程:Communicator

    2、从管理平台下载文件,需要创建两个下载线程,分别用来下载 Config/Policy 和其他文件。文件上传线程:Communicator 向管理平台上传文件。配置组件:配置服务器连接超时时间、LOG 上传间隔、一次上传条数、MD 校验错重传次数、日志等级。日志组件:记录 Communicator 模块的日志。2 流程Communicator 通过 libcurl 实现向 Server 发送/ 请求数据。2.1 注册Client Communicator ServerInitializeByConfigrequestresponseresponseGenCertInitializeByKeyGen

    3、Certresponse2.2 同步请求Client Communicator ServerSync requestrequestresponseresponse2.3 异步请求2.3.1 下载文件Client Communicator ServerrequestresponsecallbackScheduleMD5 checkresumeresponseDownloadData2.3.2 上传文件Client Communicator ServerrequestcallbackScheduleMD5 checkresponseUploadFile2.3.3 上传 LOGClient Comm

    4、unicator ServerrequestresponseInsert DBGet data from DBUpload logRemove data from DB3 接口3.1 ComSetWorkingDir/* 功能描述:设置工作路径,如果同一目录下的多个进程都需要初始化Communicator,需要在每个进程中设置不同的工作路径,工作路径必须存在* 参数:* dir: 工作路径*/int ComSetWorkingDir(const std:string3.3 ComInitByConfig/* 功能描述:通过从 Server 前端导出的配置文件初始化 Communicator*

    5、参数:* configPath: 配置文件路径* param: Callback 参数,均为可选参数ComCallbackFunc uploadFileCallback:上传文件 callback 函数ComCallbackFunc downloadFileCallback: 下载文件 callback 函数int uploadFileRetryCnt:上传文件失败重传次数int downloadFileRetryCnt: 下载文件失败重传次数*/int ComInitByConfig(const std:string3.4 ComRegister/* 功能描述:客户端向 Server 注册*

    6、 参数:* data: 注册信息* response: 返回的操作结果*/int ComRegister(const std:string3.5 ComHeartbeat/* 功能描述:客户端向 Server 发送心跳* 参数:* data: 心跳信息* response: 返回的操作结果*/int ComHeartbeat(const std:string3.6 ComSendRequest/* 功能描述:通用请求接口* 参数:* url: 请求 url,Communicator 提供宏定义,客户端传入* requestType: 请求类型 REQUEST_TYPE_GET/REQUEST_

    7、TYPE_POST* data: 待请求的数据* response: 返回的操作结果*/int ComSendRequest(const std:string3.7 ComDownloadFile/* 功能描述:异步文件下载接口* 参数:* param: 下载文件参数std:string url:请求 url,必要std:string data:忽略std:string filePath:下载文件目标路径,必要std:string md5:忽略*/int ComDownloadData(COM_REQ_PARAM3.8 ComUploadFile/* 功能描述:异步文件上传接口* 参数:* p

    8、aram: 下载文件参数std:string url:请求 url,必要std:string data:忽略std:string filePath:上传文件路径,必要std:string md5:文件 MD5,可选*/int ComUploadFile(COM_REQ_PARAM3.9 ComUploadLog/* 功能描述:异步 LOG 上传接口* 参数:* strUrl: 请求 url,Communicator 提供宏定义,客户端传入* strData: LOG 数据*/int ComUploadLog(const std:string3.10ComSingleStringToWide/*

    9、 功能描述:将 string 转为 wstring*/static std:wstring ComSingleStringToWide(const std:string 3.11 ComUtf8StringToWide/* 功能描述:将 utf8 string 转为 wstring*/static std:wstring ComUtf8StringToWide(const std:string 3.12 ComWideToSingleString/* 功能描述:将 wstring 转为 string*/static std:string ComWideToSingleString(const std:wstring 3.13 ComWideToUtf8String/* 功能描述:将 wstring 转为 utf8 string*/static std:string ComWideToUtf8String(const std:wstring

    展开阅读全文
    提示  道客多多所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
    关于本文
    本文标题:Communicator概要设计.docx
    链接地址:https://www.docduoduo.com/p-7650373.html
    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    道客多多用户QQ群:832276834  微博官方号:道客多多官方   知乎号:道客多多

    Copyright© 2025 道客多多 docduoduo.com 网站版权所有世界地图

    经营许可证编号:粤ICP备2021046453号    营业执照商标

    1.png 2.png 3.png 4.png 5.png 6.png 7.png 8.png 9.png 10.png



    收起
    展开