CN114281779A - Data synchronization method and device, computer equipment and storage medium - Google Patents

Data synchronization method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114281779A
CN114281779A CN202111453323.2A CN202111453323A CN114281779A CN 114281779 A CN114281779 A CN 114281779A CN 202111453323 A CN202111453323 A CN 202111453323A CN 114281779 A CN114281779 A CN 114281779A
Authority
CN
China
Prior art keywords
change
file
version number
file list
target
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.)
Pending
Application number
CN202111453323.2A
Other languages
Chinese (zh)
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.)
Guangzhou Chooseme Information Technology Co ltd
Original Assignee
Guangzhou Chooseme Information Technology Co 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 Guangzhou Chooseme Information Technology Co ltd filed Critical Guangzhou Chooseme Information Technology Co ltd
Priority to CN202111453323.2A priority Critical patent/CN114281779A/en
Publication of CN114281779A publication Critical patent/CN114281779A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention relates to the technical field of data synchronization, and provides a data synchronization method, a data synchronization device, computer equipment and a storage medium. The data synchronization method comprises the following steps: when the index information of a file is monitored to be changed, a change record of the index information is obtained, the change record is stored in a pre-constructed file list, the original version number of the file list is updated to obtain a change version number, the change version number is stored in the pre-constructed version list, when the index information of a target device needing to synchronize the file is monitored, the version number of the file list adopted by the target device in the last synchronization is obtained, whether the version number is consistent with the change version number is judged, if not, the file list corresponding to the change version number is obtained, the target file list is obtained, and the target file list is sent to the target device, so that the target device completes synchronous change according to the change record of the target file list, the synchronization of the index information among multiple devices is simplified, and the synchronization efficiency is improved.

Description

Data synchronization method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of data synchronization technologies, and in particular, to a data synchronization method and apparatus, a computer device, and a storage medium.
Background
In a conventional file indexing technology, files correspond to indexes one by one, one file corresponds to one index information, and when a file is changed (for example, a file name is modified, a file directory is moved, or a file is deleted), the index information of the file is directly modified. In this direct modification method, since no corresponding record is generated during the index modification operation, the operation is difficult when the index information is synchronized among multiple devices, and the synchronization efficiency is low.
Disclosure of Invention
The invention provides a data synchronization method, a data synchronization device, computer equipment and a storage medium, which are used for simplifying the synchronization of index information among multiple pieces of equipment and improving the synchronization efficiency.
In a first aspect, the present invention provides a data synchronization method, including the following steps:
when the index information of a file is monitored to be changed, obtaining a change record of the index information;
storing the change record into a pre-constructed file list, updating an original version number of the file list to obtain a change version number, and storing the change version number into a pre-constructed version list; the file list is used for storing change records generated when a user changes a file, and the version list is used for storing the version number of the file list;
when it is monitored that the target device needs to synchronize the index information of the file, acquiring the version number of a file list adopted by the target device in the last synchronization, and judging whether the version number is consistent with the change version number;
if not, acquiring a file list corresponding to the change version number, acquiring a target file list, and sending the target file list to the target equipment so that the target equipment completes synchronous change according to the change record of the target file list.
Further, before the step of storing the change record in a pre-constructed file list, the method further includes:
acquiring the change type of the file;
constructing a corresponding file list according to the change type of the file; wherein, each file list correspondingly stores a change record of a change type.
Preferably, the change type includes a new file, a new folder, a modified file name, or a deleted file.
Further, after the step of determining whether the version number is consistent with the change version number, the method further includes:
when the version number of a file list adopted by the target equipment in last synchronization is judged to be smaller than the change version number, deleting the synchronization file of the target equipment, executing to obtain a file list corresponding to the change version number to obtain a target file list, and sending the target file list to the target equipment so that the target equipment completes the step of synchronous change according to the change record of the target file list; the synchronous file is a file which needs to be synchronously changed when the target equipment is synchronized last time.
Preferably, the step of completing the synchronous change according to the change record of the target file list includes:
extracting the change type of the file from the change record;
when the change type is determined to be a deleted file, deleting the synchronous file of the target equipment, and recording the version number of the deleted synchronous file;
and when the change type is determined to be a new file, the file is newly built on the target equipment, and the version number of the newly built file is recorded.
Preferably, the step of updating the original version number of the file list to obtain a modified version number includes:
and updating the original version number of the file list once when monitoring that the file list stores one change record every time to obtain a change version number.
Further, after the step of determining whether the version number is consistent with the change version number, the method further includes:
and when the version number is judged to be consistent with the change version number, synchronous change of the target equipment is not required.
In a second aspect, the present invention provides a data synchronization apparatus, including:
the acquisition module is used for acquiring a change record of index information when the change of the index information of a file is monitored;
the storage module is used for storing the change records into a pre-constructed file list, updating the original version number of the file list to obtain a change version number, and storing the change version number into the pre-constructed version list; the file list is used for storing change records generated when a user changes a file, and the version list is used for storing the version number of the file list;
the judging module is used for acquiring the version number of a file list adopted by the target equipment in last synchronization when the situation that the target equipment needs to synchronize the index information of the file is monitored, and judging whether the version number is consistent with the change version number or not;
and the sending module is used for acquiring a file list corresponding to the change version number when the version number is judged to be inconsistent with the change version number, obtaining a target file list, and sending the target file list to the target equipment so that the target equipment completes synchronous change according to the change record of the target file list.
In a third aspect, the invention provides a computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of the data synchronization method as defined in any one of the above.
In a fourth aspect, the present invention provides a storage medium having a computer program stored thereon, the computer program, when executed by a processor, implementing the data synchronization method as described in any one of the above.
Compared with the prior art, the technical scheme of the invention at least has the following advantages:
the invention provides a data synchronization method, a device, a computer device and a storage medium, when monitoring that the index information of a file is changed, acquiring the change record of the index information, storing the change record into a pre-constructed file list, updating the original version number of the file list to obtain a change version number, storing the change version number into the pre-constructed version list, when monitoring that the target device needs to synchronize the index information of the file, acquiring the version number of the file list adopted by the target device during last synchronization, judging whether the version number is consistent with the change version number, if not, acquiring the file list corresponding to the change version number to obtain the target file list, sending the target file list to the target device to enable the target device to complete synchronous change according to the change record of the target file list, thereby managing the change records of all files by using the file list, the version list is used for managing the change version number of the file list, when the equipment needs synchronous change, the change record is quickly found according to the file list and the version list, and the target equipment is synchronously changed, so that the synchronization of the index information among multiple equipment is simplified, and the synchronization efficiency is improved.
Drawings
FIG. 1 is a block flow diagram of one embodiment of a data synchronization method of the present invention;
FIG. 2 is a block diagram of a data synchronization apparatus according to an embodiment of the present invention;
fig. 3 is a block diagram showing an internal configuration of a computer device according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention.
In some of the flows described in the present specification and claims and in the above-described figures, a number of operations are included that occur in a particular order, but it should be clearly understood that these operations may be performed out of order or in parallel as they occur herein, with the order of the operations being numbered, e.g., S11, S12, etc., merely to distinguish between various operations, and the order of the operations by themselves is not meant to imply any order of execution. Additionally, the flows may include more or fewer operations, and the operations may be performed sequentially or in parallel. It should be noted that, the descriptions of "first", "second", etc. in this document are used for distinguishing different messages, devices, modules, etc., and do not represent a sequential order, nor limit the types of "first" and "second" to be different.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
It will be understood by those of ordinary skill in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a data synchronization method provided by the present invention uses a computer device as an execution main body, and is used for solving a problem that in a conventional file indexing technology, when a file is changed, the index information of the file is directly modified. The direct modification mode has the technical problems that the modification operation of the index does not generate corresponding records, the operation is difficult when the index information is synchronized among multiple devices, and the synchronization efficiency is low. In one embodiment, the data synchronization method includes the steps of:
s11, when the index information of the file is monitored to be changed, obtaining a change record of the index information;
s12, storing the change records into a pre-constructed file list, updating the original version number of the file list to obtain a change version number, and storing the change version number into the pre-constructed version list; the file list is used for storing change records generated when a user changes a file, and the version list is used for storing the version number of the file list;
s13, when it is monitored that the target device needs to synchronize the index information of the file, acquiring the version number of a file list adopted by the target device in the last synchronization, and judging whether the version number is consistent with the change version number;
and S14, if not, acquiring a file list corresponding to the change version number to obtain a target file list, and sending the target file list to the target equipment so that the target equipment completes synchronous change according to the change record of the target file list.
In this embodiment, in order to solve the problem of file index synchronization among multiple devices and record the change records of files, when it is monitored that the index information of any file is changed, the embodiment may initialize a file list for storing the change records generated when a user changes the file, so that the index information is not directly modified, but a change record of the index information is generated and the change record is recorded in the file list; wherein, the change record stores the changed index information. When other equipment needs to synchronize the index information of the file, the synchronization can be completed only by acquiring new file index information from the address of the index information of the file acquired last time, so that the synchronization process is simplified, and the synchronization efficiency is improved.
Specifically, when the computer device monitors that the index information of the file is changed, for example, a new file, a new folder, a modified file name, a deleted file or a reconstructed file list and the like, the computer device obtains a change record of the index information, stores the change record into a pre-constructed file list, updates an original version number of the file list to obtain a change version number, and stores the change version number into a pre-constructed version list. For example, when a user modifies a file name, a modification record for modifying the file name is generated, the record is recorded in a file list, an original version number of the file list is acquired, the original version number is updated to obtain a modified version number, and the modified version number is used as a new version number of the file list. When updating, 1 can be added on the basis of the original version number as a modified version number, and if the original version number is a first version, the modified version number is a second version.
When the target equipment needs to synchronize the index information of the file, the version number of a file list adopted by the target equipment in the last synchronization is obtained, whether the version number is consistent with the change version number is judged, if yes, synchronous change is not needed to the target equipment, if not, the file list corresponding to the change version number is obtained, the target file list is obtained, and the target file list is sent to the target equipment, so that the target equipment completes synchronous change according to the change record of the target file list. For example, when the file of the computer device completes the change of the modified file name, a change record of the modified file name is generated and stored in the target file list, and the target device modifies the file name of the file according to the change record of the target file list to complete the synchronous change.
The following takes the example of a reconstructed file list: when the modified version number of the file list of the server is larger than the version number of the file list of the target device, the target device needs to reset the local file list, and then pulls the target file list from the server again, so that the effect that the version data information of the local file list and the version data information of the file list of the server are consistent is achieved.
The version list is a record of the version of the entire file list of the user, and mainly stores the version number of the change of the target file list and the version number of the current file list. The change version number is the total version of the latest file list.
The file list mainly records user operation records on files, wherein the record records specify some types and some operation information, such as: create files, create folders, rename, delete files, etc. The information recorded in the file list is information about specific operations of the user on the file, and the information plays an important role in guiding the operation record of tracing the file and can also expand a lot of information.
The data synchronization method provided by the invention comprises the steps of acquiring the change record of index information when the change of the index information of a file is monitored, storing the change record into a pre-constructed file list, updating the original version number of the file list to obtain a change version number, storing the change version number into the pre-constructed version list, acquiring the version number of the file list adopted by target equipment during the last synchronization when the index information of the file is monitored to be synchronized by the target equipment, judging whether the version number is consistent with the change version number, if not, acquiring the file list corresponding to the change version number to obtain a target file list, sending the target file list to the target equipment so that the target equipment completes the synchronous change according to the change record of the target file list, managing the change records of all files by using the file list, managing the change version number of the file list by using the version list, when the equipment needs to be synchronously changed, the change records are quickly found according to the file list and the version list, and the target equipment is synchronously changed, so that the synchronization of the index information among the multiple equipment is simplified, and the synchronization efficiency is improved.
Further, before the step of storing the change record in a pre-constructed file list, the method may further include:
acquiring the change type of the file;
constructing a corresponding file list according to the change type of the file; wherein, each file list correspondingly stores a change record of a change type.
The embodiment acquires the change type of the file; preferably, the change types include a new file, a new folder, a modified file name, or a deleted file, a corresponding file list is constructed according to the change types of the files, and each file list correspondingly stores a change record of one change type. For example, when a user modifies a file name of a file, a file list storing change records of a change type of the modified file name is constructed, so that management of the change records is facilitated, and data search is facilitated.
Further, after the step of determining whether the version number is consistent with the change version number, the method may further include:
when the version number of a file list adopted by the target equipment in last synchronization is judged to be smaller than the change version number, deleting the synchronization file of the target equipment, executing to obtain a file list corresponding to the change version number to obtain a target file list, and sending the target file list to the target equipment so that the target equipment completes the step of synchronous change according to the change record of the target file list; the synchronous file is a file which needs to be synchronously changed when the target equipment is synchronized last time.
In this embodiment, the version number of the file list adopted by the target device in the last synchronization is obtained, the version number of the file list adopted in the last synchronization is compared with the change version number to obtain a comparison result, when it is determined according to the comparison result that the version number of the file list adopted in the last synchronization of the target device is smaller than the change version number, the synchronization file of the target device is deleted, the synchronization file is a file that needs to be synchronously changed in the last synchronization of the target device, the file list corresponding to the change version number is obtained, the target file list is obtained, and the target file list is sent to the target device, so that the target device completes the synchronous change according to the change record of the target file list, and the timely synchronous change of the target device is realized.
For example, when the version number of the file list adopted in the last synchronization of the target device is the first version, the file list in the server is inquired, and the latest change version number is determined to be the second version, the file list with the version number of the target device being the first version is deleted, the file list with the change version number being the second version is pulled from the server, the target file list is obtained, and the synchronous change is completed by using the change record of the target file list.
In an embodiment, the step of completing the synchronous change according to the change record of the target file list may specifically include:
extracting the change type of the file from the change record;
when the change type is determined to be a deleted file, deleting the synchronous file of the target equipment, and recording the version number of the deleted synchronous file;
and when the change type is determined to be a new file, the file is newly built on the target equipment, and the version number of the newly built file is recorded.
In this embodiment, the version number of the target device is compared with the change version number of the server, if the version number of the target device is smaller than the change version number of the server, the file list of the target device needs to be completely cleared, the entire file list corresponding to the change version number is pulled from the server again to obtain a target file list, a change record is extracted from the target file list, the change type of the file is extracted from the change record, when the change type is determined to be a deleted file, the synchronization file of the target device is deleted, the version number of the deleted synchronization file is recorded, when the change type is determined to be a new file, the file is newly created at the target device, and the version number of the newly created file is recorded, so that the version number of the target device and the change version number of the server are kept consistent.
In an embodiment, the step of updating the original version number of the file list to obtain a modified version number may specifically include:
and updating the original version number of the file list once when monitoring that the file list stores one change record every time to obtain a change version number.
In this embodiment, when it is monitored that each time a change record is stored in the file list, the original version number of the file list is updated once, so as to obtain a change version number. For example, when it is monitored that the file list is stored in a change record, the original version number of the file list is obtained, 1 may be added on the basis of the original version number as a change version number, and if the original version number is a first version, the change version number is a second version.
Further, after the step of determining whether the version number is consistent with the change version number, the method may further include:
and when the version number is judged to be consistent with the change version number, synchronous change of the target equipment is not required.
In this embodiment, when the version number is determined to be consistent with the change version number, synchronous change of the target device is not required, until the version number is determined to be inconsistent with the change version number, the file list with the largest version number is pulled from the server to obtain a target file list, and the target file list is sent to the target device, so that the target device completes synchronous change according to the change record of the target file list. For example, when the file of the computer device completes the change of the modified file name, a change record of the modified file name is generated and stored in the target file list, and the target device modifies the file name of the file according to the change record of the target file list to complete the synchronous change.
Referring to fig. 2, an embodiment of the present invention further provides a data synchronization apparatus, and in an embodiment, the data synchronization apparatus includes an obtaining module 11, a storing module 12, a determining module 13, and a sending module 14. Wherein the content of the first and second substances,
the acquisition module 11 is configured to acquire a change record of index information when it is monitored that the index information of a file is changed;
the storage module 12 is configured to store the change record in a pre-constructed file list, update an original version number of the file list to obtain a change version number, and store the change version number in the pre-constructed version list; the file list is used for storing change records generated when a user changes a file, and the version list is used for storing the version number of the file list;
the judging module 13 is configured to, when it is monitored that the target device needs to synchronize the index information of the file, obtain a version number of a file list adopted by the target device in last synchronization, and judge whether the version number is consistent with the change version number;
and a sending module 14, configured to, when it is determined that the version number is not consistent with the change version number, obtain a file list corresponding to the change version number, obtain a target file list, and send the target file list to the target device, so that the target device completes a synchronous change according to a change record of the target file list.
In this embodiment, in order to solve the problem of file index synchronization among multiple devices and record the change records of files, when it is monitored that the index information of any file is changed, the embodiment may initialize a file list for storing the change records generated when a user changes the file, so that the index information is not directly modified, but a change record of the index information is generated and the change record is recorded in the file list; wherein, the change record stores the changed index information. When other equipment needs to synchronize the index information of the file, the synchronization can be completed only by acquiring new file index information from the address of the index information of the file acquired last time, so that the synchronization process is simplified, and the synchronization efficiency is improved.
Specifically, when the computer device monitors that the index information of the file is changed, for example, a new file, a new folder, a modified file name, a deleted file or a reconstructed file list and the like, the computer device obtains a change record of the index information, stores the change record into a pre-constructed file list, updates an original version number of the file list to obtain a change version number, and stores the change version number into a pre-constructed version list. For example, when a user modifies a file name, a modification record for modifying the file name is generated, the record is recorded in a file list, an original version number of the file list is acquired, the original version number is updated to obtain a modified version number, and the modified version number is used as a new version number of the file list. When updating, 1 can be added on the basis of the original version number as a modified version number, and if the original version number is a first version, the modified version number is a second version.
When the target equipment needs to synchronize the index information of the file, the version number of a file list adopted by the target equipment in the last synchronization is obtained, whether the version number is consistent with the change version number is judged, if yes, synchronous change is not needed to the target equipment, if not, the file list corresponding to the change version number is obtained, the target file list is obtained, and the target file list is sent to the target equipment, so that the target equipment completes synchronous change according to the change record of the target file list. For example, when the file of the computer device completes the change of the modified file name, a change record of the modified file name is generated and stored in the target file list, and the target device modifies the file name of the file according to the change record of the target file list to complete the synchronous change.
The following takes the example of a reconstructed file list: when the modified version number of the file list of the server is larger than the version number of the file list of the target device, the target device needs to reset the local file list, and then pulls the target file list from the server again, so that the effect that the version data information of the local file list and the version data information of the file list of the server are consistent is achieved.
The version list is a record of the version of the entire file list of the user, and mainly stores the version number of the change of the target file list and the version number of the current file list. The change version number is the total version of the latest file list.
The file list mainly records user operation records on files, wherein the record records specify some types and some operation information, such as: create files, create folders, rename, delete files, etc. The information recorded in the file list is information about specific operations of the user on the file, and the information plays an important role in guiding the operation record of tracing the file and can also expand a lot of information.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
The invention provides a computer device comprising a memory and a processor, wherein the memory stores computer readable instructions, and the computer readable instructions, when executed by the processor, cause the processor to execute the steps of the data synchronization method as described in any one of the above.
In one embodiment, as shown in FIG. 3. The computer device described in this embodiment may be a server, a personal computer, a network device, and other devices. The computer apparatus includes a processor 302, a memory 303, a camera, an input unit 304, a display unit 305, and the like. Those skilled in the art will appreciate that the device configuration means shown in fig. 3 do not constitute a limitation of all devices and may include more or less components than those shown, or some components in combination. For example, in most cases, the computer device need not be equipped with the display unit 305. The memory 303 may be used to store the computer program 301 and the functional modules, and the processor 302 executes the computer program 301 stored in the memory 303, thereby performing various functional applications of the device and data processing. The memory may be internal or external memory, or include both internal and external memory. The memory may comprise read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), flash memory, or random access memory. The external memory may include a hard disk, a floppy disk, a ZIP disk, a usb-disk, a magnetic tape, etc. The disclosed memory includes, but is not limited to, these types of memory. The disclosed memory is by way of example only and not by way of limitation.
The input unit 304 is used for receiving input of signals and receiving keywords input by a user. The input unit 304 may include a touch panel and other input devices. The touch panel can collect touch operations of a user on or near the touch panel (for example, operations of the user on or near the touch panel by using any suitable object or accessory such as a finger, a stylus and the like) and drive the corresponding connecting device according to a preset program; other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., play control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like. The display unit 305 may be used to display information input by a user or information provided to a user and various menus of a computer apparatus. The display unit 305 may take the form of a liquid crystal display, an organic light emitting diode, or the like. The processor 302 is a control center of the computer device, connects various parts of the entire computer using various interfaces and lines, and performs various functions and processes data by operating or executing software programs and/or modules stored in the memory 302 and calling data stored in the memory.
As one embodiment, the computer device includes: one or more processors 302, a memory 303, one or more computer programs 301, wherein the one or more computer programs 301 are stored in the memory 303 and configured to be executed by the one or more processors 302, the one or more computer programs 301 being configured to perform the data synchronization method of the above embodiments.
In one embodiment, the present invention also provides a storage medium storing computer-readable instructions which, when executed by one or more processors, cause the one or more processors to perform the above-described data synchronization method. For example, the storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
It will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program, which may be stored in a storage medium and executed by a computer, and the processes of the embodiments of the methods may be included. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
The embodiment is combined to show that the invention has the following maximum beneficial effects:
the invention provides a data synchronization method, a device, a computer device and a storage medium, when monitoring that the index information of a file is changed, acquiring the change record of the index information, storing the change record into a pre-constructed file list, updating the original version number of the file list to obtain a change version number, storing the change version number into the pre-constructed version list, when monitoring that the target device needs to synchronize the index information of the file, acquiring the version number of the file list adopted by the target device during last synchronization, judging whether the version number is consistent with the change version number, if not, acquiring the file list corresponding to the change version number to obtain the target file list, sending the target file list to the target device to enable the target device to complete synchronous change according to the change record of the target file list, thereby managing the change records of all files by using the file list, the version list is used for managing the change version number of the file list, when the equipment needs synchronous change, the change record is quickly found according to the file list and the version list, and the target equipment is synchronously changed, so that the synchronization of the index information among multiple equipment is simplified, and the synchronization efficiency is improved.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of data synchronization, comprising:
when the index information of a file is monitored to be changed, obtaining a change record of the index information;
storing the change record into a pre-constructed file list, updating an original version number of the file list to obtain a change version number, and storing the change version number into a pre-constructed version list; the file list is used for storing change records generated when a user changes a file, and the version list is used for storing the version number of the file list;
when it is monitored that the target device needs to synchronize the index information of the file, acquiring the version number of a file list adopted by the target device in the last synchronization, and judging whether the version number is consistent with the change version number;
if not, acquiring a file list corresponding to the change version number, acquiring a target file list, and sending the target file list to the target equipment so that the target equipment completes synchronous change according to the change record of the target file list.
2. The data synchronization method of claim 1, wherein the step of storing the change record in a pre-built file list is preceded by the step of:
acquiring the change type of the file;
constructing a corresponding file list according to the change type of the file; wherein, each file list correspondingly stores a change record of a change type.
3. The data synchronization method of claim 2, wherein the change type comprises a new file, a new folder, a modified file name, or a deleted file.
4. The data synchronization method according to claim 1, wherein after the step of determining whether the version number is consistent with the change version number, the method further comprises:
when the version number of a file list adopted by the target equipment in last synchronization is judged to be smaller than the change version number, deleting the synchronization file of the target equipment, executing to obtain a file list corresponding to the change version number to obtain a target file list, and sending the target file list to the target equipment so that the target equipment completes the step of synchronous change according to the change record of the target file list; the synchronous file is a file which needs to be synchronously changed when the target equipment is synchronized last time.
5. The data synchronization method of claim 4, wherein the step of completing the synchronized change according to the change log of the target file list comprises:
extracting the change type of the file from the change record;
when the change type is determined to be a deleted file, deleting the synchronous file of the target equipment, and recording the version number of the deleted synchronous file;
and when the change type is determined to be a new file, the file is newly built on the target equipment, and the version number of the newly built file is recorded.
6. The data synchronization method according to claim 1, wherein the step of updating the original version number of the file list to obtain a modified version number comprises:
and updating the original version number of the file list once when monitoring that the file list stores one change record every time to obtain a change version number.
7. The data synchronization method according to claim 1, wherein after the step of determining whether the version number is consistent with the change version number, the method further comprises:
and when the version number is judged to be consistent with the change version number, synchronous change of the target equipment is not required.
8. A data synchronization apparatus, comprising:
the acquisition module is used for acquiring a change record of index information when the change of the index information of a file is monitored;
the storage module is used for storing the change records into a pre-constructed file list, updating the original version number of the file list to obtain a change version number, and storing the change version number into the pre-constructed version list; the file list is used for storing change records generated when a user changes a file, and the version list is used for storing the version number of the file list;
the judging module is used for acquiring the version number of a file list adopted by the target equipment in last synchronization when the situation that the target equipment needs to synchronize the index information of the file is monitored, and judging whether the version number is consistent with the change version number or not;
and the sending module is used for acquiring a file list corresponding to the change version number when the version number is judged to be inconsistent with the change version number, obtaining a target file list, and sending the target file list to the target equipment so that the target equipment completes synchronous change according to the change record of the target file list.
9. A computer device comprising a memory and a processor, the memory having stored therein computer-readable instructions which, when executed by the processor, cause the processor to perform the steps of the data synchronization method of any one of claims 1 to 7.
10. A storage medium on which a computer program is stored, which, when executed by a processor, implements a data synchronization method as claimed in any one of claims 1 to 7.
CN202111453323.2A 2021-12-01 2021-12-01 Data synchronization method and device, computer equipment and storage medium Pending CN114281779A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111453323.2A CN114281779A (en) 2021-12-01 2021-12-01 Data synchronization method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111453323.2A CN114281779A (en) 2021-12-01 2021-12-01 Data synchronization method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114281779A true CN114281779A (en) 2022-04-05

Family

ID=80870446

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111453323.2A Pending CN114281779A (en) 2021-12-01 2021-12-01 Data synchronization method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114281779A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115344585A (en) * 2022-08-03 2022-11-15 盐城金堤科技有限公司 Data version management method and device, storage medium and electronic equipment
CN116527691A (en) * 2023-06-27 2023-08-01 天津中远海运散运数字科技有限公司 Method, device, equipment and medium for synchronizing ship-shore data
CN117112508A (en) * 2023-10-20 2023-11-24 杭州美创科技股份有限公司 File synchronization method and device based on serial numbers, computer equipment and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115344585A (en) * 2022-08-03 2022-11-15 盐城金堤科技有限公司 Data version management method and device, storage medium and electronic equipment
CN115344585B (en) * 2022-08-03 2024-03-19 盐城天眼察微科技有限公司 Data version management method and device, storage medium and electronic equipment
CN116527691A (en) * 2023-06-27 2023-08-01 天津中远海运散运数字科技有限公司 Method, device, equipment and medium for synchronizing ship-shore data
CN116527691B (en) * 2023-06-27 2023-11-03 天津中远海运散运数字科技有限公司 Method, device, equipment and medium for synchronizing ship-shore data
CN117112508A (en) * 2023-10-20 2023-11-24 杭州美创科技股份有限公司 File synchronization method and device based on serial numbers, computer equipment and storage medium
CN117112508B (en) * 2023-10-20 2024-02-06 杭州美创科技股份有限公司 File synchronization method and device based on serial numbers, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN114281779A (en) Data synchronization method and device, computer equipment and storage medium
EP3103025B1 (en) Content based organization of file systems
US10108543B1 (en) Efficient physical garbage collection using a perfect hash vector
JP6995894B2 (en) Systems and methods to restore database datasets at some point in time
CN109739815B (en) File processing method, system, device, equipment and storage medium
US20150302111A1 (en) Method and Apparatus for Constructing File System in Key-Value Storage System, and Electronic Device
JP6521402B2 (en) Method for updating data table of KeyValue database and apparatus for updating table data
CN102360410B (en) User operation discovery method of file system and synchronous system utilizing the same
AU2013210018B2 (en) Location independent files
WO2015117426A1 (en) File management method and device
JPH1049414A (en) Device and method for version management
CN110998537B (en) Expired backup processing method and backup server
CN110928498B (en) Directory traversal method, device, equipment and storage medium
KR20140121166A (en) Terminal and method providing application-related data
CN109558382B (en) File management method, electronic device and computer-readable storage medium
US9037539B2 (en) Data synchronization
US20220222146A1 (en) Versioned backup on an object addressable storage system
CN109558270A (en) Method and apparatus, the method and apparatus of data convert of data backup
CN110659295B (en) Method, apparatus and medium for recording valid data based on HAWQ
CN103645967B (en) A kind of read-only materialized view rollback method and device
US9367573B1 (en) Methods and apparatus for archiving system having enhanced processing efficiency
JP2015176407A (en) Search device, search method, search program and search data structure
JP6313987B2 (en) File management program, file management method, and file management system
CN108614838B (en) User group index processing method, device and system
CN111324483B (en) Data recovery method and device and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination