WO2011088710A1 - 一种下载数据的方法及装置 - Google Patents

一种下载数据的方法及装置 Download PDF

Info

Publication number
WO2011088710A1
WO2011088710A1 PCT/CN2010/079649 CN2010079649W WO2011088710A1 WO 2011088710 A1 WO2011088710 A1 WO 2011088710A1 CN 2010079649 W CN2010079649 W CN 2010079649W WO 2011088710 A1 WO2011088710 A1 WO 2011088710A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
information
download
block
background
Prior art date
Application number
PCT/CN2010/079649
Other languages
English (en)
French (fr)
Inventor
朱熠锷
朱云峰
Original Assignee
北京金山软件有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京金山软件有限公司 filed Critical 北京金山软件有限公司
Publication of WO2011088710A1 publication Critical patent/WO2011088710A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing
    • G06F16/2386Bulk updating operations

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for downloading data.
  • File block download is a download method for the communication sub-module in the software streaming system to download part of the data in a file.
  • the file is split at a fixed size and divided into several file blocks. The process of downloading a divided file block is called file block download.
  • the foreground download refers to the file block download caused by the block request of the software stream system, and the foreground download is the application running.
  • the most basic download methods in the process are the most basic download methods in the process.
  • the purpose of the embodiments of the present invention is to provide a method and an apparatus for downloading data, which solves the problem that the application program runs poorly and the network bandwidth is unbalanced in the prior art.
  • An embodiment of the present invention provides a method for downloading data, including:
  • the step of applying the data stream prefetching interface to perform data downloading in the background includes: obtaining, from the data stream prefetching interface, first operating point information of the application program;
  • the method further includes: if there is no empty block in the file block, the method further includes:
  • the second operating point information includes at least one operating point information.
  • the operation point information is represented by an abstract handle KEY; the file corresponding to each operation point information and the information file block information are respectively stored in a data cache.
  • the method further includes: recording file information downloaded in the foreground and file block information of the file.
  • the method further includes:
  • step i) obtaining the file block information downloaded through the foreground in the preset time period; the filled file block, if yes, performing step iii), if not, executing step iv);
  • Iv Query whether there is a file containing empty blocks, if any, according to the number of empty blocks included, Adding the file information and the file block information including the empty block file to the download task list in sequence, and downloading the data corresponding to the file block in the download task list through the background, and ending; if not, ending;
  • V adding the file information and the file block information to the download task list, and downloading data corresponding to the file block in the download task list through the background.
  • the embodiment of the invention further provides an apparatus for downloading data, including:
  • the foreground download unit is configured to perform a foreground download operation when the software stream system currently has a foreground download;
  • the first background downloading unit is configured to download the data stream pre-fetching interface in the background, and the data stream pre-fetching interface is used to download the data through the background.
  • a running point obtaining unit configured to obtain first operating point information of the application from the data stream prefetching interface
  • a first file block obtaining unit configured to obtain file information and file block information corresponding to the first running point information
  • a first background downloading subunit configured to determine that the file information and the file block information are added to the download task list when the empty block exists in the file block corresponding to the first running point information, and the download task list is obtained through the background The data corresponding to the file block in the file is downloaded.
  • the device further includes: an additional information acquiring unit, configured to acquire correlation information of the running point from the data stream prefetching interface, and the running point Freshness information;
  • the operating point obtaining unit is further configured to acquire second operating point information that has the highest correlation and the highest freshness with the first operating point;
  • the first file block obtaining unit is further configured to obtain file information and file block information corresponding to the second running point information;
  • the first background downloading subunit is further configured to determine that the file information and the file block information are added to the download task list when the empty block exists in the file block corresponding to the second running point information, and the download task is performed in the background The data corresponding to the file block in the list is downloaded.
  • the device further includes: a recording unit, configured to record file information downloaded in the foreground and file block information of the file when the download operation is performed in the foreground.
  • the device further includes:
  • a second file block obtaining unit configured to acquire a first query unit of a file block letter downloaded through the foreground in a preset time period, and configured to query whether the downloaded file block is adjacent to the file block that has been filled The filled file block, if present, notifies the determination module, and if not, notifies the second query unit;
  • a judging module configured to determine whether the unfilled file block has an empty block, and if there is an empty block, notify the second background second download subunit, and if there is no empty block, notify the second query module; a query unit, configured to query whether a file containing an empty block exists, and if yes, notify a second background download unit; if not, end;
  • a second background first download subunit configured to sequentially add the file information and the file block information including the empty block file to the download task list according to the number of the empty blocks, and pass the background to the file block in the download task list.
  • the corresponding data is downloaded and ended;
  • a second background second downloading subunit configured to add the file information and the file block information to the download task list, and download data corresponding to the file block in the download task list in the background.
  • the method and device for downloading data provided by the embodiment of the present invention, when there is a foreground download, prevents the background download, and when the current station does not perform the download operation, the background download is performed through the data stream prefetch interface, thereby solving the problem.
  • the application runs poorly and the network bandwidth is not balanced.
  • the process of data downloading by the application data stream prefetching interface through the background is actually equivalent to a general data stream prefetching framework, thus providing a unified access specification, which facilitates third party access on demand.
  • FIG. 1 is a flow chart of a method for downloading data according to an embodiment of the present invention
  • FIG. 2 is a flowchart of data downloading by an application data stream prefetching interface through a background according to an embodiment of the present invention
  • FIG. 3 is a flow chart of data downloading by recording information downloaded from the foreground according to an embodiment of the present invention
  • FIG. 4 is a flow chart of a load stream prefetch interface according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of an apparatus for downloading data according to an embodiment of the present invention. detailed description
  • Background download Corresponding to the foreground download, the background download is not triggered by the software stream service block request. It downloads data according to the specified policy to fill the file block.
  • Stream Prefetch Predicts block requests that may be raised by the application during the run and downloads the blocks to the client locally in advance using background downloads. This way, when the application has a block request, it can be read on the local disk to improve the user experience of software streaming.
  • FIG. 1 a flow chart of a method for downloading data according to an embodiment of the present invention. Specifically include:
  • Step 101 it is determined whether the software stream system currently has a foreground download, if it exists, step 102 is performed, if not, and after the data stream prefetch interface is successfully loaded, step 103 is performed;
  • Step 102 Perform a foreground download operation; at this time, block the background download operation to prevent the background download operation from preempting the system bandwidth resource;
  • Step 103 Apply the data stream prefetching interface to perform data downloading through the background.
  • the embodiment of the present invention provides a method for downloading data.
  • the background download is blocked.
  • the background download is performed by using the data stream prefetch interface. Therefore, the problem that the application program runs poorly and the network bandwidth is not balanced is solved in the prior art.
  • FIG. 2 it is a flowchart of data downloading by an application data stream prefetch interface through a background according to an embodiment of the present invention. This process specifically includes:
  • Step 201 Obtain first operating point information of the application from the data stream prefetching interface.
  • the first running point information may be expressed in the form of an abstract handle (KEY), that is, the abstract handle KEY is used.
  • KEY abstract handle
  • This article uses KEY as an example.
  • the above KEY is opaque to the software stream system, that is, the software stream system does not understand the specific content of the KEY.
  • the KEY may contain information such as the map location and level of the current user.
  • the KEY may contain information such as the map location and level of the current user.
  • the KEY may contain information such as the map location and level of the current user.
  • KEY The function module and the function point and the like that the current program is running may be included.
  • the operation for which the operation is being performed may be defined as a KEY.
  • the specific content of the KEY defined by the implementer is not limited. Therefore, for the software streaming system, there is no need to understand the specific content of the KEY.
  • Step 202 Obtain file information and file block information corresponding to the first running point information. Specifically, the file and file block information corresponding to each running point information are respectively stored in a data cache (DATACACHE);
  • DATACACHE data cache
  • the file information may include information such as a file ID, a location, and the like; the file block information may include a file block ID, a file block index, a size, and the like.
  • Step 203 it is determined whether there is an empty block in the file block corresponding to the first operating point information, and if so, step 204 is performed;
  • Step 204 Add the file information and the file block information to the download task list, and download data corresponding to the file block in the download task list through the background.
  • Step 205 Obtain the correlation information of the running point from the data stream prefetching interface, and the freshness of the running point.
  • the data stream prefetch interface includes KEY correlation information indicating the degree of correlation between the two KEYs, and the freshness information of the KEY; the so-called KEY freshness refers to In the file block included in the DATACACHE corresponding to the KEY, if there are more empty blocks, the freshness of the KEY corresponding to the DATACACHE is higher.
  • Step 206 Acquire second operating point information that has the highest correlation and the highest freshness with the first operating point
  • the foregoing second operating point information may be one or multiple, that is, the second operating point information includes at least one operating point information
  • Step 207 Obtain file information and file block information corresponding to the second running point information. Specifically, obtain DATACACHE corresponding to the second running point information; because the second running point information may be multiple, and each KEY Corresponding to a DATACACHE, so there may be more than one DATACACHE corresponding to the second running point information;
  • Step 208 Determine whether there is an empty block in the file block corresponding to the second running point information, and if yes, add the file information and the file block information to the download task list, and use the file in the download task list in the background.
  • the data corresponding to the block is downloaded; if there is no empty block, it ends.
  • the process of data downloading by the application data stream prefetching interface is equivalent to a general data stream prefetching framework, and the software stream system does not care about the specific implementation details of the data stream prefetching interface, such as What is the KEY, what is the DATACACHE corresponding to the KEY, etc.
  • the details of the specific implementation are left to the third party, and the general data stream prefetching framework provided by the application software streaming system facilitates the third party to access on demand.
  • the method may further include: recording file information downloaded by the front desk and file block information of the file, and the recorded information may be stored in the memory.
  • FIG. 3 there is shown a flow chart for data downloading by recording information downloaded from the foreground according to an embodiment of the present invention. This process specifically includes:
  • Step 301 Obtain file block information that is downloaded through the foreground in a preset time period.
  • the above file block information may include a file block ID, a file block index, a size, and the like;
  • Step 302 querying whether there is an unfilled file block adjacent to the file block that has been filled in the downloaded file block, if yes, executing step 303, if not, executing step 304; It should be noted that in the initial stage of loading an application (package) by the software stream system, all files are empty (that is, the file blocks of each related file are not filled). During the running of the application, the file data will be continuously requested. At this time, if the file block corresponding to the requested file data does not exist on the local disk, then the file block is downloaded and written back through the foreground download. Local Disk. Typically, the requested file block is discrete, that is, the application typically does not access every part of the file in order. Thus, during the running of the application, there will be cases where certain file blocks of some files are accessed, then the accessed file blocks are filled, and some file blocks have not been accessed yet. These un-accessed file blocks are left unfilled.
  • Step 303 it is determined whether there is an empty block in the unfilled file block, if there is an empty block, step 305 is performed, if there is no empty block, step 304 is performed;
  • Step 304 Query whether there is a file containing an empty block, if yes, execute step 306, and if not, end;
  • Step 305 Add the file information and the file block information to the download task list, and download the data corresponding to the file block in the download task list by using the background;
  • Step 306 The file information and the file block information including the empty block file are sequentially added to the download task list according to the number of the empty blocks, and the data corresponding to the file block in the download task list is downloaded in the background, and the process ends. .
  • FIG. 4 is a flowchart of loading a data stream prefetching interface according to an embodiment of the present invention, the process specifically includes:
  • Step 401 The software flow system determines whether the dynamic link library (DLL) of the data stream prefetch interface can be obtained. If yes, execute step 402. Otherwise, determine that the load data stream prefetch interface fails, and ends;
  • DLL dynamic link library
  • the software stream system can obtain the data stream prefetching interface by querying the data stream prefetching interface in the configuration file to determine whether the data stream prefetching interface can be obtained. For example, a packet has been marked in the configuration file to implement data stream prefetching. The interface obtains the data flow prefetch interface of the packet by querying the configuration file, and then judges The break can get the data stream prefetch interface.
  • Step 402 The software stream system loads the DLL through the extension module and invokes the data stream prefetch interface. If the load is successfully invoked, the data stream prefetch interface is successfully loaded. If the load call fails, loading the data stream prefetch interface fails.
  • the method for downloading data provided by the embodiment of the present invention first restricts the background download and the foreground download synchronization, that is, in the process of downloading the software stream service in the foreground, the background download action is prevented, and the background download preemption is prevented.
  • System bandwidth When the software streaming system is idle (when there is no foreground download), the background download is started. There are two ways to download the background. One is to enable the background download through the data stream prefetch interface when the data stream prefetch interface is successfully loaded, and the other is when the data stream prefetch interface is not successfully loaded. The background download is performed through the record information downloaded from the front desk.
  • the embodiment of the present invention further provides an apparatus for downloading data.
  • the method further includes: a foreground downloading unit 501, configured to perform a foreground downloading operation when the software stream system currently has a foreground download;
  • the first background downloading unit 502 is configured to download the data stream pre-fetching interface in the background, and the data stream pre-fetching interface is used to perform data downloading in the background.
  • a running point obtaining unit configured to acquire first operating point information of the application from the data stream prefetching interface
  • a first file block obtaining unit configured to obtain file information and file block information corresponding to the first running point information
  • a first background download subunit configured to determine that the file block corresponding to the first running point information exists When the block is empty, the file information and the file block information are added to the download task list, and the data corresponding to the file block in the download task list is downloaded through the background.
  • the device may further include: an additional information acquiring unit, configured to acquire correlation information of the running point from the data stream prefetching interface, and the running point Freshness information;
  • the operating point obtaining unit is further configured to acquire second operating point information that has the highest correlation and the highest freshness with the first operating point;
  • the first file block obtaining unit is further configured to obtain file information and file block information corresponding to the second running point information;
  • the first background downloading subunit is further configured to determine that the file information and the file block information are added to the download task list when the empty block exists in the file block corresponding to the second running point information, and the download task is performed in the background The data corresponding to the file block in the list is downloaded.
  • the device may further include:
  • the recording unit 503 is configured to record the file information downloaded in the foreground and the file block information of the file when the download operation is performed in the foreground.
  • the device may further include: a second background download unit 504, where the second background download unit 504 may specifically include:
  • a second file block obtaining unit configured to acquire file block information downloaded through the foreground in a preset time period
  • a first query unit configured to query whether there is an unfilled file block adjacent to the file block that has been filled in the downloaded file block, and if yes, notify the determining module, and if not, notify the second query unit ;
  • a judging module configured to determine whether the unfilled file block has an empty block, and if there is an empty block, notify the second background second download subunit, and if there is no empty block, notify the second query module; a query unit, configured to query whether a file containing an empty block exists, and if yes, notify a second background download unit; if not, end;
  • a second background first download subunit configured to sequentially add the file information and the file block information including the empty block file to the download task list according to the number of the empty blocks, and go through the background to the download task.
  • the data corresponding to the file block in the list is downloaded and ended;
  • a second background second downloading subunit configured to add the file information and the file block information to the download task list, and download data corresponding to the file block in the download task list in the background.
  • the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Description

一种下载数据的方法及装置
本申请要求于 2010 年 1 月 22 日提交中国专利局、 申请号为 201010100320.6、 发明名称为"一种下载数据的方法及装置 "的中国专利申请的 优先权, 其全部内容通过引用结合在本申请中。
技术领域
本发明涉及通信技术领域, 特别涉及一种下载数据的方法及装置。
背景技术
目前,数据下载主要通过文件块下载的方式完成。文件块下载是软件流系 统中通讯子模块下载一个文件内部分数据的一种下载方式。对于给定尺寸的文 件, 按照固定的大小对文件进行分割, 划分为若干文件块。 对分割好的文件块 进行下载的过程称为文件块下载。
在应用程序运行过程中, 只要使用的文件块没有存储在本地磁盘, 就会引 发前台下载,所谓前台下载是指,由软件流系统的块请求而引发的文件块下载, 前台下载是应用程序运行过程中最基本的下载方式之一。
然而, 现有的数据下载方式至少存在如下问题:
1、 在应用程序运行过程中, 频繁的缺块请求, 会导致软件流系统频繁的 进行前台下载操作, 而有限的网络通讯速度会导致所运行的应用程序经常停 顿、 从而使得运行不流畅。
2、在应用程序运行过程中, 只有要使用的文件块没有存储在本地磁盘时, 才会引发前台下载, 因而, 如果软件流服务只使用前台下载方式, 那么很可能 导致客户端系统的网络带宽占用不均衡。在某些空闲时刻, 空闲的网络带宽不 能得到有效使用。 发明内容
有鉴于此,本发明实施例的目的在于提供一种下载数据的方法及装置, 以 解决现有技术中应用程序运行不畅, 以及网络带宽占用不均衡的问题。
本发明实施例提供了一种下载数据的方法, 包括:
如果软件流系统当前存在前台下载, 则执行前台下载操作;
如果软件流系统当前不存在前台下载, 则在加载数据流预取接口成功后, 应用所述数据流预取接口通过后台进行数据下载。
其中, 应用所述数据流预取接口通过后台进行数据下载的步骤包括: 从所述数据流预取接口中获取应用程序的第一运行点信息;
获得与所述第一运行点信息对应的文件信息及文件块信息;
判断所述第一运行点信息对应的文件块中是否存在空块, 若是, 则将所述 文件信息和文件块信息加入到下载任务列表,通过后台对所述下载任务列表中 的文件块所对应的数据进行下载。
其中, 若所述文件块中不存在空块, 则所述方法还包括:
从所述数据流预取接口中获取运行点的相关度信息,及运行点的新鲜度信 息;
获取与所述第一运行点相关度最高且新鲜度最高的第二运行点信息; 获得与所述第二运行点信息对应的文件信息及文件块信息;
判断所述第二运行点信息对应的文件块中是否存在空块, 若是, 则将所述 文件信息和文件块信息加入到下载任务列表,通过后台对所述下载任务列表中 的文件块所对应的数据进行下载。
其中 , 所述第二运行点信息包括至少一个运行点信息。
其中, 所述运行点信息以抽象句柄 KEY的形式表示; 所述每个运行点信 息所对应的文件及信息文件块信息分别保存在一个数据高速緩存
DATACACHE中。
其中, 在前台执行下载操作时, 还包括: 记录前台下载的文件信息以及该 文件的文件块信息。
其中,如果软件流系统当前不存在前台下载,且加载数据流预取接口未成 功, 则所述方法还包括:
i )获取预设时间段内通过前台下载的文件块信息; 充的文件块, 若存在, 则执行步骤 iii ), 若不存在则执行步骤 iv );
iii )判断所述未被填充的文件块是否存在空块, 若存在空块, 则执行步骤 V ), 若不存在空块, 则执行步骤 iv );
iv )查询是否存在包含空块的文件,若存在, 则按照包含空块数量的多少, 将包含空块文件的文件信息和文件块信息依次加入到下载任务列表,通过后台 对所述下载任务列表中的文件块所对应的数据进行下载, 结束; 若不存在, 则 结束;
V )将所述文件信息和文件块信息加入到下载任务列表, 通过后台对所述 下载任务列表中的文件块所对应的数据进行下载。
本发明实施例还提供了一种下载数据的装置, 包括:
前台下载单元, 用于在软件流系统当前存在前台下载时,执行前台下载操 作;
第一后台下载单元, 用于在软件流系统当前不存在前台下载,且在加载数 据流预取接口成功时, 应用所述数据流预取接口通过后台进行数据下载。
其中, 所述第一后台下载单元包括:
运行点获取单元 ,用于从所述数据流预取接口中获取应用程序的第一运行 点信息;
第一文件块获取单元,用于获得与所述第一运行点信息对应的文件信息及 文件块信息;
第一后台下载子单元,用于判断所述第一运行点信息对应的文件块中存在 空块时,将所述文件信息和文件块信息加入到下载任务列表,通过后台对所述 下载任务列表中的文件块所对应的数据进行下载。
其中, 如果判断出所述文件块中不存在空块, 则所述装置还包括: 附加信息获取单元,用于从所述数据流预取接口中获取运行点的相关度信 息, 及运行点的新鲜度信息;
所述运行点获取单元,还用于获取与所述第一运行点相关度最高且新鲜度 最高的第二运行点信息;
所述第一文件块获取单元,还用于获得与所述第二运行点信息对应的文件 信息及文件块信息;
第一后台下载子单元,还用于判断所述第二运行点信息对应的文件块中存 在空块时,将所述文件信息和文件块信息加入到下载任务列表,通过后台对所 述下载任务列表中的文件块所对应的数据进行下载。
其中, 所述装置还包括: 记录单元, 用于在前台执行下载操作时,记录前台下载的文件信息以及该 文件的文件块信息。
其中,如果软件流系统当前不存在前台下载,且加载数据流预取接口未成 功, 则所述装置还包括:
第二文件块获取单元, 用于获取预设时间段内通过前台下载的文件块信 第一查询单元,用于查询所下载的文件块中是否存在与已经被填充的文件 块相邻的未被填充的文件块, 若存在, 则通知判断模块, 若不存在则通知第二 查询单元;
判断模块, 用于判断所述未被填充的文件块是否存在空块, 若存在空块, 则通知第二后台第二下载子单元, 若不存在空块, 则通知第二查询模块; 第二查询单元, 用于查询是否存在包含空块的文件, 若存在, 则通知第二 后台下载单元; 若不存在, 则结束;
第二后台第一下载子单元, 用于按照包含空块数量的多少,将包含空块文 件的文件信息和文件块信息依次加入到下载任务列表,过后台对所述下载任务 列表中的文件块所对应的数据进行下载, 结束;
第二后台第二下载子单元,用于将所述文件信息和文件块信息加入到下载 任务列表, 通过后台对所述下载任务列表中的文件块所对应的数据进行下载。
可见,应用本发明实施例提供的下载数据的方法和装置, 当存在前台下载 时, 阻止了后台下载, 当前台未进行下载操作时, 通过数据流预取接口的方式 进行后台下载,从而解决了现有技术中应用程序运行不畅, 以及网络带宽占用 不均衡的问题。再有, 由于应用数据流预取接口通过后台进行数据下载的流程 实际相当于一个通用的数据流预取框架, 因而提供了统一的接入规范, 方便了 第三方按需接入。 附图说明
为了更清楚地说明本发明实施例的技术方案 ,下面将对实施例中所需要使 用的附图作简单地介绍,显而易见地, 下面描述中的附图仅仅是本发明的一些 实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可 以根据这些附图获得其他的附图。
图 1是根据本发明实施例的一种下载数据的方法流程图;
图 2是根据本发明实施例的应用数据流预取接口通过后台进行数据下载 的流程图;
图 3 是根据本发明实施例的通过前台下载的记录信息进行数据下载的流 程图;
图 4是才 据本发明实施例的加载数据流预取接口的流程图;
图 5是^^据本发明实施例的下载数据的装置结构示意图。 具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清 楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是 全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造 性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。
为了方便后面叙述, 先介绍几个概念:
后台下载: 与前台下载相对应,后台下载并不是由软件流服务块请求而引 发。 它按照指定策略下载数据, 以填充文件块。
数据流预取: 预测应用程序在运行过程中可能引发的块请求, 并利用后台 下载提前将这些块下载到客户端本地。这样当应用程序有块请求时,可以在本 地磁盘读取, 改善软件流式运行的用户体验。
参见图 1 , 其是根据本发明实施例的一种下载数据的方法流程图。 具体包 括:
步骤 101, 判断软件流系统当前是否存在前台下载, 如果存在, 则执行步 骤 102, 如果不存在, 且在加载数据流预取接口成功后, 执行步骤 103;
步骤 102, 执行前台下载操作; 此时, 阻止后台下载操作, 以防止后台下 载操作抢占系统带宽资源;
步骤 103 , 应用所述数据流预取接口通过后台进行数据下载。
应用本发明实施例提供了下载数据的方法, 当存在前台下载时, 阻止后台 下载, 当前台未进行下载操作时, 通过数据流预取接口的方式进行后台下载, 从而解决了现有技术中应用程序运行不畅, 以及网络带宽占用不均衡的问题。 参见图 2, 其是根据本发明实施例的应用数据流预取接口通过后台进行数 据下载的流程图。 本流程具体包括:
步骤 201, 从所述数据流预取接口中获取应用程序的第一运行点信息; 具体的, 上述第一运行点信息可以以抽象句柄(KEY )的形式表示, 也就 是说, 抽象句柄 KEY用于记录应用程序当前的运行点。 当然, 也可以应用其 他形成进行表示, 本文以 KEY为例进行说明。
需要说明的是, 上述 KEY对于软件流系统而言是不透明的, 即软件流系 统并不了解 KEY的具体内容。这是因为,不同的应用程序所对应的 KEY是不 同的, 例如, 对于网游类应用程序而言, KEY可能包含当前用户所在的地图 位置、 等级等信息; 对于一般的桌面应用程序而言, KEY可能包含当前程序 正在运行的功能模块以及功能点等; 对于像 WPS这样的软件, 可以把用于正 在进行何种操作定义为 KEY, 本发明实施例中, 并不限制实现者定义 KEY的 具体内容, 因此, 对于软件流系统, 不需要理解 KEY的具体内容。
步骤 202, 获得与所述第一运行点信息对应的文件信息及文件块信息; 具体的,每个运行点信息所对应的文件及文件块信息分别保存在一个数据 高速緩存 ( DATACACHE ) 中;
上述文件信息可以包括文件 ID, 位置等信息; 上述文件块信息可以包括 文件块 ID、 文件块索引、 大小等等。
步骤 203 ,判断所述第一运行点信息对应的文件块中是否存在空块,若是, 则执行步骤 204;
步骤 204, 将所述文件信息和文件块信息加入到下载任务列表, 通过后台 对所述下载任务列表中的文件块所对应的数据进行下载。
需要说明的是, 本文中, 空块是指在客户端本地还没有被填充的文件块。 如果上述步骤 203中判断出文件块中不存在空块,则图 2所示流程还包括: 步骤 205, 从所述数据流预取接口中获取运行点的相关度信息, 及运行点 的新鲜度信息;
需要说明的是, 在数据流预取接口中包含了表示两个 KEY之间相关程度 的 KEY相关度信息, 以及 KEY的新鲜度信息; 所谓 KEY的新鲜度是指, 在 KEY 所对应的 DATACACHE 中所包含的文件块中 , 若空块越多 , 则该 DATACACHE所对应的 KEY的新鲜度就越高。
步骤 206, 获取与所述第一运行点相关度最高且新鲜度最高的第二运行点 信息;
需要说明的是, 上述第二运行点信息可以是一个, 也可以是多个, 即第二 运行点信息包括至少一个运行点信息;
步骤 207, 获得与所述第二运行点信息对应的文件信息及文件块信息; 具体的, 获取与第二运行点信息对应的 DATACACHE; 由于第二运行点 信息可以是多个, 而每个 KEY对应一个 DATACACHE, 因而这里与第二运行 点信息对应的 DATACACHE也可能是多个;
步骤 208,判断所述第二运行点信息对应的文件块中是否存在空块,若是, 则将所述文件信息和文件块信息加入到下载任务列表,通过后台对所述下载任 务列表中的文件块所对应的数据进行下载; 若不存在空块, 则结束。
根据图 2的描述可知,该应用数据流预取接口通过后台进行数据下载的流 程实际相当于一个通用的数据流预取框架 ,软件流系统并不关心数据流预取接 口的具体实现细节,如 KEY是什么 ,与 KEY对应的 DATACACHE是什么等 , 这里,将具体实现的细节留给第三方, 而应用软件流系统提供的通用的数据流 预取框架, 方便了第三方按需接入。 此外, 在前台执行下载操作时, 即在步骤 101之后, 还可以包括: 记录前 台下载的文件信息以及该文件的文件块信息, 该记录的信息可以保存于内存 中。 这样, 如果软件流系统当前不存在前台下载, 且加载数据流预取接口未成 功, 则可以按图 3所示流程执行数据下载操作。
参见图 3, 其是根据本发明实施例的通过前台下载的记录信息进行数据下 载的流程图。 本流程具体包括:
步骤 301, 获取预设时间段内通过前台下载的文件块信息;
上述文件块信息可以包括文件块 ID、 文件块索引、 大小等等;
步骤 302, 查询所下载的文件块中是否存在与已经被填充的文件块相邻的 未被填充的文件块, 若存在, 则执行步骤 303, 若不存在则执行步骤 304; 需要说明的是, 在软件流系统加载一个应用程序(包)的最开始阶段, 所 有的文件都是空的 (亦即每一个相关文件的文件块都未被填充)。 在应用程序 的运行过程中, 会不断的请求文件数据, 这个时候, 如果被请求的文件数据所 对应的文件块在本地磁盘不存在,那么就通过前台下载将这些文件块下载回来 并写回到本地磁盘。 通常情况下, 被请求的文件块是离散的, 也就是说, 应用 程序通常不会按顺序的访问文件的每一个部分。这样,在应用程序运行过程中, 会出现这样的情况: 某些文件的某些文件块被访问了, 那么, 这些被访问的文 件块就处于填充状态, 而某些文件块还未被访问到,这些未被访问的文件块就 处于未被填充状态。
步骤 303 , 判断所述未被填充的文件块是否存在空块, 若存在空块, 则执 行步骤 305, 若不存在空块, 则执行步骤 304;
步骤 304, 查询是否存在包含空块的文件, 若存在, 则执行步骤 306, 若 不存在, 则结束;
也就是说,如果不存在空块, 则说明该应用程序中包含文件块都已经被填 充满了, 因而可以退出后台下载, 结束;
步骤 305 , 将所述文件信息和文件块信息加入到下载任务列表, 通过后台 对所述下载任务列表中的文件块所对应的数据进行下载;
步骤 306, 按照包含空块数量的多少, 将包含空块文件的文件信息和文件 块信息依次加入到下载任务列表,过后台对所述下载任务列表中的文件块所对 应的数据进行下载, 结束。
至此, 通过前台下载的记录信息实现了数据的后台下载。
参见图 4, 其是根据本发明实施例的加载数据流预取接口的流程图, 本流 程具体包括:
步骤 401 , 软件流系统判断是否能够获取数据流预取接口的动态连接库 ( DLL ), 若能够获取, 则执行步骤 402, 否则, 确定加载数据流预取接口失 败, 结束;
具体的,软件流系统可以通过查询配置文件中的数据流预取接口实现信息, 来 判断是否能够获取数据流预取接口; 例如,在配置文件中已注明了某包实现了 数据流预取接口, 则通过查询配置文件获知该包的数据流预取接口存在, 则判 断出能够获取数据流预取接口。
步骤 402, 软件流系统通过扩展模块加载所述 DLL并调用数据流预取接 口, 若加载调用成功, 则加载数据流预取接口成功, 若加载调用失败, 则加载 数据流预取接口失败。
至此, 完成了加载数据流预取接口的操作。
综合图 1至图 4可知,本发明实施例提供的下载数据方法, 首先限制了后 台下载与前台下载同步进行, 即在软件流服务进行前台下载的过程中, 阻止后 台下载动作, 防止后台下载抢占系统带宽。 当软件流系统空闲时(无前台下载 时), 才启动后台下载。 对于后台下载又有两种途径, 一种是在数据流预取接 口加载成功的情况下,通过数据流预取接口实现后台下载, 另一种是在数据流 预取接口加载未成功的情况下 , 通过前台下载的记录信息进行后台下载。
可见, 应用本发明实施例提供的下载数据的方法, 当存在前台下载时, 阻 止了后台下载, 当前台未进行下载操作时,通过数据流预取接口的方式进行后 台下载,从而解决了现有技术中应用程序运行不畅, 以及网络带宽占用不均衡 的问题。再有, 由于应用数据流预取接口通过后台进行数据下载的流程实际相 当于一个通用的数据流预取框架, 因而提供了统一的接入规范, 方便了第三方 按需接入。 本发明实施例还提供了一种下载数据的装置, 参见图 5 , 具体包括: 前台下载单元 501, 用于在软件流系统当前存在前台下载时, 执行前台下 载操作;
第一后台下载单元 502, 用于在软件流系统当前不存在前台下载, 且在加 载数据流预取接口成功时 , 应用所述数据流预取接口通过后台进行数据下载。
上述第一后台下载单元可以具体包括:
运行点获取单元,用于从所述数据流预取接口中获取应用程序的第一运行 点信息;
第一文件块获取单元,用于获得与所述第一运行点信息对应的文件信息及 文件块信息;
第一后台下载子单元,用于判断所述第一运行点信息对应的文件块中存在 空块时,将所述文件信息和文件块信息加入到下载任务列表,通过后台对所述 下载任务列表中的文件块所对应的数据进行下载。
如果判断出所述文件块中不存在空块, 则所述装置还可以具体包括: 附加信息获取单元,用于从所述数据流预取接口中获取运行点的相关度信 息, 及运行点的新鲜度信息;
所述运行点获取单元,还用于获取与所述第一运行点相关度最高且新鲜度 最高的第二运行点信息;
所述第一文件块获取单元,还用于获得与所述第二运行点信息对应的文件 信息及文件块信息;
第一后台下载子单元,还用于判断所述第二运行点信息对应的文件块中存 在空块时,将所述文件信息和文件块信息加入到下载任务列表,通过后台对所 述下载任务列表中的文件块所对应的数据进行下载。
其中, 所述装置还可以具体包括:
记录单元 503, 用于在前台执行下载操作时, 记录前台下载的文件信息以 及该文件的文件块信息。
如果软件流系统当前不存在前台下载,且加载数据流预取接口未成功, 则 所述装置还可以具体包括: 第二后台下载单元 504, 该第二后台下载单元 504 可以具体包括:
第二文件块获取单元, 用于获取预设时间段内通过前台下载的文件块信 息;
第一查询单元,用于查询所下载的文件块中是否存在与已经被填充的文件 块相邻的未被填充的文件块, 若存在, 则通知判断模块, 若不存在则通知第二 查询单元;
判断模块, 用于判断所述未被填充的文件块是否存在空块, 若存在空块, 则通知第二后台第二下载子单元, 若不存在空块, 则通知第二查询模块; 第二查询单元, 用于查询是否存在包含空块的文件, 若存在, 则通知第二 后台下载单元; 若不存在, 则结束;
第二后台第一下载子单元, 用于按照包含空块数量的多少,将包含空块文 件的文件信息和文件块信息依次加入到下载任务列表,过后台对所述下载任务 列表中的文件块所对应的数据进行下载, 结束;
第二后台第二下载子单元,用于将所述文件信息和文件块信息加入到下载 任务列表, 通过后台对所述下载任务列表中的文件块所对应的数据进行下载。
可见, 应用本发明实施例提供的下载数据的装置, 当存在前台下载时, 阻 止了后台下载, 当前台未进行下载操作时,通过数据流预取接口的方式进行后 台下载,从而解决了现有技术中应用程序运行不畅, 以及网络带宽占用不均衡 的问题。再有, 由于应用数据流预取接口通过后台进行数据下载的流程实际相 当于一个通用的数据流预取框架, 因而提供了统一的接入规范, 方便了第三方 按需接入。
对于装置实施例而言, 由于其基本相似于方法实施例, 所以描述的比较简 单, 相关之处参见方法实施例的部分说明即可。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将 一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些 实体或操作之间存在任何这种实际的关系或者顺序。 而且, 术语"包括"、 "包 含"或者其任何其他变体意在涵盖非排他性的包含, 从而使得包括一系列要素 的过程、 方法、物品或者设备不仅包括那些要素 , 而且还包括没有明确列出的 其他要素, 或者是还包括为这种过程、 方法、 物品或者设备所固有的要素。 在 没有更多限制的情况下, 由语句 "包括一个 ...... "限定的要素, 并不排除在包括 所述要素的过程、 方法、 物品或者设备中还存在另外的相同要素。
本领域普通技术人员可以理解实现上述方法实施方式中的全部或部分步 骤是可以通过程序来指令相关的硬件来完成 ,所述的程序可以存储于计算机可 读取存储介质中, 这里所称得的存储介质, 如: ROM/RAM、 磁碟、 光盘等。
以上所述仅为本发明的较佳实施例而已, 并非用于限定本发明的保护范 围。 凡在本发明的精神和原则之内所作的任何修改、 等同替换、 改进等, 均包 含在本发明的保护范围内。

Claims

权 利 要 求
1、 一种下载数据的方法, 其特征在于, 包括:
如果软件流系统当前存在前台下载, 则执行前台下载操作;
如果软件流系统当前不存在前台下载, 则在加载数据流预取接口成功后, 应用所述数据流预取接口通过后台进行数据下载。
2、 根据权利要求 1所述的方法, 其特征在于, 应用所述数据流预取接口 通过后台进行数据下载的步骤包括:
从所述数据流预取接口中获取应用程序的第一运行点信息;
获得与所述第一运行点信息对应的文件信息及文件块信息;
判断所述第一运行点信息对应的文件块中是否存在空块, 若是, 则将所述 文件信息和文件块信息加入到下载任务列表,通过后台对所述下载任务列表中 的文件块所对应的数据进行下载。
3、 根据权利要求 2所述的方法, 其特征在于, 若所述文件块中不存在空 块, 则所述方法还包括:
从所述数据流预取接口中获取运行点的相关度信息,及运行点的新鲜度信 获取与所述第一运行点相关度最高且新鲜度最高的第二运行点信息; 获得与所述第二运行点信息对应的文件信息及文件块信息;
判断所述第二运行点信息对应的文件块中是否存在空块, 若是, 则将所述 文件信息和文件块信息加入到下载任务列表,通过后台对所述下载任务列表中 的文件块所对应的数据进行下载。
4、 根据权利要求 3所述的方法, 其特征在于, 所述第二运行点信息包括 至少一个运行点信息。
5、 根据权利要求 4所述的方法, 其特征在于, 所述运行点信息以抽象句 柄 KEY的形式表示; 所述每个运行点信息所对应的文件及文件块信息分别保 存在一个数据高速緩存 DATACACHE中。
6、 根据权利要求 1所述的方法, 其特征在于, 在前台执行下载操作时, 还包括: 记录前台下载的文件信息以及该文件的文件块信息。
7、 根据权利要求 6所述的方法, 其特征在于, 如果软件流系统当前不存 在前台下载, 且加载数据流预取接口未成功, 则所述方法还包括: i )获取预设时间段内通过前台下载的文件块信息; 充的文件块, 若存在, 则执行步骤 iii ), 若不存在则执行步骤 iv );
iii )判断所述未被填充的文件块是否存在空块, 若存在空块, 则执行步骤
V ) , 若不存在空块, 则执行步骤 iv );
iv )查询是否存在包含空块的文件,若存在, 则按照包含空块数量的多少, 将包含空块文件的文件信息和文件块信息依次加入到下载任务列表,通过后台 对所述下载任务列表中的文件块所对应的数据进行下载, 结束; 若不存在, 则 结束;
V )将所述文件信息和文件块信息加入到下载任务列表, 通过后台对所述 下载任务列表中的文件块所对应的数据进行下载。
8、 一种下载数据的装置, 其特征在于, 包括:
前台下载单元, 用于在软件流系统当前存在前台下载时,执行前台下载操 作;
第一后台下载单元, 用于在软件流系统当前不存在前台下载,且在加载数 据流预取接口成功时, 应用所述数据流预取接口通过后台进行数据下载。
9、 根据权利要求 8所述的装置, 其特征在于, 所述第一后台下载单元包 括:
运行点获取单元,用于从所述数据流预取接口中获取应用程序的第一运行 点信息;
第一文件块获取单元,用于获得与所述第一运行点信息对应的文件信息及 文件块信息;
第一后台下载子单元,用于判断所述第一运行点信息对应的文件块中存在 空块时,将所述文件信息和文件块信息加入到下载任务列表,通过后台对所述 下载任务列表中的文件块所对应的数据进行下载。
10、根据权利要求 9所述的装置, 其特征在于, 如果判断出所述文件块中 不存在空块, 则所述装置还包括:
附加信息获取单元,用于从所述数据流预取接口中获取运行点的相关度信 息, 及运行点的新鲜度信息;
所述运行点获取单元,还用于获取与所述第一运行点相关度最高且新鲜度 最高的第二运行点信息;
所述第一文件块获取单元,还用于获得与所述第二运行点信息对应的文件 信息及文件块信息;
第一后台下载子单元,还用于判断所述第二运行点信息对应的文件块中存 在空块时,将所述文件信息和文件块信息加入到下载任务列表,通过后台对所 述下载任务列表中的文件块所对应的数据进行下载。
11、 根据权利要求 8所述的装置, 其特征在于, 所述装置还包括: 记录单元, 用于在前台执行下载操作时,记录前台下载的文件信息以及该 文件的文件块信息。
12、 根据权利要求 11所述的装置, 其特征在于, 如果软件流系统当前不 存在前台下载, 且加载数据流预取接口未成功, 则所述装置还包括:
第二文件块获取单元, 用于获取预设时间段内通过前台下载的文件块信 息;
第一查询单元,用于查询所下载的文件块中是否存在与已经被填充的文件 块相邻的未被填充的文件块, 若存在, 则通知判断模块, 若不存在则通知第二 查询单元;
判断模块, 用于判断所述未被填充的文件块是否存在空块, 若存在空块, 则通知第二后台第二下载子单元, 若不存在空块, 则通知第二查询模块; 第二查询单元, 用于查询是否存在包含空块的文件, 若存在, 则通知第二 后台下载单元; 若不存在, 则结束;
第二后台第一下载子单元, 用于按照包含空块数量的多少,将包含空块文 件的文件信息和文件块信息依次加入到下载任务列表,过后台对所述下载任务 列表中的文件块所对应的数据进行下载, 结束;
第二后台第二下载子单元,用于将所述文件信息和文件块信息加入到下载 任务列表, 通过后台对所述下载任务列表中的文件块所对应的数据进行下载。
PCT/CN2010/079649 2010-01-22 2010-12-10 一种下载数据的方法及装置 WO2011088710A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010100320.6A CN102137122B (zh) 2010-01-22 2010-01-22 一种下载数据的方法及装置
CN201010100320.6 2010-01-22

Publications (1)

Publication Number Publication Date
WO2011088710A1 true WO2011088710A1 (zh) 2011-07-28

Family

ID=44296777

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/079649 WO2011088710A1 (zh) 2010-01-22 2010-12-10 一种下载数据的方法及装置

Country Status (2)

Country Link
CN (1) CN102137122B (zh)
WO (1) WO2011088710A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779068A (zh) * 2012-07-10 2012-11-14 宇龙计算机通信科技(深圳)有限公司 移动终端和应用程序联网控制方法
CN105323315B (zh) * 2015-10-19 2018-12-25 北京奇虎科技有限公司 基于移动终端的应用下载方法、服务器及客户端
CN107547591A (zh) * 2016-06-27 2018-01-05 中兴通讯股份有限公司 升级服务器、机顶盒、机顶盒升级文件下发方法及系统
US20180176325A1 (en) * 2016-12-15 2018-06-21 Huawei Technologies Co., Ltd. Data pre-fetching in mobile networks

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1960258A (zh) * 2006-10-20 2007-05-09 中兴通讯股份有限公司 一种广播网络中实现文件下载的方法
CN101453410A (zh) * 2007-12-07 2009-06-10 北京闻言科技有限公司 一种通过应用缓存提高文件下载速度的方法
CN101626391A (zh) * 2008-07-08 2010-01-13 盛大计算机(上海)有限公司 网络游戏客户端资源处理方法

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6574618B2 (en) * 1998-07-22 2003-06-03 Appstream, Inc. Method and system for executing network streamed application

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1960258A (zh) * 2006-10-20 2007-05-09 中兴通讯股份有限公司 一种广播网络中实现文件下载的方法
CN101453410A (zh) * 2007-12-07 2009-06-10 北京闻言科技有限公司 一种通过应用缓存提高文件下载速度的方法
CN101626391A (zh) * 2008-07-08 2010-01-13 盛大计算机(上海)有限公司 网络游戏客户端资源处理方法

Also Published As

Publication number Publication date
CN102137122A (zh) 2011-07-27
CN102137122B (zh) 2014-08-20

Similar Documents

Publication Publication Date Title
US8239564B2 (en) Dynamic throttling based on network conditions
US9882975B2 (en) Method and apparatus for buffering and obtaining resources, resource buffering system
US9654585B2 (en) Efficient file management through granular opportunistic locking
US9781142B2 (en) Scanning files for inappropriate content during synchronization
JP4613023B2 (ja) プロトコル独立型クライアント側キャッシュ(protocol−independentclient−sidecaching)システムおよび方法
US20130227132A1 (en) Automatically selecting appropriate platform to run application in cloud computing environment
EP2645295A2 (en) Secure and reliable remote data protection
WO2019047821A1 (zh) 业务路由的方法、装置及存储介质
EP4109861A1 (en) Data processing method, apparatus, computer device, and storage medium
WO2011038628A1 (zh) 数据获取方法、接入节点和系统
WO2011088710A1 (zh) 一种下载数据的方法及装置
CN106657182B (zh) 云端文件处理方法和装置
US9213674B2 (en) Sharing memory among mobile devices
US8521902B2 (en) Shared buffer for connectionless transfer protocols
EP3555767B1 (en) Partial storage of large files in distinct storage systems
KR100733247B1 (ko) 클라이언트 디바이스로의 전송을 위한 콘텐츠를 서비스하는 방법, 클라이언트 디바이스에 콘텐츠를 제공하는 시스템 및 컴퓨터 판독가능한 기록 매체
Bhardwaj et al. Appflux: Taming app delivery via streaming
CN107404504B (zh) 通信方法、装置及系统
CN103259817B (zh) 资源释放方法及装置
US11656860B2 (en) Bundling data packages based on usage patterns for download control
CN114900485B (zh) 访问网络文件存储的方法、电子设备及系统
US11900152B1 (en) Controlled automatic updates to disk image layers with compatibility verification
US20230412693A1 (en) Network-aware endpoint data loss prevention for web transactions
US20240106761A1 (en) Adaptive scaling of buffers for communication sessions
CN110309079B (zh) 一种数据缓存的方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 10843750

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 10843750

Country of ref document: EP

Kind code of ref document: A1