CN106372179A - Method and system for detecting document change and synchronization - Google Patents
Method and system for detecting document change and synchronization Download PDFInfo
- Publication number
- CN106372179A CN106372179A CN201610784758.8A CN201610784758A CN106372179A CN 106372179 A CN106372179 A CN 106372179A CN 201610784758 A CN201610784758 A CN 201610784758A CN 106372179 A CN106372179 A CN 106372179A
- Authority
- CN
- China
- Prior art keywords
- document
- change
- database information
- service end
- client
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/178—Techniques for file synchronisation in file systems
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Document Processing Apparatus (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention provides a method and a system for detecting document change and synchronization. The method comprises the steps of creating a detection thread, a synchronized thread and a transmission object when a process of an application program is started; respectively obtaining database information in a client and database information in a server; respectively extracting document unique identifications and document change identifications which are preset for documents from the database information in the client and the server; comparing document unique identifications so as to obtain newly addition and deletion information of documents in the server; comparing the document change identifications so as to obtain revision information of the documents in the server; packaging the newly addition and deletion information and the revision information of the documents in the server so as to form a task data packet; transmitting the task data packet to the synchronized thread by utilizing the transmission object; processing the task data packet by the synchronized thread, and synchronizing the changed documents in the server to the client. According to the method and the system, the document change in all specified directories can be detected, so that the loss of the document change information is avoided.
Description
Technical field
The present invention relates to data synchronization technology field, particularly to the document change detection in data synchronization technology field,
It is specially a kind of method and system detecting document change and synchronization.
Background technology
With the popularization of Internet technology development and computer equipment, user has substantial amounts of terminal unit, such as desk-top
The electronic products such as computer, notebook computer, panel computer, mobile phone, user under different scenes using distinct device, but each end
End equipment has some file user to wish to synchronize use again, and that is, other-end have modified file and is synchronized to service
Device, desktop computer can upgrade in time the amended state of this document.
In order under windows, synchronous disk detects file change, technology commonly used at present is had and is judged based on md5 value
File change.But some limitation are had based on md5 scheme, comprising:
(1) service end and client are required for calculating md5 value.
(2) the md5 calculation consumption of big file is larger.
(3) cannot being detected using md5 value of file.
Also has the mode based on file name and the last modification time of file.It is equally based on file name and file is finally repaiied
The time scheme of changing has some limitation, comprising:
(1) file whether renaming cannot be judged by file name.
(2) cannot judge whether file is modified by last modification time.
Content of the invention
The shortcoming of prior art in view of the above, it is an object of the invention to provide a kind of detect document change and synchronization
Method and system, the document of synchronous disk efficiently and accurately cannot be detected and synchronous asking for solving prior art
Topic.
For achieving the above object and other related purposes, the present invention provides on the one hand and a kind of detects document change and synchronous
Method, be applied under windows system with catalogue specified by client application document corresponding service end Chinese
In the change detection and synchronization of shelves, described detection document change and synchronous method comprise the following steps: starting application program
Process when, create the detection thread of change for detecting the document under catalogue specified by described application program in service end and
Create for detecting the literary composition of change when the document under catalogue specified by application program described in described service end changes
Shelves are synchronized to the synchronizing thread in client;Create one and detect application journey described in described service end in described detection thread
When document under catalogue specified by sequence changes, the document information needing synchronous change is transmitted to the biography of described synchronizing thread
Defeated object;Described detection thread obtains the data base of the document under catalogue specified by application program described in described client respectively
The database information of the document under catalogue specified by corresponding described application program in information and described server;Described detection line
It is that the document that described document sets uniquely is marked in advance that journey is extracted in database information in described client and described service end respectively
Know and document change mark;The described thread that detects passes through uniquely to mark the document extracting in database information from described client
The document unique mark extracted in knowledge and database information from described service end compares, and obtains document in described server
Increase newly and delete;Described detect thread pass through will in database information from described client extract document change mark and from
The document change mark extracted in database information in described service end compares, and obtains the modification of document in described server;
The described thread that detects is packaged forming a number of tasks to the newly-increased, deletion of document in the described server obtaining and modification information
According to bag;Using the described connection object creating, described task data bag is transmitted to described synchronizing thread;Described synchronizing thread pair
Described task data bag is processed, by the document-synchronization of change in described server in described client.
In one embodiment of the invention, the described detailed process obtaining the newly-increased and deletion of document in described server
For: if not having in database information in described service end in the document unique mark extracted in database information in described client
The document unique mark extracted, judges that the document in described server is newly-increased;If carrying in database information in described service end
There is no the document unique mark extracted in database information in described client in the document unique mark taking, judge described service
Document in device is to delete;If the document unique mark extracted in database information in described client and number in described service end
According to the document unique mark all same extracted in the information of storehouse, then the document extracting in database information from described client is become
Change the document change mark extracted in mark and database information from described service end to compare, obtain described server Chinese
The modification of shelves.
In one embodiment of the invention, the modification obtaining document in described server specifically includes: if from described client
The document change extracted in the document change mark extracted in database information in end and database information from described service end
Mark differs, then judge that the document in described server has modification;If extracting in database information from described client
Document change mark is identical with the document change mark extracted in database information from described service end, continues to extract described visitor
The modification time of document described in database information in family end and described service end, and judge whether described modification time is identical,
If differing, judge that in described service end, document has modification.
In one embodiment of the invention, the modification obtaining document in described server specifically also includes: if described modification
Time is identical, then continue to extract the title of document described in database information in described client and described service end, and judge
Whether the title of described document is identical, if differing, judges that document in described service end has the modification of renaming;If identical,
Judge that in described service end, document is not changed.
In one embodiment of the invention, described document is file or folder;If described document is file, to institute
State file next stage document and repeat detection steps, until finding the change of respective file under described file.
Another aspect of the present invention also provides a kind of system detecting document change and synchronization, is applied under windows system
In the change detection and synchronization of document in service end corresponding with the document under catalogue specified by client application, described spy
Survey document change and synchronous system includes: creation module, for when starting the process of application program, creating for detecting clothes
The detection thread of the change of document under catalogue specified by described application program on business end, creates for detecting described service
By the line synchro in client for the document-synchronization of change when document under catalogue specified by application program described in end changes
Journey, and create one described detection thread detect the document under catalogue specified by application program described in described service end
When changing, the document information needing synchronous change is transmitted to the connection object of described synchronizing thread;Detect thread process mould
Block, for obtaining the database information of the document under catalogue specified by application program described in described client and described clothes respectively
The database information of the document under catalogue specified by corresponding described application program in business device, extracts described client and institute respectively
Stating in database information in service end is the document unique mark and document change mark that described document sets in advance, and by will
Extract in the document unique mark extracted in database information from described client and database information from described service end
Document unique mark compare, obtain the newly-increased of document in described server and delete, by counting from described client
Make according to the document change mark extracted in the document change mark extracted in the information of storehouse and database information from described service end
Contrast, obtains the modification of document in described server, and the newly-increased, deletion to document in the described server obtaining and modification letter
Breath be packaged forming a task data bag, using create described connection object by described task data bag transmit to described with
Step thread;Synchronizing thread processing module, for processing to described task data bag, by the document of change in described server
It is synchronized in described client.
In one embodiment of the invention, described detect thread process module obtain the newly-increased of document in described server and
The detailed process deleted is: if not having described service end in the document unique mark extracted in database information in described client
The document unique mark extracted in middle database information, judges that the document in described server is newly-increased;If in described service end
The document extracting in database information in described client is not had uniquely to mark in the document unique mark extracted in database information
Know, judge that the document in described server is deletion;If the document unique mark extracted in database information in described client
With the document unique mark all same extracted in database information in described service end, then data base will believe from described client
The document change mark extracted in the document change mark extracted in breath and database information from described service end compares, and obtains
Take the modification of document in described server.
In one embodiment of the invention, the described modification tool detecting document in the thread process module described server of acquisition
Body includes: if the document change mark extracted in database information from described client and data base's letter from described service end
The document change mark extracted in breath differs, then judge that the document in described server has modification;If from described client
The document change mark extracted in the document change mark extracted in database information and database information from described service end
Identical, continue to extract the modification time of document described in database information in described client and described service end, and judge institute
Whether identical stating modification time, if differing, judging that in described service end, document has modification.
In one embodiment of the invention, the described modification tool detecting document in the thread process module described server of acquisition
Body also includes: if described modification time is identical, continues to extract institute in database information in described client and described service end
State the title of document, and judge described document title whether identical, if differing, judge that in described service end, document has weight
The modification of name;If identical, judge that in described service end, document is not changed.
In one embodiment of the invention, described document is file or folder;If described document is file, described
Detect thread process module and detection is repeated to described file next stage document, corresponding under described file until finding
The change of file.
As described above, the present invention's detects document change and synchronous method and system, have the advantages that
The present invention can detect the change of all of document, comprising: newly-built, delete, modification, renaming, and support up to ten thousand
Level file is newly-built, delete, modification, renaming, it is to avoid document is not detected and efficiency is too low, it is to avoid the document that may lose becomes
Change information, the detection process of the present invention passes through task state it is ensured that the change of all documents all can be recorded and execute.
Brief description
Fig. 1 is shown as the principle process schematic diagram detecting document change and synchronous method of the present invention.
Fig. 2 is shown as the idiographic flow schematic diagram detecting document change and synchronous method of the present invention.
Fig. 3 is shown as the schematic flow sheet that the detection document of the present invention changes with synchronous method in an embodiment.
Fig. 4 is shown as the theory structure schematic diagram detecting document change and synchronous system of the present invention.
Component label instructions
100 detect document change and synchronous system
101 creation modules
102 detection thread process modules
103 synchronizing thread processing modules
S101~s109 step
Specific embodiment
Below by way of specific instantiation, embodiments of the present invention are described, those skilled in the art can be by this specification
Disclosed content understands other advantages and effect of the present invention easily.The present invention can also be by addition different concrete realities
The mode of applying is carried out or applies, and the every details in this specification can also be based on different viewpoints and application, without departing from
Carry out various modifications and changes under the spirit of the present invention.It should be noted that, in the case of not conflicting, following examples and enforcement
Feature in example can be mutually combined.
It should be noted that the diagram provided in following examples only illustrates the basic structure of the present invention in a schematic way
Think, then only show the assembly relevant with the present invention in schema rather than according to component count during actual enforcement, shape and size
Draw, during its actual enforcement, the kenel of each assembly, quantity and ratio can be a kind of random change, and its assembly layout kenel
It is likely more complexity.
The purpose of the present embodiment is to provide a kind of method and system detecting document change and synchronization, existing for solving
Technology efficiently and accurately cannot be detected to the document of synchronous disk and synchronous problem.The present embodiment described in detail below
A kind of document that detects changes and the synchronous principle of method and system and embodiment, makes those skilled in the art not need to create
Property work be appreciated that a kind of detection document change of the present embodiment and synchronous method and system.
As shown in figure 1, the present embodiment provide a kind of detect document change and synchronous method and system, be applied to detect and
File under catalogue specified by application program under synchronous windows system.Detection document change is former with synchronous method and system
Manage and be: start program process, create and detect thread and synchronizing thread;Create biography change information transmitted to synchronizing thread
Defeated object;Obtain client database file details;Obtain service end database file details;Judged by comparing file details
Whether file is newly-increased, deletions, renaming, modification change;It is task data bag to package file change information, by connection object
Task data bag is transmitted to synchronizing thread;Synchronizing thread is processed to task data bag, should by the file synchronization value of change
With the local cache corresponding to program.
Specifically, as shown in Fig. 2 detecting document change in the present embodiment to be applied to windows system with synchronous method
Lower with the change detection and synchronization of document in the corresponding service end of document under catalogue specified by client application, described
Application program preferably has the application program of document store function, for example, but be not limited to synchronous disk, the present embodiment is concrete
So that application program is as synchronous disk as a example illustrate during explanation.As shown in Fig. 2 in the present embodiment, described detection document change
Comprise the following steps with synchronous method:
Step s101, when starting the process of application program, creates for detecting described application program indication in service end
Determine the detection thread of change of the document under catalogue and create for detecting application program indication described in described service end
Determine the synchronizing thread in client for the document-synchronization of change when the document under catalogue changes.
Wherein, in the present embodiment, described synchronizing thread is a synchronizing thread or synchronizing thread pond.It is preferably to create and use
In the detection thread of the change of the document detecting in service end under catalogue specified by described application program with create for detecting
By the document-synchronization of change to client when document under catalogue specified by application program described in described service end changes
In synchronizing thread pond.
In the present embodiment, the change of described document includes: newly-built, delete, modification, renaming, detect thread support on
Ten thousand grades of documents are newly-built, deletion, modification, renaming, movement, copy.
In the present embodiment, for example, pass through _ beginthread establishment detection thread, and register threadproc readjustment letter
Number.Control by interlockedexchange whether detection thread exits.
Step s102, creates one and detects mesh specified by application program described in described service end in described detection thread
When document under record changes, the document information needing synchronous change is transmitted to the connection object of described synchronizing thread.
Step s103, described detection thread obtains the literary composition under catalogue specified by application program described in described client respectively
The database information of the document under catalogue specified by corresponding described application program in the database information of shelves and described server.
Specifically, described detection thread obtains service end database information by the open api that service end provides, described
Detect the data base api that encapsulates by local client of thread and obtain local client data storehouse information.
Wherein, the file catalogue of the document under catalogue specified by described application program is the file catalogue wanting to detect, this
File catalogue can set according to demand.
Wherein in the present embodiment, described database information includes: docid: file unique mark, generates one by service end
The character string of individual unique 64 characters, that is, described file unique mark generated by service end, that is, in service end, All Files is all
Have a different docid;Otag: file change identifies, and is generated the character string of unique 64 characters by service end,
If file or file change, the change changing this file or folder identifies and updates parent directory and ancestors' mesh
The change mark of record.I.e. described file change mark service end generates, and described service end has file or folder change, then can
Update the otag of this document or file and ancestor directories.
Step s104, described detection thread extracts in database information in described client and described service end in advance respectively
The document unique mark setting for described document and document change mark.
Step s105, described detection thread passes through uniquely to mark the document extracting in database information from described client
The document unique mark extracted in knowledge and database information from described service end compares, and obtains document in described server
Increase newly and delete.
Specifically, in the present embodiment, in the described server of described acquisition, the detailed process that is newly-increased and deleting of document is:
If not having to carry in database information in described service end in the document unique mark extracted in database information in described client
The document unique mark taking, judges that the document in described server is newly-increased;If extracting in database information in described service end
Document unique mark in do not have in database information in described client extract document unique mark, judge described server
In document be delete;If the document unique mark extracted in database information in described client and data in described service end
The document unique mark all same extracted in the information of storehouse, then by the document extracting in database information from described client change
The document change mark extracted in mark and database information from described service end compares, and obtains document in described server
Modification.
For example, docid is ranked up, compares successively;If service end docid represents service end less than client docid
The docid referring to increases newly in service end, needs local client newly-built;If service end docid represents client more than client docid
Hold the docid referring to be deleted in service end, need local client to delete;If service end docid is equal to client docid, if
Otag differs and represents that the file corresponding to this docid changes in service end, needs synchronous download.
Step s106, described detection thread passes through the document extracting in database information from described client change mark
The document change mark extracted in knowledge and database information from described service end compares, and obtains document in described server
Modification.
Specifically, in the present embodiment, the described modification obtaining document in described server specifically includes: if from described visitor
The document extracting in the document change mark extracted in database information in the end of family and database information from described service end becomes
Change mark to differ, then judge that the document in described server has modification;If extracting in database information from described client
Document change mark identical with the document change mark extracted in database information from described service end, continue to extract described
The modification time of document described in database information in client and described service end, and judge described modification time whether phase
Same, if differing, judge that in described service end, document has modification.
Further, in the present embodiment, the modification obtaining document in described server specifically also includes: if described modification
Time is identical, then continue to extract the title of document described in database information in described client and described service end, and judge
Whether the title of described document is identical, if differing, judges that document in described service end has the modification of renaming;If identical,
Judge that in described service end, document is not changed.
I.e. in the present embodiment, if otag is identical, the title (name) of document differs, then supporting paper or file
It is renamed in service end, need synchronous title, if otag is identical, modification time (mtime) differs, then supporting paper exists
Service end being serviced end is changed, and needs in the locally downloading client of file synchronization of modification.
If otag differs, Doctype is file (size is -1), then have file or file under supporting paper folder
Folder change, needs recurrence to detect the concrete file change situation under this catalogue.
So in the present embodiment, described document is file or folder;If described document is file, to described literary composition
Part folder next stage document repeats detection steps, until finding the change of respective file under described file.
That is, in the present embodiment, in order to, in the case of docid identical, improve efficiency, introducing following field
(name: file name;Mtime: last modification time;Size: file size, file is denoted as -1);Premise: service end
Docid is equal to client docid;If name differs, need local renaming and if size is -1, need recurrence
Detect and service end compares file situation of change under this catalogue;If otag differs and size is -1, represent under this document folder
There is file change, this document itself is unchanged, need recurrence to detect and file change under this catalogue of service end;If size is not -1
And mtime is different, represent that this document occurred change in service end, need synchronous download.
Step s107, described detection thread enters to the newly-increased, deletion of document in the described server obtaining and modification information
Row encapsulation forms a task data bag.
Step s108, is transmitted described task data bag to described synchronizing thread using the described connection object creating.
Step s109, described synchronizing thread is processed to described task data bag, by the literary composition of change in described server
Shelves are synchronized in described client.
In the present embodiment, described detection thread and described synchronizing thread are by judging whether described application program closes
Determine whether to close described detection thread and described synchronizing thread.
As shown in figure 3, in the present embodiment, detection document changes and synchronous method changes to document detection and synchronization
Specific implementation process is as follows:
Start synchronous disk, establishment detects thread, creates synchronizing thread, starts connection object, start detection thread and open simultaneously
Dynamic synchronizing thread, detecting thread and judges to detect whether thread stops, if stopping, exiting, stop detecting thread;If not stopping,
Then obtain native client point data base, obtain and service client database, two data bases of contrast, log file change information, then
Notify change to synchronizing thread.Synchronizing thread judges whether synchronizing thread stops, if stopping, exiting, if not stopping, reading logical
Know change, execute the task that this receives.
Detect thread and synchronizing thread when application program is detected and exiting or stop, expiry notification changes, and stops detecting
Thread, stops synchronizing thread, exits synchronous disk.
As shown in figure 4, the present embodiment also provides a kind of system 100 detecting document change and synchronization, it is applied to windows
Under system with the change detection and synchronization of document in the corresponding service end of document under catalogue specified by client application,
Described detection document change and synchronous system 100 include: creation module 101, detect thread process module 102 and line synchro
Journey processing module 103.
Specifically, in the present embodiment, described creation module 101 is used for, when starting the process of application program, creating and using
In the detection thread of the change of the document detecting under catalogue specified by described application program in service end, create for detecting
When document under catalogue specified by application program described in described service end changes by the document-synchronization of change in client
Synchronizing thread, and create one described detection thread detect catalogue specified by application program described in described service end
Under document the document information needing synchronous change is transmitted to the connection object of described synchronizing thread when changing.
Wherein, in the present embodiment, described synchronizing thread is a synchronizing thread or synchronizing thread pond.It is preferably to create and use
In the detection thread of the change of the document detecting in service end under catalogue specified by described application program with create for detecting
By the document-synchronization of change to client when document under catalogue specified by application program described in described service end changes
In synchronizing thread pond.
In the present embodiment, the change of described document includes: newly-built, delete, modification, renaming, detect thread support on
Ten thousand grades of documents are newly-built, deletion, modification, renaming, movement, copy.
In the present embodiment, for example, pass through _ beginthread establishment detection thread, and register threadproc readjustment letter
Number.Control by interlockedexchange whether detection thread exits.
Specifically, in the present embodiment, described detection thread process module 102 is used for obtaining institute in described client respectively
State corresponding described application program indication in the database information of document and the described server under catalogue specified by application program
Determine the database information of the document under catalogue, extract respectively in described client and described service end and in database information be in advance
Document unique mark and document change mark that described document sets, and by carrying in database information from described client
The document unique mark extracted in the document unique mark taking and database information from described service end compares, and obtains described
Document newly-increased and deleting in server, by the document change mark that will extract in database information from described client and
The document change mark extracted in database information from described service end compares, and in the described server of acquisition, document repaiies
Change, and the newly-increased, deletion and modification information to document in the described server obtaining is packaged being formed a task data bag, profit
With the described connection object creating, described task data bag is transmitted to described synchronizing thread.
Specifically, described detection thread obtains service end database information by the open api that service end provides, described
Detect the data base api that encapsulates by local client of thread and obtain local client data storehouse information.
Wherein, the file catalogue of the document under catalogue specified by described application program is the file catalogue wanting to detect, this
File catalogue can set according to demand.
Wherein in the present embodiment, described database information includes: docid: file unique mark, generates one by service end
The character string of individual unique 64 characters, that is, described file unique mark generated by service end, that is, in service end, All Files is all
Have a different docid;Otag: file change identifies, and is generated the character string of unique 64 characters by service end,
If file or file change, the change changing this file or folder identifies and updates parent directory and ancestors' mesh
The change mark of record.I.e. described file change mark service end generates, and described service end has file or folder change, then can
Update the otag of this document or file and ancestor directories.
Wherein, in the present embodiment, described detect thread process module 102 obtain the newly-increased of document in described server and
The detailed process deleted is: if not having described service end in the document unique mark extracted in database information in described client
The document unique mark extracted in middle database information, judges that the document in described server is newly-increased;If in described service end
The document extracting in database information in described client is not had uniquely to mark in the document unique mark extracted in database information
Know, judge that the document in described server is deletion;If the document unique mark extracted in database information in described client
With the document unique mark all same extracted in database information in described service end, then data base will believe from described client
The document change mark extracted in the document change mark extracted in breath and database information from described service end compares, and obtains
Take the modification of document in described server.
For example, docid is ranked up, compares successively;If service end docid represents service end less than client docid
The docid referring to increases newly in service end, needs local client newly-built;If service end docid represents client more than client docid
Hold the docid referring to be deleted in service end, need local client to delete;If service end docid is equal to client docid, if
Otag differs and represents that the file corresponding to this docid changes in service end, needs synchronous download.
Wherein, in the present embodiment, described detection thread process module 102 obtains the modification tool of document in described server
Body includes: if the document change mark extracted in database information from described client and data base's letter from described service end
The document change mark extracted in breath differs, then judge that the document in described server has modification;If from described client
The document change mark extracted in the document change mark extracted in database information and database information from described service end
Identical, continue to extract the modification time of document described in database information in described client and described service end, and judge institute
Whether identical stating modification time, if differing, judging that in described service end, document has modification.
In the present embodiment, described detection thread process module 102 obtains the modification of document in described server specifically also
Including: if described modification time is identical, continue to extract literary composition described in database information in described client and described service end
Shelves title, and judge described document title whether identical, if differing, judge that in described service end, document has renaming
Modification;If identical, judge that in described service end, document is not changed.
In the present embodiment, described document is file or folder;If described document is file, described detection thread
Processing module 102 repeats detection to described file next stage document, until finding respective file under described file
Change.
I.e. in the present embodiment, if otag is identical, the title (name) of document differs, then supporting paper or file
It is renamed in service end, need synchronous title, if otag is identical, modification time (mtime) differs, then supporting paper exists
Service end being serviced end is changed, and needs in the locally downloading client of file synchronization of modification.
If otag differs, Doctype is file (size is -1), then have file or file under supporting paper folder
Folder change, needs recurrence to detect the concrete file change situation under this catalogue.
So in the present embodiment, described document is file or folder;If described document is file, to described literary composition
Part folder next stage document repeats detection steps, until finding the change of respective file under described file.
That is, in the present embodiment, in order to, in the case of docid identical, improve efficiency, introducing following field
(name: file name;Mtime: last modification time;Size: file size, file is denoted as -1);Premise: service end
Docid is equal to client docid;If name differs, need local renaming and if size is -1, need recurrence
Detect and service end compares file situation of change under this catalogue;If otag differs and size is -1, represent under this document folder
There is file change, this document itself is unchanged, need recurrence to detect and file change under this catalogue of service end;If size is not -1
And mtime is different, represent that this document occurred change in service end, need synchronous download.
Specifically, in the present embodiment, described synchronizing thread processing module 103 is used for described task data bag
Reason, by the document-synchronization of change in described server in described client.
In the present embodiment, described detection thread and described synchronizing thread are by judging whether described application program closes
Determine whether to close described detection thread and described synchronizing thread.
In sum, the present invention can detect the change of all of document, comprising: newly-built, delete, modification, renaming, and
Support that up to ten thousand grades of files are newly-built, delete, modification, renaming, it is to avoid document is not detected and efficiency is too low, it is to avoid may lose
Document change information, the detection process of the present invention passes through task state it is ensured that the change of all documents all can be recorded and hold
OK.So, the present invention effectively overcomes various shortcoming of the prior art and has high industrial utilization.
Above-described embodiment only principle of the illustrative present invention and its effect, not for the restriction present invention.Any ripe
The personage knowing this technology all can carry out modifications and changes without prejudice under the spirit and the scope of the present invention to above-described embodiment.Cause
This, those of ordinary skill in the art is complete with institute under technological thought without departing from disclosed spirit such as
All equivalent modifications becoming or change, must be covered by the claim of the present invention.
Claims (10)
1. a kind of detect document change and synchronous method, be applied under windows system with specified by client application
It is characterised in that described detection document change in the change detection of document and synchronization in the corresponding service end of document under catalogue
Comprise the following steps with synchronous method:
When starting the process of application program, create for detecting the document under catalogue specified by described application program in service end
Change detect thread and creating for detecting the document under catalogue specified by application program described in described service end
By the synchronizing thread in client for the document-synchronization of change when changing;
Establishment one detects the document under catalogue specified by application program described in described service end in described detection thread to be had
During change, the document information needing synchronous change is transmitted to the connection object of described synchronizing thread;
Described detection thread obtains data base's letter of the document under catalogue specified by application program described in described client respectively
The database information of the document under catalogue specified by corresponding described application program in breath and described server;
Described detection thread extracts respectively in database information in described client and described service end and sets for described document in advance
Fixed document unique mark and document change mark;
The described thread that detects passes through by the document unique mark extracted in database information from described client with from described clothes
The document unique mark extracted in database information in business end compares, and obtains the newly-increased and deletion of document in described server;
The described thread that detects passes through by the document extracting in database information from described client change mark with from described clothes
The document change mark extracted in database information in business end compares, and obtains the modification of document in described server;
The described thread that detects is packaged forming one to the newly-increased, deletion of document in the described server obtaining and modification information
Business packet;
Using the described connection object creating, described task data bag is transmitted to described synchronizing thread;
Described synchronizing thread is processed to described task data bag, by the document-synchronization of change in described server to described visitor
In the end of family.
2. according to claim 1 detect document change and synchronous method it is characterised in that: the described service of described acquisition
In device, the detailed process that is newly-increased and deleting of document is:
If there is no database information in described service end in the document unique mark extracted in database information in described client
The document unique mark of middle extraction, judges that the document in described server is newly-increased;
If there is no database information in described client in the document unique mark extracted in database information in described service end
The document unique mark of middle extraction, judges that the document in described server is deletion;
If carrying in the document unique mark extracted in database information in described client and database information in described service end
The document unique mark all same taking, then by the document extracting in database information from described client change mark with from institute
State the document change mark extracted in database information in service end to compare, obtain the modification of document in described server.
3. according to claim 1 and 2 detect document change and synchronous method it is characterised in that: obtain described service
In device, the modification of document specifically includes:
If the document change mark extracted in database information from described client and database information from described service end
The document change mark of middle extraction differs, then judge that the document in described server has modification;
If the document change mark extracted in database information from described client and database information from described service end
The document change mark of middle extraction is identical, continues to extract document described in database information in described client and described service end
Modification time, and judging whether described modification time identical, if differing, judging that in described service end, document has modification.
4. according to claim 3 detect document change and synchronous method it is characterised in that: obtain in described server
The modification of document specifically also includes: if described modification time is identical, continues to extract number in described client and described service end
According to the title of document described in the information of storehouse, and judge described document title whether identical, if differing, judge described service
In end, document has the modification of renaming;If identical, judge that in described service end, document is not changed.
5. according to claim 4 detect document change and synchronous method it is characterised in that: described document be file or
File;If described document is file, detection steps are repeated to described file next stage document, until finding
The change of respective file under described file.
6. a kind of detect document change and synchronous system, be applied under windows system with specified by client application
It is characterised in that described detection document change in the change detection of document and synchronization in the corresponding service end of document under catalogue
Include with synchronous system:
Creation module, for when starting the process of application program, creating for detecting described application program indication in service end
Determine the detection thread of the change of document under catalogue, create for detecting specified by application program described in described service end
By the synchronizing thread in client for the document-synchronization of change when document under catalogue changes, and create one in described spy
Synchronous change will be needed when the document that survey line journey detects under catalogue specified by application program described in described service end changes
The document information changed transmits to the connection object of described synchronizing thread;
Detect thread process module, for obtaining document under catalogue specified by application program described in described client respectively
The database information of the document under catalogue specified by corresponding described application program in database information and described server, respectively
Extract in database information in described client and described service end is document unique mark and the literary composition that described document sets in advance
Shelves change mark, and by will in database information from described client extract document unique mark and from described service end
The document unique mark extracted in middle database information compares, and obtains the newly-increased and deletion of document in described server, passes through
Carry from described service end and in database information the document extracting in database information from described client change mark
The document change mark taking compares, and obtains the modification of document in described server, and to document in the described server obtaining
Newly-increased, delete and modification information is packaged forming a task data bag, using the described connection object creating by described
Business packet transmits to described synchronizing thread;
Synchronizing thread processing module, for processing to described task data bag, the document of change in described server is same
Walk in described client.
7. according to claim 6 detect document change and synchronous system it is characterised in that: described detection thread process
The detailed process that is newly-increased and deleting that module obtains document in described server is:
If there is no database information in described service end in the document unique mark extracted in database information in described client
The document unique mark of middle extraction, judges that the document in described server is newly-increased;
If there is no database information in described client in the document unique mark extracted in database information in described service end
The document unique mark of middle extraction, judges that the document in described server is deletion;
If carrying in the document unique mark extracted in database information in described client and database information in described service end
The document unique mark all same taking, then by the document extracting in database information from described client change mark with from institute
State the document change mark extracted in database information in service end to compare, obtain the modification of document in described server.
8. according to claim 6 or 7 detect document change and synchronous system it is characterised in that: described detection thread
The modification that processing module obtains document in described server specifically includes:
If the document change mark extracted in database information from described client and database information from described service end
The document change mark of middle extraction differs, then judge that the document in described server has modification;
If the document change mark extracted in database information from described client and database information from described service end
The document change mark of middle extraction is identical, continues to extract document described in database information in described client and described service end
Modification time, and judging whether described modification time identical, if differing, judging that in described service end, document has modification.
9. according to claim 8 detect document change and synchronous system it is characterised in that: described detection thread process
The modification that module obtains document in described server specifically also includes: if described modification time is identical, continues to extract described visitor
The title of document described in database information in family end and described service end, and judge described document title whether identical, if
Differ, then judge that document in described service end has the modification of renaming;If identical, judge that in described service end, document is not repaiied
Change.
10. according to claim 9 detect document change and synchronous system it is characterised in that: described document is file
Or file;If described document is file, described detection thread process module repeats to described file next stage document
Execute detection, until finding the change of respective file under described file.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610784758.8A CN106372179B (en) | 2016-08-31 | 2016-08-31 | Method and system for detecting document change and synchronization |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610784758.8A CN106372179B (en) | 2016-08-31 | 2016-08-31 | Method and system for detecting document change and synchronization |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106372179A true CN106372179A (en) | 2017-02-01 |
CN106372179B CN106372179B (en) | 2020-04-03 |
Family
ID=57899378
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610784758.8A Active CN106372179B (en) | 2016-08-31 | 2016-08-31 | Method and system for detecting document change and synchronization |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106372179B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107451108A (en) * | 2017-06-13 | 2017-12-08 | 广州视源电子科技股份有限公司 | A kind of method and system of collaborative editing document |
CN109241183A (en) * | 2018-08-16 | 2019-01-18 | 武汉元鼎创天信息科技有限公司 | A kind of method of data synchronization and system based on socket communication |
CN110287723A (en) * | 2019-05-21 | 2019-09-27 | 北京达佳互联信息技术有限公司 | Resource information determines method, apparatus, electronic equipment and storage medium |
CN110704389A (en) * | 2019-09-24 | 2020-01-17 | 武汉意畅智云科技有限公司 | Bidirectional file synchronization method based on drive and state |
CN111782619A (en) * | 2020-07-28 | 2020-10-16 | 上海爱数信息技术股份有限公司 | Document increment synchronization method and device between servers and storage medium |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102457549A (en) * | 2010-10-28 | 2012-05-16 | 盛乐信息技术(上海)有限公司 | Data synchronization system and method for multiple network storage devices |
CN103258018A (en) * | 2013-04-27 | 2013-08-21 | 北京金和软件股份有限公司 | File synchronization method capable of accurately monitoring file changes in catalog folder |
CN105100170A (en) * | 2014-05-21 | 2015-11-25 | 浙江海洋学院 | Automatic cloud storage synchronous management system for a plurality of cloud storage service platforms and method thereof |
US9213718B1 (en) * | 2011-06-22 | 2015-12-15 | Emc Corporation | Synchronized file management across multiple disparate endpoints |
CN105306581A (en) * | 2015-11-11 | 2016-02-03 | 上海斐讯数据通信技术有限公司 | Router and cloud disk based data synchronization method |
US20160055172A1 (en) * | 2013-03-28 | 2016-02-25 | International Business Machines Corporation | Dynamically synching elements in file |
US20160162363A1 (en) * | 2014-12-05 | 2016-06-09 | International Business Machines Corporation | Performing a closure merge operation |
CN105740418A (en) * | 2016-01-29 | 2016-07-06 | 杭州亿方云网络科技有限公司 | File monitoring and message pushing based real-time synchronization system |
CN105893120A (en) * | 2016-04-21 | 2016-08-24 | 北京京东尚科信息技术有限公司 | Acquisition method and device for thread synchronization resources |
-
2016
- 2016-08-31 CN CN201610784758.8A patent/CN106372179B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102457549A (en) * | 2010-10-28 | 2012-05-16 | 盛乐信息技术(上海)有限公司 | Data synchronization system and method for multiple network storage devices |
US9213718B1 (en) * | 2011-06-22 | 2015-12-15 | Emc Corporation | Synchronized file management across multiple disparate endpoints |
US20160055172A1 (en) * | 2013-03-28 | 2016-02-25 | International Business Machines Corporation | Dynamically synching elements in file |
CN103258018A (en) * | 2013-04-27 | 2013-08-21 | 北京金和软件股份有限公司 | File synchronization method capable of accurately monitoring file changes in catalog folder |
CN105100170A (en) * | 2014-05-21 | 2015-11-25 | 浙江海洋学院 | Automatic cloud storage synchronous management system for a plurality of cloud storage service platforms and method thereof |
US20160162363A1 (en) * | 2014-12-05 | 2016-06-09 | International Business Machines Corporation | Performing a closure merge operation |
CN105306581A (en) * | 2015-11-11 | 2016-02-03 | 上海斐讯数据通信技术有限公司 | Router and cloud disk based data synchronization method |
CN105740418A (en) * | 2016-01-29 | 2016-07-06 | 杭州亿方云网络科技有限公司 | File monitoring and message pushing based real-time synchronization system |
CN105893120A (en) * | 2016-04-21 | 2016-08-24 | 北京京东尚科信息技术有限公司 | Acquisition method and device for thread synchronization resources |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107451108A (en) * | 2017-06-13 | 2017-12-08 | 广州视源电子科技股份有限公司 | A kind of method and system of collaborative editing document |
CN107451108B (en) * | 2017-06-13 | 2021-04-06 | 广州视源电子科技股份有限公司 | Method and system for collaboratively editing document |
CN109241183A (en) * | 2018-08-16 | 2019-01-18 | 武汉元鼎创天信息科技有限公司 | A kind of method of data synchronization and system based on socket communication |
CN110287723A (en) * | 2019-05-21 | 2019-09-27 | 北京达佳互联信息技术有限公司 | Resource information determines method, apparatus, electronic equipment and storage medium |
CN110704389A (en) * | 2019-09-24 | 2020-01-17 | 武汉意畅智云科技有限公司 | Bidirectional file synchronization method based on drive and state |
CN110704389B (en) * | 2019-09-24 | 2022-02-01 | 武汉意畅智云科技有限公司 | Bidirectional file synchronization method based on drive and state |
CN111782619A (en) * | 2020-07-28 | 2020-10-16 | 上海爱数信息技术股份有限公司 | Document increment synchronization method and device between servers and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN106372179B (en) | 2020-04-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106372179A (en) | Method and system for detecting document change and synchronization | |
US10397319B2 (en) | Server-side selective synchronization | |
CN109413127B (en) | Data synchronization method and device | |
AU2020203219B2 (en) | Sharing unmanaged content using a content management system | |
CN104462547B (en) | A kind of method and system of configurable collecting webpage data | |
CN102722439B (en) | Method, device and system for improving running stability of FLASH assembly | |
CN103312489B (en) | A kind of terminal carries out synchronize method and apparatus with server | |
US10942944B2 (en) | Managing content across discrete systems | |
EP3062486A1 (en) | Methods, apparatuses and computer program products for enabling intelligent merging of modified data | |
US20140359488A1 (en) | Centralized Management of Link Data for Multiple Applications, Computers and Resources, through Operating Systems and Networked Storage Services | |
CN106462430A (en) | Method and device for obtaining application upgrade packages | |
US10503900B2 (en) | Identifying malware based on content item identifiers | |
CN103678698A (en) | Method and device for improving on-line browsing loading speed of PDF document | |
CN101702158A (en) | Index file creation synchronized method and search system | |
JP2015026207A (en) | File management program, file management device and file management method | |
CN110309386B (en) | Method and device for crawling web page | |
CN103019556A (en) | Quick help information display system and quick help information display method | |
US10198449B2 (en) | Creating unique content item identifiers | |
CN106371706A (en) | Method and device for site selection of application shortcuts | |
CN104063475A (en) | User-defined list processing method and device | |
CN103218452A (en) | Method and device for recognizing valid interlinkage in Hub webpage | |
US20160277477A1 (en) | Information processing apparatus, terminal device, information processing method, and non-transitory computer readable recording medium | |
CN101179525A (en) | Method, system and device for obtaining file information | |
US7991741B2 (en) | System and method for synchronizing data record with web document in a content management system | |
CN105718496A (en) | cross-platform file attribute synchronization method and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |