1. Technical Field
The embodiments of the present disclosure relate to data management technology, and particularly to a file synchronization system and method.
2. Description of Related Art
File synchronization in computing filed is used for backups, or ensuring that files in one or more computers are updated via certain rules (e.g., one-way file synchronization, or two-way file synchronization). When file synchronization intervals are too short, this wastes a lot of computing resource. Furthermore, if the interval is too long, data may be lost if the system malfunctions. Therefore, there is room for improvement in the art.
The disclosure is illustrated by way of examples and not by way of limitation in the figures of the accompanying drawings in which like references indicate similar elements. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean “at least one.”
In general, the word “module”, as used herein, refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a programming language, such as, Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware, such as in an EPROM. The modules described herein may be implemented as either software and/or hardware modules and may be stored in any type of non-transitory computer-readable medium or other storage device. Some non-limiting examples of non-transitory computer-readable media include CDs, DVDs, BLU-RAY, flash memory, and hard disk drives.
The client 1 and the server 2 store one or more objects and each object may include one or more files as shown in
The server 2 also stores a record list 20. The record list 20 includes a name of each updated object in the server 1, a name of each updated file in the object, each updating time (e.g., 10:30 AM or 11: 30 AM) of updating the record list 20, one or more updating intervals of the record list 20, and times (e.g., nine times) of updating the record list 20. The record list 20 is updated when at least one file in the object is updated. In one embodiment, if a file in the object has currently been updated, the record list 20 stores the name of the updated file in the object, the name of the updated object and the updating time of the updated file. The updating time of the updated file in the object is regarded as the updating time of updating the record list 20. In other words, if the file in the object is updated in the server 2, the record list 20 is updated.
As shown in
The file synchronization system 100 synchronizes files between the client 1 and the server 2. In one embodiment, the client 1 further includes a storage system 10 and at least one processor 12. The file synchronization system 100 includes a monitoring module 1000, an adjustment module 1002, a synchronization module 1004, and an updating module 1006. The modules 1000-1006 may include computerized code in the form of one or more programs that are stored in the storage system 10. The computerized code includes instructions that are executed by at least one processor 12 to provide functions for the modules 1000-1006. The storage system 10 may be a memory, such as an EPROM memory chip, hard disk drive (HDD), or flash memory stick.
The monitoring module 1000 monitors the record list 20 according to the task scheduler 102. As mentioned above, the task scheduler 102 stores a sync interval, the monitoring module 1000 monitors the record list 20 at the sync interval.
The monitoring module 1000 determines if the record list 20 has been updated (a detailed description is described in
The synchronization module 1004 synchronizes the updated files from the server 2 to the client 1 according to the record list 20, in response to a determination that the record list 20 has been updated. In one embodiment, the synchronization module 1004 searches for the updated files in the server 2, and synchronizes the updated files from the server 2 to the client 1. The updated file in the server 2 is defined as the file which does not exist in the client 1. In other embodiment, if the name of the file in the client 1 is the same as the name of the file in the server 2, and the content of the file in the client 1 is different from the content of the file in the server 2, the file in the server 2 is also regarded as the updated file in the server 2.
The adjustment module 1004 adjusts the sync interval according to the times of updating the record list 20 and the one or more updating intervals of updating the record list 20. In one embodiment, the sync interval is adjusted to a (n+1)th updating interval of updating the record list 20, and the (n+1)th updating interval of updating the record list 20 is calculated by a formula as follows: yn+1=x0+x1tn+1, where
yn+1 represents the (n+1)th updating interval of updating the record list 20, tn+1 represents the (n+1)th time of updating the record list 20, ti represents the (i)th time of updating the record list 20,
The adjustment module 1004 adjusts the sync interval according to a predetermined weight in response to a determination that the record list 20 has not been updated. In one embodiment, the adjustment module 1004 adjusts the sync interval according to the predetermined weight using a formula as following: yn+1=w0y0, where yn+1 represents the adjusted sync interval, w0 represents the weight predetermined by a user and y0 represents the original sync interval predetermined by a user. Additionally, both w0 and y0 are the constants, for example, w0 may be predetermined as a digit 2 and the y0 may be predetermined as 10 seconds, and the adjusted sync interval is 20 seconds.
The updating module 1006 updates the task scheduler 102 according to the adjusted sync interval. In one embodiment, the updating module 1006 inserts the adjusted sync interval into the task scheduler 102.
In step S1, the monitoring module 1000 monitors a record list 20 according to a task scheduler 102. In one embodiment, the task scheduler 102 stores a sync interval (e.g., ten seconds), and the monitoring module 1000 monitors the record list 20 at the sync intervals (e.g., every ten seconds).
In step S3, the monitoring module 1000 determines if the record list 20 has been updated (a detailed description is described in
In step S5, the adjustment module 1004 adjusts the sync interval according to a predetermined weight in response to a determination that the record list 20 has not been updated. Then, the procedure goes to step S11. In one embodiment, the adjustment module 1004 adjusts the sync interval according to the predetermined weight using the formula yn+1=w0y0 as mentioned above. For example, if w0 is predetermined as a digit 2 and y0 is predetermined as 10 seconds, and the adjusted sync interval is adjusted to 20 seconds.
In step S7, the synchronization module 1004 synchronizes the updated files from the server 2 to the client 1 according to the record list 20. For example, as shown in
In step S9, the he adjustment module 1004 adjusts the sync interval according to the number of times of updating the record list 20 and the one or more updating intervals. In one embodiment, the sync interval is adjusted to a (n+1)th updating interval of updating the record list 20, and the (n+1)th updating interval of updating the record list 20 is calculated by a formula yn+1=x0+x1tn+1 as mentioned above. One example of a table for showing nine times of updating the record list 20 is shown as follows:
According to the above table and the formula as mentioned above,
In step S11, the updating module 1006 updates the task scheduler 102 according to the adjusted sync interval.
In step S100, the monitoring module 1000 obtains a first hash code of each object in the server 2 and a second hash code of each object in the client 1, and compare the first hash code of each object with the hash code of each object according to the name of the object. For example, as shown in
In step S102, the monitoring module 100 determines if each first hash code matches the second hash code corresponding to the first hash code. In one embodiment, if each first hash code matches the second hash code corresponding to the first hash code, the procedure goes to step S104, the monitoring module 100 determines that the record list 20 has not been updated. Then, the procedure ends. Otherwise, if at least one first hash code does not match the second hash code corresponding to the first hash code, the procedure goes to step 106.
In step S04, the monitoring module 100 determines that the record list 20 has been updated.
In step S108, the monitoring module 100 obtains a type of each updated file in the record list. The type of each updated file may be, but is not limited to, an uploading type, a deleting type and a downloading type. The uploading type indicates that the file has been uploaded into the server 2, the deleting type indicates that the file has been deleted from the server 2, the downloading type indicates that the file has been downloaded from the server 2.
In step S110, the monitoring module 100 saves the name of each updated object, the name of each updated file in the object, and the type of each updated file into the record list 20.
Although certain inventive embodiments of the present disclosure have been specifically described, the present disclosure is not to be construed as being limited thereto. Various changes or modifications may be made to the present disclosure without departing from the scope and spirit of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
2012103879454 | Oct 2012 | CN | national |