CN103942208B - Document handling method and device - Google Patents

Document handling method and device Download PDF

Info

Publication number
CN103942208B
CN103942208B CN201310020004.1A CN201310020004A CN103942208B CN 103942208 B CN103942208 B CN 103942208B CN 201310020004 A CN201310020004 A CN 201310020004A CN 103942208 B CN103942208 B CN 103942208B
Authority
CN
China
Prior art keywords
file
block
files
blocks
difference
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201310020004.1A
Other languages
Chinese (zh)
Other versions
CN103942208A (en
Inventor
侯伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lenovo Beijing Ltd
Original Assignee
Lenovo Beijing Ltd
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 Lenovo Beijing Ltd filed Critical Lenovo Beijing Ltd
Priority to CN201310020004.1A priority Critical patent/CN103942208B/en
Publication of CN103942208A publication Critical patent/CN103942208A/en
Application granted granted Critical
Publication of CN103942208B publication Critical patent/CN103942208B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • G06F16/1824Distributed file systems implemented using Network-attached Storage [NAS] architecture
    • G06F16/183Provision of network file services by network file servers, e.g. by using NFS, CIFS
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems

Abstract

Provide a kind of document handling method and device applied in terminal device and server.A kind of document handling method applied to terminal device includes:By the first version of the first file in file system layer piecemeal, the blocks of files of the first quantity of acquisition;It receives on the basis of the first version of first file to the write operation of first file;In response to the write operation to first file, the new blocks of files of the second quantity is generated;For each new blocks of files, file in the block respective file block of the new blocks of files in first quantity is determined, and generate the difference block of the new blocks of files and the respective file block;The preservation to first file is received to operate;And operated in response to described preserve, the second edition of first file and the difference block are preserved, wherein the second edition of first file contains the operating result of the write operation.

Description

Document handling method and device
Technical field
The present invention relates to file management, and relate more specifically to a kind of text that can more effectively store and transmit file Part processing method and processing device.
Background technology
Currently, Dropbox is largely risen, such as has existed Sina's Dropbox, 360 Dropbox, Baidu's Dropbox, Huawei's Dropbox etc., User only needs the cost of very little that can just preserve the file of oneself in Dropbox, so as to realize access anywhere or anytime and same Step file.
On the other hand, after file is changed on the terminal device, user needs will be in modified entire file whole It passes on Dropbox server, with the original preserved in Dropbox using the replacement of modified file.When terminal device be according to During the terminal device of network traffic data payment, such as move equipment or set by the various terminals of the ADSL user of flow charging It is standby etc., modified entire file is all uploaded into Dropbox server and might mean that more network traffic datas and be System power consumption.
It for example, ought be only in the case where the end of file with the word document of page 500 increases a word, after modification Entire file all upload to Dropbox server and obviously considerably increase network traffic data and system power dissipation.In ideal situation Under, if only by data involved by increased that sentence upload to Dropbox server, there may be minimum data flows Amount.
It can be synchronized between Dropbox server and terminal device with network traffic data few as possible therefore, it is necessary to a kind of The document handling method and device of file.
Invention content
The present invention is proposed in view of the above problem.The present invention provides a kind of document handling method and devices, lead to It crosses file is divided documents into multiple original document blocks in file system layer piecemeal, change file based on this, File is generated at least one new blocks of files, and generate the difference between the corresponding original document block of new blocks of files after modification Piecemeal only synchronizes generated difference block between Dropbox server and terminal device, so as to largely reduce network traffic data.
According to an aspect of the present invention, a kind of document handling method is provided, applied to terminal device, including:By the first text The first version of part is in file system layer piecemeal, the blocks of files of the first quantity of acquisition;It receives described the of first file To the write operation of first file on the basis of one version;In response to the write operation to first file, the second quantity is generated New blocks of files;For each new blocks of files, file in the block respective file of the new blocks of files in first quantity is determined Block, and generate the difference block of the new blocks of files and the respective file block;And the preservation received to first file operates; Operation is preserved in response to described, the second edition of first file and the difference block are preserved, wherein first file The second edition contain the operating result of the write operation.
Preferably, the document handling method further includes:Receive the upload to the second edition of first file Operation;And in response to the upload operation, all difference blocks about first file preserved are uploaded into service Device.
Preferably, in the document handling method, the new blocks of files of the second quantity of generation includes:For the described first number Each in the blocks of files of amount, in the case where the write operation is related to this document block, it is right on the basis of this document block to generate its The new blocks of files answered.
Preferably, in the document handling method, for each in the blocks of files of first quantity, behaviour is write described When making to correspond to the operation for increasing the content involved by this document block, generated on the basis of this document block at least one corresponding New blocks of files;When the write operation corresponds to the operation of the content involved by modification this document block, on the basis of this document block Upper at least one corresponding new blocks of files of generation;Correspond in the write operation and delete the partial content involved by this document block During operation, a corresponding new blocks of files is generated on the basis of this document block;And correspond to delete in the write operation and be somebody's turn to do During the operation of the full content involved by blocks of files, the new blocks of files of a blank corresponding with this document block is generated.
Preferably, in the document handling method, for each new blocks of files, determine the new blocks of files described first With the presence or absence of respective file block in the blocks of files of quantity, wherein, a blocks of files corresponds in the blocks of files of first quantity In the case of at least one new blocks of files, only by least one new new blocks of files of first in the block of file and the text Part block corresponds to each other;In the case where the new blocks of files is there are respective file block, the new blocks of files and the respective file are generated The difference block of block;It is and in the case where respective file block is not present in the new blocks of files, the new blocks of files is right as its in itself The difference block answered.
Preferably, in the document handling method, for each new blocks of files, in the new blocks of files, there are respective files In the case that block and the new blocks of files are not the new blocks of files of blank, the new blocks of files is utilized to replace the respective file block; The new blocks of files is there are respective file block and the new blocks of files is in the case of the new blocks of files of blank, deletes the respective file Block;In the new blocks of files there is no in the case of respective file block, the new blocks of files is preserved;And preserve first quantity Those blocks of files that write operation described in blocks of files is not directed to.
According to a further aspect of the invention, a kind of document handling method is provided, applied to server, the server preserves The first version of first file, including:Receive the difference block of the second edition about first file uploaded;By described in The first version of first file and the difference merged block received, to obtain the second edition of first file;And it preserves The second edition of first file.
Preferably, the document handling method further includes:Preserve received difference block.
Preferably, in the document handling method, the difference of the second edition about first file of upload is received Piecemeal includes:The difference set of blocks of the second edition about first file uploaded is received, the difference set of blocks includes At least one difference block;And the difference set of blocks is decomposed, to obtain at least one difference block.
Preferably, the document handling method further includes:The synchronization received for the second edition of first file is asked It asks;In response to the synchronization request, the difference block of the second edition about first file preserved is transmitted.
Preferably, in the document handling method, the server preserve the first file first version in text Part system layer is by piecemeal and includes the blocks of files of the first quantity, wherein, for each difference block, determine the difference block described It whether there is respective file block in the blocks of files of one quantity;In the case where the difference block is there are respective file block, by the difference Block and the respective file merged block are to generate a new blocks of files, and in the situation that the new blocks of files is null file block Under, abandon the new blocks of files;And in the case where respective file block is not present in the difference block, using the difference block in itself as one Those blocks of files that the difference block received in a new blocks of files and blocks of files using first quantity is not directed to, with And the new blocks of files generated based on the difference block received, to generate the second edition of first file.
According to another aspect of the invention, a kind of document handling method is provided, applied to terminal device, in the terminal The first version of the first file is saved in equipment, the first version of first file by piecemeal and is wrapped in file system layer The blocks of files of the first quantity is included, including:Receive the simultaneously operating for first file;It is sent to server for described the The synchronization request of the second edition of one file saves the difference of the second edition about first file in the server Piecemeal;The difference block of the second edition about first file is received from server;By the first version of first file With the difference merged block received, to obtain the second edition of first file;And preserve the described of first file The second edition.
Preferably, in the document handling method, the difference block collection of the second edition about first file is received It closes, the difference set of blocks includes at least one difference block;And the difference set of blocks is decomposed, it is described at least one to obtain Difference block.
Preferably, in the document handling method, for each difference block, determine the difference block in first quantity Blocks of files in whether there is respective file block;In the case where the difference block is there are respective file block, by the difference block and institute Respective file merged block is stated to generate a new blocks of files, and in the case where the new blocks of files is null file block, is abandoned The new blocks of files;And in the case where respective file block is not present in the difference block, using the difference block in itself as a new text Those blocks of files and be based on that the difference block received in part block and blocks of files using first quantity is not directed to The new blocks of files that the difference block received is generated, to generate the second edition of first file.
According to an aspect of the present invention, a kind of document handling apparatus is provided, applied to terminal device, including:File point Block part, by the first version of the first file in file system layer piecemeal, the blocks of files of the first quantity of acquisition;Operation acceptance division Part is received on the basis of the first version of first file to the write operation of first file;Difference block generates Component in response to the write operation to first file, generates the new blocks of files of the second quantity, for each new blocks of files, Determine file in the block respective file block of the new blocks of files in first quantity, and generate the new blocks of files with it is described corresponding The difference block of blocks of files;And document data saving part part, it is received in response to the operation acceptance division part literary to described first The preservation operation of part, preserves the second edition of first file and the difference block, wherein the second of first file Version contains the operating result of the write operation.
Preferably, the operation acceptance division part also receives the upload operation of the second edition to first file, And the document handling apparatus further includes:Difference block uploads component, in response to the upload operation, will be preserved about All difference blocks of first file are uploaded onto the server.
According to another aspect of the present invention, a kind of document handling apparatus is provided, applied to terminal device, in the terminal The first version of the first file is saved in equipment, the first version of first file by piecemeal and is wrapped in file system layer The blocks of files of the first quantity is included, including:Operation acceptance division part receives the simultaneously operating for first file;Request hair Component is sent, the synchronization request of the second edition for first file is sent to server, is preserved in the server The difference block of the second edition about first file;Difference block receiving part is received from server about described the The difference block of the second edition of one file;And Piece file mergence component, by the first version of first file with being received Difference merged block, to obtain the second edition of first file;And document data saving part part, preserve first file The second edition.
According to another aspect of the invention, a kind of document handling apparatus is provided, applied to server, the server is protected The first version of the first file has been deposited, including:Difference block receiving part receives second about first file uploaded The difference block of version;Piece file mergence component, by the first version of first file and the difference merged block that is received, to obtain Obtain the second edition of first file;And document data saving part part, preserve the second edition of first file with And the difference block received.
Preferably, the document handling apparatus, further includes:Receiving part is asked, is received for first file The synchronization request of the second edition;And difference block transfer member, in response to the synchronization request, transmit preserved about institute State the difference block of the second edition of the first file.
Using the according to embodiments of the present invention document handling method and device that are applied to terminal device and server, pass through File system layer by file block, operated based on block and difference block is generated when block changes and only pass Difference block is sent, network traffic data and system power dissipation between server and terminal device can be substantially reduced.
Description of the drawings
Embodiments of the present invention is described in detail in conjunction with the accompanying drawings, above and other objects of the present invention, feature, Advantage will become apparent, wherein:
Fig. 1 is the flow chart for showing the document handling method applied to terminal device according to embodiments of the present invention;
Fig. 2 is the supplementary flow chart for showing the document handling method applied to terminal device according to embodiments of the present invention;
Fig. 3 be show to preserve in the document handling method applied to terminal device according to embodiments of the present invention it is modified The schematic flow of file;
Fig. 4 is the flow chart for showing the document handling method applied to server according to embodiments of the present invention;
Fig. 5 is the supplementary flow chart for showing the document handling method applied to server according to embodiments of the present invention;
Fig. 6 is to show to preserve modified text in the document handling method applied to server according to embodiments of the present invention The schematic flow of part;
Fig. 7 is the flow chart for showing the document handling method applied to terminal device according to embodiments of the present invention;
Fig. 8 be show to preserve in the document handling method applied to terminal device according to embodiments of the present invention it is modified The schematic flow of file;
Fig. 9 is the schematic block diagram for showing the document handling apparatus applied to terminal device according to embodiments of the present invention;
Figure 10 is the schematic block diagram for showing the document handling apparatus applied to terminal device according to embodiments of the present invention;
Figure 11 is the schematic block diagram for showing the document handling apparatus applied to server according to embodiments of the present invention;With And
Figure 12 is the figure for the schematic process result for schematically showing document handling method according to embodiments of the present invention.
Specific embodiment
The document handling method for being applied to terminal device and server according to embodiments of the present invention will be described with reference to the drawings And device, the present invention is not limited to the embodiments described herein, and can realize in other ways, so long as mode use Difference block transmission mode reduces network traffic data.
Next, Fig. 1-3 is specific reference will be made to describe at the file applied to terminal device according to embodiments of the present invention Reason method 100, in being specifically used for the modification file in terminal device and modified file being uploaded onto the server.
It is shown in FIG. 1 in the document handling method applied to terminal device according to embodiments of the present invention and generates difference The flow chart of block.It is shown in FIG. 2 in the document handling method applied to terminal device according to embodiments of the present invention and uploads The flow chart of difference block.The document handling method applied to terminal device according to embodiments of the present invention is shown in FIG. 3 The flow of the preservation process of file after modification.
First, the document handling method applied to terminal device according to embodiments of the present invention starts in step S101.
In step S110, in terminal device, will be currently held in terminal device using Virtual File System first File is in file system layer piecemeal.In the following, for convenience, the first file being currently held in terminal device is known as The first version of one file.Therefore, in step s 110, using Virtual File System by the first version of the first file in file System layer piecemeal, to obtain and preserve the blocks of files of the first quantity.Hereafter, it is carried out based on the blocks of files of the first quantity to first The write operation of file, the write operation can include modification, the content for increasing and deleting the first file.
In step S120, in terminal device, the write operation to first file is received.As previously mentioned, at the end On the basis of the first version of first file preserved in end equipment, the write operation to first file is performed.Change sentence It talks about, on the basis of the blocks of files of first quantity of first file, performs the write operation to first file.
For example, when performing the write operation to first file, the Virtual File System generates first quantity Blocks of files backup, and the write operation is performed based on generated backup, without perform to preserved described the The blocks of files of first quantity of one file performs the write operation.
In step S130, in terminal device, in response to the write operation to first file, the new of the second quantity is generated Blocks of files.
For each in the blocks of files of first quantity, in the case where the write operation is related to this document block, at this Its corresponding new blocks of files is generated on the basis of blocks of files, specifically:
When the write operation corresponds to the operation for increasing the content involved by this document block, on the basis of this document block Generate at least one corresponding new blocks of files;
When the write operation corresponds to the operation of the content involved by modification this document block, on the basis of this document block Generate at least one corresponding new blocks of files;
When the write operation corresponds to the operation for deleting the partial content involved by this document block, in the base of this document block A corresponding new blocks of files is generated on plinth;And
When the write operation corresponds to the operation for deleting the full content involved by this document block, one and this article are generated The new blocks of files of the corresponding blank of part block.
For example, be unfolded to describe for carrying out write operation to the 3rd blocks of files,
1)When the content for deleting the 3rd blocks of files, the 3rd file data in the block are correspondingly deleted to generate the 3rd new text Part block;
2)When the content for increasing by the 3rd blocks of files, increase by the 3rd file data in the block to generate the 3rd new blocks of files, directly Data volume to the 3rd blocks of files exceeds predetermined value, which is, for example, the maximum amount of data of blocks of files, and then generates New the 3rd ' blocks of files simultaneously continues the storage increased content-data of institute wherein until the data volume of the 3 ' blocks of files is beyond making a reservation for Value, is then followed by that new the 3rd can be generated " the increased content-data of blocks of files and the continuation institute of storage wherein, and so on, Any number of extra file block, and generated any number of extra file can be generated on the basis of 3rd blocks of files Block should be before the 4th blocks of files;
3)When the content for changing the 3rd blocks of files, the data to be deleted and increase the 3rd in the 3rd blocks of files are correspondingly deleted File data in the block, to generate the 3rd new blocks of files, and as needed can also be such as 2)It generates describedly any number of Extra file block.
Here, the new blocks of files of the second quantity may refer to newly change and/or newly generated blocks of files, such as former the For 3 blocks of files, new blocks of files can include the 3rd new blocks of files and if the 3rd ' blocks of files newly, the new the 3rd " file If the presence such as block, new blocks of files can not only include the 3rd new blocks of files but also can include the 3rd ' new blocks of files, new The 3rd " blocks of files etc..
In addition, new file can not be counted as by not carrying out the blocks of files of write operation to it in the blocks of files of first quantity Block.Alternatively, new blocks of files can be counted as by not carrying out the blocks of files of write operation to it in the blocks of files of first quantity, only It is that its content is identical with original block.The present invention is not limited by the range of the new blocks of files of the second quantity.
In S140, for each new blocks of files, file in the block correspondence of the new blocks of files in first quantity is determined Blocks of files, and generate the difference block of the new blocks of files and the respective file block.
In S150, the operation of the preservation to first file is received.
Alternatively, the operation of the preservation to first file can be received, and in S150 in S140, for each new Blocks of files determines file in the block respective file block of the new blocks of files in first quantity, and generate the new blocks of files with The difference block of the respective file block.
For example, as shown in figure 3, for each new blocks of files, it may be determined that the new blocks of files is in the text of first quantity With the presence or absence of respective file block in part block, wherein, a blocks of files corresponds at least one in the blocks of files of first quantity In the case of a new blocks of files, only by least one new new blocks of files of first in the block of file and the blocks of files each other It is corresponding.In the case where the new blocks of files is there are respective file block, the difference of the new blocks of files and the respective file block is generated Block;And in the case where respective file block is not present in the new blocks of files, using the new blocks of files in itself as its corresponding difference block.
Still it is unfolded to describe for carrying out write operation to the 3rd blocks of files,
1)A the 3rd new blocks of files is produced for the 3rd blocks of files of original, which corresponds to the 3rd text of original There are a respective file blocks for part block, i.e. the 3rd new blocks of files.
2)3 blocks of files are produced for the 3rd blocks of files of original:New the 3rd blocks of files, the 3rd ' new blocks of files and new 3rd " blocks of files only corresponds to each other the 3rd new blocks of files and former 3rd blocks of files, in other words, the 3rd ' new blocks of files and Respective file block is not present in new the 3rd " blocks of files.
In S160, the second edition of first file and the difference block are preserved, wherein the of first file Two versions contain the operating result of the write operation.
Specifically, the file file in the block with first quantity is not included in the new blocks of files of second quantity In the case of the identical blocks of files of block, the second edition of first file contains the new blocks of files of second quantity And the blocks of files of write operation is not performed in the blocks of files of first quantity to it.On the other hand, in second quantity In the case that new blocks of files includes the identical blocks of files of file blocks of files in the block with first quantity, described the The second edition of one file contains the new blocks of files of second quantity.
In the following, in order to describe simplicity, the new blocks of files of second quantity refers only to not include and first quantity The situation of the identical blocks of files of file blocks of files in the block.
Therefore, preserving the second edition of first file can include:According to the new blocks of files of second quantity and The blocks of files of first quantity generates the second edition of first file;And preserve the second edition.
For each new blocks of files, the new blocks of files there are respective file block and the new blocks of files it is newly literary for blank In the case of part block, the respective file block is replaced using the new blocks of files, that is, deletes respective file block and preserves the new file Block;The new blocks of files there are respective file block and the new blocks of files for the new blocks of files of blank in the case of, it is described right to delete Answer blocks of files;In the new blocks of files there is no in the case of respective file block, the new blocks of files is preserved.In addition, preserve described the Those blocks of files that write operation described in the blocks of files of one quantity is not directed to.
Finally, the processing of difference block is generated in the document handling method applied to terminal device according to embodiments of the present invention Terminate in step S199.
The first file is changed in terminal device and saves version after the modification of the first file(The second edition)Later, it uses Family may need to upload to version after the modification of the first file in Dropbox server.In the case, basis as shown in Figure 2 The processing that difference block is uploaded in the document handling method applied to terminal device of the embodiment of the present invention starts to operate.
In S210, the upload operation of the second edition to first file is received.
In S220, in response to the upload operation, all difference blocks about first file preserved are uploaded To server.
For example, all difference blocks of first file can be packaged generation difference set of blocks by the terminal device, and The difference set of blocks generated is uploaded onto the server.
In S230, in response to the upload operation, all difference blocks about first file preserved are deleted.
As a result, by the way that the first file is drawn in the document handling method applied to terminal device according to embodiments of the present invention It is divided into multiple blocks of files, the write operation of the first file is carried out based on blocks of files and only by text new caused by the write operation Part block and the difference block of original block are uploaded onto the server, and can substantially reduce network traffic data.
Next, by the document handling apparatus applied to terminal device according to embodiments of the present invention is described with reference to Figure 9 900, this document processing unit 900 performs the file applied to terminal device according to embodiments of the present invention as shown in Fig. 1 to 3 Processing method 100.
As shown in figure 9, the document handling apparatus 900 applied to terminal device according to embodiments of the present invention includes:File Piecemeal component 910, operation acceptance division part 920, difference block generating unit 930 and document data saving part part 940.
File block component 910 is by the first version of the first file in file system layer piecemeal, the text of the first quantity of acquisition Part block.Specifically, 910 S110 as described above of file block component performs operation like that, no longer operates progress to it herein It repeats.
Operation acceptance division part 920 is received on the basis of the first version of first file to first file Write operation.Specifically, 920 S120 as described above of operation acceptance division part performs operation like that, no longer it is operated herein into Row repeats.
Difference block generating unit 930 generates the new blocks of files of the second quantity in response to the write operation to first file, For each new blocks of files, file in the block respective file block of the new blocks of files in first quantity is determined, and generate and be somebody's turn to do New blocks of files and the difference block of the respective file block.Specifically, 930 S130 as described above of difference block generating unit and S140 performs operation like that, no longer it is operated repeat herein.
In addition, the operation acceptance division part 920 also receives the operation of the preservation to first file.
The preservation to first file that document data saving part part 950 is received in response to the operation acceptance division part 920 Operation preserves the second edition of first file and the difference block, wherein the second edition of first file includes The operating result of the write operation.Specifically, 950 S160 as described above of difference block generating unit performs operation like that, No longer it is operated herein and is repeated.
In addition, the operation acceptance division part 940 also receives the upload operation of the second edition to first file.
Document handling apparatus 900 applied to terminal device according to embodiments of the present invention can also include:In difference block Component 950 is passed, in response to the upload operation, all difference blocks about first file preserved are uploaded into clothes Business device.
Next, by the document handling method applied to server according to embodiments of the present invention is described with reference to figure 4-6 400, the first version of the first file is saved, and the first version includes the first of first file in the server The blocks of files of quantity.The document handling method 400 is specifically used for receiving the first text uploaded from terminal device in the server The differential file of part and the new version for generating and preserving the first file in the server(The second edition).
It is shown in FIG. 4 in the document handling method applied to server according to embodiments of the present invention and receives difference block And generate the flow chart of the first file new version.The text applied to server according to embodiments of the present invention is shown in FIG. 5 The biography down of part processing method(Transmission)The flow chart of difference block.It is shown in FIG. 6 and according to embodiments of the present invention is applied to clothes The flow of the preservation process of modified file in the document handling method of business device.
First, the document handling method applied to server according to embodiments of the present invention starts in step S401.
In S410, server receives the difference block of the second edition about first file uploaded from terminal device.
As previously mentioned, terminal device can by the second edition of first file generated in the terminal device and All difference blocks of first version are packaged generation difference set of blocks, and the difference set of blocks generated is uploaded onto the server.Phase Ying Di in the server, receives the difference set of blocks of the second edition about first file of upload, the difference block collection Conjunction includes at least one difference block, and decompose the difference set of blocks, to obtain at least one difference block.
It is literary to obtain described first by the first version of first file and the difference merged block received in S420 The second edition of part.
For example, as shown in fig. 6, for each difference block, determine that the difference block is in the blocks of files of first quantity It is no that there are respective file blocks;In the case where the difference block is there are respective file block, by the difference block and the respective file block Merge to generate a new blocks of files, and in the case where the new blocks of files is null file block, discarding/the delete new file Block;And in the case where respective file block is not present in the difference block, using the difference block in itself as a new blocks of files.So Afterwards, those blocks of files for being not directed to using the difference block received in the blocks of files of first quantity and based on being received The new blocks of files that is generated of difference block, to generate the second edition of first file.
Then, in S430, the second edition of first file is preserved.Moreover, it is also possible to preserve received difference Piecemeal.For example, server can preserve the second edition and first version of first file received from the terminal device All difference blocks difference set of blocks.
Finally, difference block and generation the is received in the document handling method applied to server according to embodiments of the present invention The processing of one file new version terminates in step S499.
The new version of the first file is saved in the server(The second edition)Later, user may be from another terminal device It sends out request and is synchronized to the request of the first file new version preserved in the server.In the case, as shown in Figure 5 The processing for passing difference block in document handling method applied to server according to embodiments of the present invention down starts to operate.
In S510, in the server, from another terminal device, reception is for the second edition of first file Synchronization request.
In S520, in response to the synchronization request, to another terminal device, transmit preserved about described first The difference block of the second edition of file.
The document handling method applied to server according to embodiments of the present invention is by preserving the of the first file as a result, Multiple blocks of files of one version, the new version for receiving the first file(The second edition)With legacy version(First version)Between difference Block and by multiple blocks of files of first version and the difference merged block that is received can update the preserved in server The version of one file, while network traffic data can be substantially reduced.
On the other hand, by preserving the first text in the document handling method applied to server according to embodiments of the present invention The new version of part(The second edition)With legacy version(First version)Between difference block and to saving first file The terminal devices of multiple blocks of files of first version sends the difference block, and the terminal device can be caused to be synchronized to described the The new version of one file, while network traffic data can be substantially reduced again.
Next, by the document handling apparatus applied to server according to embodiments of the present invention is described with reference to Figure 11 1100, the server saves the first version of the first file and is included in the first version of file system layer piecemeal Multiple blocks of files, what this document processing unit 1100 performed as shown in Fig. 4 to 6 according to embodiments of the present invention is applied to service The document handling method 400 of device.
As shown in figure 11, the document handling apparatus 1100 applied to server according to embodiments of the present invention includes:Difference Block receiving part 1110, Piece file mergence component 1120 and document data saving part part 1130.
Difference block receiving part 1110 receives the difference block of the second edition about first file uploaded.Specifically Ground, 1110 S410 as described above of difference block receiving part perform operation, no longer it are operated repeat herein like that.
Piece file mergence component 1120 is by the first version of first file and the difference merged block that is received, to obtain State the second edition of the first file.Specifically, 1120 S420 as described above of Piece file mergence component performs operation like that, herein No longer it is operated and is repeated.
The difference block that document data saving part part 1130 preserves the second edition of first file and received.Specifically Ground, 1130 S430 as described above of document data saving part part perform operation, no longer it are operated repeat herein like that.
In addition, the document handling apparatus 1100 can also include:Ask receiving part 1140 and difference block transport unit Part 1150.
Ask the synchronization request of the second edition that receiving part 1140 is received from terminal device for first file.
Difference block transfer member 1150 in response to the synchronization request, to terminal device transmission preserved about institute State the difference block of the second edition of the first file.
Next, by the file process side applied to terminal device according to embodiments of the present invention is described with reference to figure 7-8 Method 700 saves the first version of the first file in the terminal device, and the first version of first file is in file system Layer unite by piecemeal and includes the blocks of files of the first quantity.The document handling method 700 be specifically used in terminal device from Server receives the differential file of the first file and the new version of the first file is generated and preserved in terminal device(The second edition This).
The flow chart of the document handling method applied to terminal device according to embodiments of the present invention is shown in FIG. 7. It is shown in FIG. 8 in the document handling method applied to terminal device according to embodiments of the present invention and preserves modified file Flow.
First, the document handling method applied to terminal device according to embodiments of the present invention starts in step S701.
In S710, in terminal device, the simultaneously operating for first file is received.
In S720, in terminal device, the synchronization request of the second edition for first file is sent to server, The difference block of the second edition about first file is saved in the server.
In S730, the difference block of the second edition about first file is received from server.
As previously mentioned, the second edition of first file and all difference of first version can be preserved in the server The difference set of blocks of block, the difference set of blocks include at least one difference block.It correspondingly, can be from server in S730 The difference set of blocks is received, and the difference set of blocks can be decomposed to obtain at least one difference block.
In S740, in terminal device, by the first version of first file and the difference merged block received, to obtain Obtain the second edition of first file.
For example, as shown in figure 8, for each difference block, determine that the difference block is in the blocks of files of first quantity It is no that there are respective file blocks;In the case where the difference block is there are respective file block, by the difference block and the respective file block Merge to generate a new blocks of files, and in the case where the new blocks of files is null file block, discarding/the delete new file Block;And in the case where respective file block is not present in the difference block, using the difference block in itself as a new blocks of files.So Afterwards, those blocks of files for being not directed to using the difference block received in the blocks of files of first quantity and based on being received The new blocks of files that is generated of difference block, to generate the second edition of first file.
Then, in S750, the second edition of first file is preserved.As needed, it can also preserve and be received Difference block or difference set of blocks.
Finally, the document handling method 700 applied to terminal device according to embodiments of the present invention terminates in step S799.
The document handling method 700 applied to terminal device according to embodiments of the present invention is by preserving the first text as a result, Multiple blocks of files of the first version of part, the new version for receiving the first file(The second edition)With legacy version(First version)Between Difference block and by multiple blocks of files of first version and the difference merged block that is received, can be with institute in synchronous terminal equipment The version of the first file preserved, while network traffic data can be substantially reduced.
Next, by the document handling apparatus applied to terminal device according to embodiments of the present invention is described with reference to Figure 10 1000, the first version of the first file is saved in the terminal device, the first version of first file is in file system Layer unite by piecemeal and includes the blocks of files of the first quantity.This document processing unit 1100 perform as shown in Fig. 7 to 8 according to The document handling method 700 applied to terminal device of inventive embodiments.
As shown in Figure 10, the document handling apparatus 1000 applied to terminal device according to embodiments of the present invention includes:Behaviour Make receiving part 1010, request sends component 1020, difference block receiving part 1030, Piece file mergence component 1040 and file Storage unit 1050.
Operation acceptance division part 1010 receives the simultaneously operating for first file.
Request sends the synchronization request for the second edition that component 1020 is sent to server for first file, in institute State the difference block that the second edition about first file is saved in server.
Difference block receiving part 1030 receives the difference block of the second edition about first file from server.Specifically Ground, 1030 S730 as described above of difference block receiving part perform operation, no longer it are operated repeat herein like that.
Piece file mergence component 1040 is by the first version of first file and the difference merged block that is received, to obtain State the second edition of the first file.Specifically, 1040 S740 as described above of Piece file mergence component performs operation like that, herein No longer it is operated and is repeated.
Document data saving part part 1050 preserves the second edition of first file.
The schematic process result of document handling method according to embodiments of the present invention is schematically shown in fig. 12.
First, write operation is performed to file A in the device 1, it is assumed that 2 blocks of files of file A are changed, and generate Difference block A1 and A2.
Next, the difference block A1 and A2 of file A are uploaded to cloud storage service device by equipment 1.It should be noted that it can incite somebody to action here Difference block A1 and A2 are packaged as difference set of blocks, then upload again.
Then, cloud storage service device utilizes the original A of its preservation and received difference block A1 and A2 generation file A New version, and substitute original A, while also preserve received difference block A1 and A2 using the new version of file A.It should Note that the difference set of blocks of difference block A1 and A2 can be preserved here.
Next, cloud storage service device slave device 2 receives synchronization request.
Then, the difference block A1 and A2 that wherein preserve are transmitted to equipment 2 by cloud storage service device, so that more new equipment File A at 2.
Using the according to embodiments of the present invention document handling method and device that are applied to terminal device and server, pass through File system layer by file block, operated based on block and difference block is generated when block changes and only pass It send(Equipment 1 is uploaded to server, equipment 2 is downloaded from server)Difference block, can substantially reduce server and terminal device it Between network traffic data.
Although example embodiment is described by reference to attached drawing, it should be understood that the above example embodiment is merely exemplary here , and be not intended to limit the scope of the invention to this.Those of ordinary skill in the art can carry out various changes wherein And modification, it is made without departing from the scope of the present invention and spiritual.All such changes and modifications are intended to be included in appended claims Within required the scope of the present invention.

Claims (17)

1. a kind of document handling method, applied to terminal device, including:
By the first version of the first file in file system layer piecemeal, the blocks of files of the first quantity of acquisition;
It receives on the basis of the first version of first file to the write operation of first file;
In response to the write operation to first file, the new blocks of files of the second quantity is generated;
For each new blocks of files, file in the block respective file block of the new blocks of files in first quantity is determined, and raw Into the new blocks of files and the difference block of the respective file block, wherein, in the case where the new blocks of files is there are respective file block, Generate the difference block of the new blocks of files and the respective file block;And the situation of respective file block is not present in the new blocks of files Under, using the new blocks of files in itself as its corresponding difference block;
The preservation to first file is received to operate;And
Operation is preserved in response to described, the second edition of first file and the difference block are preserved, wherein described first The second edition of file contains the operating result of the write operation;
Wherein, the new blocks of files of the second quantity of generation includes:For each in the blocks of files of first quantity, behaviour is write described In the case that work is related to this document block, its corresponding new blocks of files is generated on the basis of this document block.
2. document handling method as described in claim 1, further includes:
Receive the upload operation to the second edition of first file;And
In response to the upload operation, all difference blocks about first file preserved are uploaded onto the server.
3. document handling method as claimed in claim 2, further includes:
In response to the upload operation, all difference blocks about first file preserved are deleted.
4. document handling method as described in claim 1, wherein, for each in the blocks of files of first quantity, in institute State in the case that write operation is related to this document block, generated on the basis of this document block its corresponding new blocks of files include with down toward One item missing:
When the write operation corresponds to the operation for increasing the content involved by this document block, generated on the basis of this document block At least one corresponding new blocks of files;
When the write operation corresponds to the operation of the content involved by modification this document block, generated on the basis of this document block At least one corresponding new blocks of files;
When the write operation corresponds to the operation for deleting the partial content involved by this document block, on the basis of this document block Generate a corresponding new blocks of files;And
When the write operation corresponds to the operation for deleting the full content involved by this document block, generation one and this document block The new blocks of files of corresponding blank.
5. document handling method as described in claim 1, wherein, for each new blocks of files, determine the new blocks of files in institute It states the file respective file block in the block of the first quantity and generates the difference block packet of the new blocks of files and the respective file block It includes:
Determine that the new blocks of files whether there is respective file block in the blocks of files of first quantity, wherein, described first In the case that a blocks of files corresponds at least one new blocks of files in the blocks of files of quantity, only by least one new file First in the block new blocks of files corresponds to each other with the blocks of files.
6. document handling method as claimed in claim 5, wherein, the second edition for preserving first file includes:
The second edition of first file is generated by following operation:
There are respective file block and the new blocks of files it is not the new blocks of files of blank in the new blocks of files for each new blocks of files In the case of, replace the respective file block using the new blocks of files;In the new blocks of files, there are respective file blocks and described new In the case that blocks of files is the new blocks of files of blank, the respective file block is deleted;Respective file block is not present in the new blocks of files In the case of, preserve the new blocks of files;And
Preserve write operation is not directed to described in the blocks of files of first quantity those blocks of files and
Preserve the second edition.
7. a kind of document handling method, applied to server, the server saves the first version of the first file, including:
Receive the difference block of the second edition about first file uploaded;
By the first version of first file and the difference merged block that is received, to obtain the second edition of first file This, wherein, the first file that the server preserves first version in file system layer by piecemeal, exist in the difference block In the case of respective file block, by the difference block and the respective file merged block to generate a new blocks of files;And at this In the case that respective file block is not present in difference block, using the difference block in itself as a new blocks of files;And
Preserve the second edition of first file;
Wherein, the difference block for receiving the second edition about first file of upload includes:Receive upload about described The difference set of blocks of the second edition of first file, the difference set of blocks include at least one difference block;And described in decomposing Difference set of blocks, to obtain at least one difference block.
8. document handling method as claimed in claim 7, further includes:
Preserve received difference block.
9. document handling method as claimed in claim 8, further includes:
Receive the synchronization request of the second edition for first file;And
In response to the synchronization request, the difference block of the second edition about first file preserved is transmitted.
10. document handling method as claimed in claim 7, wherein, in the first edition for the first file that the server preserves This includes the blocks of files of the first quantity,
Wherein, the difference block received with the first version of first file is merged and further included:
For each difference block, determine that the difference block whether there is respective file block in the blocks of files of first quantity;
In the case where the new blocks of files is null file block, the new blocks of files is abandoned;And
Those blocks of files that the difference block received in blocks of files using first quantity is not directed to and based on being received The new blocks of files that is generated of difference block, to generate the second edition of first file.
11. a kind of document handling method applied to terminal device, saves the first edition of the first file in the terminal device This, the first version of first file by piecemeal and includes the blocks of files of the first quantity in file system layer, including:
Receive the simultaneously operating for first file;
To server send for first file the second edition synchronization request, saved in the server about The difference block of the second edition of first file;
The difference block of the second edition about first file is received from server;
By the first version of first file and the difference merged block that is received, to obtain the second edition of first file This, wherein, in the case where the difference block is there are respective file block, by the difference block with the respective file merged block to generate One new blocks of files;It is and in the case where respective file block is not present in the difference block, the difference block is new as one in itself Blocks of files;And
Preserve the second edition of first file;
Wherein, it receives from server and includes about the difference block of the second edition of first file:It receives about described first The difference set of blocks of the second edition of file, the difference set of blocks include at least one difference block;And decompose the difference Set of blocks, to obtain at least one difference block.
12. document handling method as claimed in claim 11, wherein, by the first version of first file and received Difference merged block includes:
For each difference block, determine that the difference block whether there is respective file block in the blocks of files of first quantity;
In the case where the new blocks of files is null file block, the new blocks of files is abandoned;And
Those blocks of files that the difference block received in blocks of files using first quantity is not directed to and based on being received The new blocks of files that is generated of difference block, to generate the second edition of first file.
13. a kind of document handling apparatus, applied to terminal device, including:
File block component, by the first version of the first file in file system layer piecemeal, the blocks of files of the first quantity of acquisition;
Operation acceptance division part, reception write behaviour on the basis of the first version of first file to first file Make;
Difference block generating unit in response to the write operation to first file, generates the new blocks of files of the second quantity, for Each new blocks of files, determines file in the block respective file block of the new blocks of files in first quantity, and generate the new text The difference block of part block and the respective file block, wherein, in the case where the new blocks of files is there are respective file block, it is new to generate this Blocks of files and the difference block of the respective file block;And in the case where respective file block is not present in the new blocks of files, by this New blocks of files is used as its corresponding difference block in itself;And
Document data saving part part is operated in response to the preservation to first file that the operation acceptance division part receives, is protected The second edition of first file and the difference block are deposited, wherein the second edition of first file contains described write The operating result of operation;
Wherein, the new blocks of files of the second quantity of generation includes:For each in the blocks of files of first quantity, behaviour is write described In the case that work is related to this document block, its corresponding new blocks of files is generated on the basis of this document block.
14. document handling apparatus as claimed in claim 13, wherein, the operation acceptance division part is also received to the described first text The upload operation of the second edition of part, and the document handling apparatus further includes:
Difference block uploads component, in response to the upload operation, all difference about first file that will be preserved Block is uploaded onto the server.
15. a kind of document handling apparatus applied to terminal device, saves the first edition of the first file in the terminal device This, the first version of first file by piecemeal and includes the blocks of files of the first quantity in file system layer, including:
Operation acceptance division part receives the simultaneously operating for first file;
Request sends component, the synchronization request of the second edition for first file is sent to server, in the clothes The difference block of the second edition about first file is saved in business device;
Difference block receiving part receives the difference block of the second edition about first file from server;
Piece file mergence component, by the first version of first file and the difference merged block that is received, to obtain described the The second edition of one file, wherein, in the case where the difference block is there are respective file block, by the difference block and the corresponding text Part merged block is to generate a new blocks of files;And in the case where respective file block is not present in the difference block, by the difference block Itself is used as a new blocks of files;And
Document data saving part part preserves the second edition of first file;
Wherein, it receives from server and includes about the difference block of the second edition of first file:It receives about described first The difference set of blocks of the second edition of file, the difference set of blocks include at least one difference block;And decompose the difference Set of blocks, to obtain at least one difference block.
16. a kind of document handling apparatus, applied to server, the server saves the first version of the first file, including:
Difference block receiving part receives the difference block of the second edition about first file uploaded;
Piece file mergence component, by the first version of first file and the difference merged block that is received, to obtain described the The second edition of one file, wherein, the first file that the server preserves first version in file system layer by piecemeal, It is in the case where the difference block is there are respective file block, the difference block and the respective file merged block is new literary to generate one Part block;And in the case where respective file block is not present in the difference block, using the difference block in itself as a new blocks of files;With And
Document data saving part part, the difference block for preserving the second edition of first file and being received;
Wherein, the difference block for receiving the second edition about first file of upload includes:Receive upload about described The difference set of blocks of the second edition of first file, the difference set of blocks include at least one difference block;And described in decomposing Difference set of blocks, to obtain at least one difference block.
17. document handling apparatus as claimed in claim 16, further includes:
Receiving part is asked, receives the synchronization request of the second edition for first file;And
Difference block transfer member in response to the synchronization request, transmits the second edition about first file preserved This difference block.
CN201310020004.1A 2013-01-18 2013-01-18 Document handling method and device Active CN103942208B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310020004.1A CN103942208B (en) 2013-01-18 2013-01-18 Document handling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310020004.1A CN103942208B (en) 2013-01-18 2013-01-18 Document handling method and device

Publications (2)

Publication Number Publication Date
CN103942208A CN103942208A (en) 2014-07-23
CN103942208B true CN103942208B (en) 2018-07-06

Family

ID=51189878

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310020004.1A Active CN103942208B (en) 2013-01-18 2013-01-18 Document handling method and device

Country Status (1)

Country Link
CN (1) CN103942208B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104092780A (en) * 2014-07-29 2014-10-08 中国联合网络通信集团有限公司 File modification method and device and monofile synchronization method and device based on file blocks
CN105653544B (en) * 2014-11-12 2019-06-25 联想(北京)有限公司 A kind of information processing unit and method
CN104967660B (en) * 2015-05-11 2018-01-05 华中科技大学 A kind of network performance method for improving towards more cloud frameworks
CN114503075A (en) * 2019-11-18 2022-05-13 深圳市欢太科技有限公司 File processing method, file processing device and terminal equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101917396A (en) * 2010-06-25 2010-12-15 清华大学 Real-time repetition removal and transmission method for data in network file system
CN102163308A (en) * 2011-04-18 2011-08-24 中国科学院计算技术研究所 Flow service data uploading system and method
CN102739791A (en) * 2012-06-28 2012-10-17 奇智软件(北京)有限公司 File downloading and uploading method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101917396A (en) * 2010-06-25 2010-12-15 清华大学 Real-time repetition removal and transmission method for data in network file system
CN102163308A (en) * 2011-04-18 2011-08-24 中国科学院计算技术研究所 Flow service data uploading system and method
CN102739791A (en) * 2012-06-28 2012-10-17 奇智软件(北京)有限公司 File downloading and uploading method and device

Also Published As

Publication number Publication date
CN103942208A (en) 2014-07-23

Similar Documents

Publication Publication Date Title
CN106156359B (en) A kind of data synchronization updating method under cloud computing platform
CN102904887B (en) The method of data synchronization of a kind of Web client and server and system
CN109739810A (en) File synchronisation method, server, client and the device with store function
CN103942208B (en) Document handling method and device
CN103873451B (en) A kind of method, apparatus and system of data syn-chronization
CN101237331B (en) CDR file generation method, transmission method, system and device
CN104636477B (en) The De-weight method of push list before a kind of information push
CN104488248B (en) A kind of file synchronisation method, server and terminal
CN103116615B (en) A kind of data index method and server based on version vector
CN103605798B (en) A kind of method for directly operating high in the clouds storage file
CN107332918A (en) A kind of high in the clouds local file synchronization realizing method and system
CN104391930A (en) Distributed file storage device and method
CN102882985A (en) File sharing method based on cloud storage
CN104133882A (en) HDFS (Hadoop Distributed File System)-based old file processing method
CN102546836A (en) Method, terminal, server and system for uploading files
CN103095684B (en) Obtain and pay close attention to the method for user's aggregation information, Apparatus and system
CN103139300A (en) Virtual machine image management optimization method based on data de-duplication
CN105978948B (en) A kind of method and system of cloud service
CN110347651A (en) Method of data synchronization, device, equipment and storage medium based on cloud storage
US20160352811A1 (en) Streaming zip
CN110399348A (en) File deletes method, apparatus, system and computer readable storage medium again
CN103778202A (en) Enterprise electronic document managing server side and system
WO2016095149A1 (en) Data compression and storage method and device, and distributed file system
CN101771717A (en) Database synchronization method and database synchronization system
CN103067479A (en) Network disk synchronized method and system based on file coldness and hotness

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant