CN110990360A - File synchronization method based on network storage device and related components - Google Patents

File synchronization method based on network storage device and related components Download PDF

Info

Publication number
CN110990360A
CN110990360A CN201911228722.1A CN201911228722A CN110990360A CN 110990360 A CN110990360 A CN 110990360A CN 201911228722 A CN201911228722 A CN 201911228722A CN 110990360 A CN110990360 A CN 110990360A
Authority
CN
China
Prior art keywords
synchronization
file
network storage
directory
synchronous
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
CN201911228722.1A
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.)
Shenzhen Xunlei Network Technology Co Ltd
Original Assignee
Shenzhen Xunlei Network 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 Shenzhen Xunlei Network Technology Co Ltd filed Critical Shenzhen Xunlei Network Technology Co Ltd
Priority to CN201911228722.1A priority Critical patent/CN110990360A/en
Publication of CN110990360A publication Critical patent/CN110990360A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques 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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a file synchronization method based on network storage equipment, after synchronization information is updated, equipment synchronization directory information and local synchronization directory information are obtained through a client, file change comparison analysis is carried out, user operation behaviors are analyzed, corresponding synchronization operations at two ends are carried out, complex synchronization service logic is handed to the client to be carried out, high-quality operation that powerful hardware facilities of the client support synchronization services is called, work of the network storage equipment is simplified, task pressure of the network storage equipment is relieved, task execution effects are guaranteed, and service quality is improved. The application also provides a file synchronization device based on the network storage equipment, the client equipment, a file synchronization method based on the network storage equipment, a device, the network storage equipment, a file synchronization system based on the network storage equipment and a readable storage medium, which are applied to the client, and the beneficial effects are achieved.

Description

File synchronization method based on network storage device and related components
Technical Field
The present application relates to the field of electronic technologies, and in particular, to a method and an apparatus for synchronizing files based on a network storage device for a client, a client device, a method and an apparatus for synchronizing files based on a network storage device for a network storage device, a system for synchronizing files based on a network storage device, and a computer-readable storage medium.
Background
With the continuous increase of disk storage capacity and the mass production of private data (such as photos, videos and the like), network storage devices like personal NAS continuously enter the families of ordinary users to build a private cloud storage service. Compared with the network disk service stored by the same cloud disk, the network storage device has no problem of private data loss or secret leakage, and has strong safety; the bandwidth is consistent with the home routing, the limitation of the bandwidth is avoided, and the fast data transmission speed can be ensured; in addition, the network storage equipment only needs the expense of one-time purchase, no additional service expense is needed in the follow-up process, and the use cost is controllable. Therefore, network storage devices are widely used in multi-service scenarios such as home data storage and enterprise data storage.
The files changed by the mobile phone or the PC terminal need to be synchronized to the network storage device, the files changed by the network storage device need to be synchronized to the terminal, the user creates a new file in the specified directory through the PC application, then the network storage device also needs to create a new same file for synchronization, and similarly, after the network storage device creates the new file, the PC end also needs to do the same processing, so that the requirement of file synchronization between the user terminal device and the network storage device is naturally generated.
However, the current use of personal network storage devices to provide synchronization services has the following problems: personal network storage equipment is limited by a CPU, a memory, a disk IO and the like of single equipment, the hardware performance is relatively weak, too high file processing capacity and complex synchronization strategies cannot be borne, and the user experience is poor when a large amount of data synchronously operates the network storage equipment and the conditions such as jamming, synchronization failure and the like easily occur.
Therefore, how to overcome the problem of limited data synchronization service quality caused by relatively weak hardware performance of the existing network storage device is a problem to be solved urgently by those skilled in the art.
Disclosure of Invention
The application aims to provide a file synchronization method and device based on a network storage device applied to a client, the client device, a file synchronization method and device based on a network storage device applied to a network storage device, a file synchronization system based on a network storage device and a computer readable storage medium, and aims to solve the problem that the data synchronization service quality is limited due to the fact that the hardware performance of the existing network storage device is relatively weak.
In order to achieve the above object, the present application provides a file synchronization method based on a network storage device, which is applied to a client, and the method includes:
the client acquires the synchronous directory information of the network storage device as the device synchronous directory information;
generating local synchronous directory information according to the structure and the content of the local synchronous directory;
performing file modification comparison analysis according to the local synchronous directory information and the equipment synchronous directory information to obtain a file sequence to be synchronized;
and carrying out file synchronization operation on the network storage equipment and/or the local machine according to the file sequence to be synchronized.
Optionally, the generating local synchronization directory information according to the structure and content of the local synchronization directory includes:
determining files and directories which are changed in the synchronous directory;
recalculating the changed value of the MD5 according to the content of the file;
according to names corresponding to the MD5 value splicing of all subfiles and subdirectories under the directory, recalculating the MD5 value of the changed directory;
and constructing an MD5 information tree according to all files and directories under the synchronous directory to serve as the local synchronous directory information.
Optionally, the file synchronization method based on the network storage device further includes:
monitoring a synchronous directory on a disk;
when the synchronization directory changes, the step of determining a changed object in the synchronization directory is performed.
Optionally, performing file modification comparison analysis on the local synchronization directory information and the device synchronization directory information to obtain a file sequence to be synchronized, including:
determining the last synchronous directory information; the last synchronous directory information is unified synchronous directory information in last file synchronization;
comparing and analyzing the local synchronous directory information with the last synchronous directory information to obtain local change of the local synchronous directory relative to the local synchronous directory after the last synchronization is completed;
comparing and analyzing the equipment synchronization directory information with the last synchronization directory information to obtain the equipment change of the equipment synchronization directory relative to the equipment change after the last synchronization is completed;
and taking the local change as a file sequence to be synchronized of the network storage equipment, and taking the equipment change as the file sequence to be synchronized of the client.
The application discloses file synchronizer based on network storage device is applied to customer premise equipment, includes:
the device synchronization information acquisition unit is used for acquiring the synchronization directory information of the network storage device as the device synchronization directory information;
the local synchronous information acquisition unit is used for generating local synchronous directory information according to the structure and the content of a local synchronous directory;
the information comparison and analysis unit is used for carrying out file modification comparison and analysis according to the local synchronous directory information and the equipment synchronous directory information to obtain a file sequence to be synchronized;
and the synchronous operation unit is used for carrying out file synchronous operation on the network storage equipment and/or the local computer according to the file sequence to be synchronized.
The application discloses client device includes:
a memory for storing a computer program;
and the processor is used for realizing the file synchronization method based on the network storage device when executing the computer program.
The application discloses a file synchronization method based on network storage equipment, which is applied to the network storage equipment and comprises the following steps:
the network storage equipment generates synchronous directory information according to the structure and the content of the synchronous directory;
receiving a file sequence to be synchronized;
and performing data synchronization updating on the synchronization directory according to the file sequence to be synchronized.
Optionally, the generating, by the network storage device, the synchronization directory information according to the structure and the content of the synchronization directory includes:
when the disk is detected to be inserted again, traversing a disk file system, and determining a changed file and the changed content of the changed file;
and generating synchronous directory information according to the structure and the content of the change file, the change content and the synchronous directory before the change.
The application discloses file synchronizer based on network storage device is applied to network storage device, includes:
the equipment synchronization information generating unit is used for generating synchronization directory information according to the structure and the content of the synchronization directory;
the file sequence receiving unit is used for receiving a file sequence to be synchronized;
and the synchronous updating unit is used for synchronously updating the data of the synchronous directory according to the file sequence to be synchronized.
The application discloses network storage device includes:
a memory for storing a computer program;
and the processor is used for realizing the file synchronization method based on the network storage device applied to the network storage device when executing the computer program.
The application discloses file synchronization system based on network storage equipment includes:
a client device as shown above;
a network storage device as shown above;
the network storage device is connected with the client device.
The application discloses a computer readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the method for network storage device based file synchronization applied to a client and/or the steps of the method for network storage device based file synchronization applied to a network storage device.
The problem that the quality of data synchronization service is limited is easily caused because the hardware performance of general network storage equipment is weak and a lot of services can be operated, and the problem that the resource which can be allocated to synchronization is not enough is caused, according to the file synchronization method based on the network storage equipment provided by the application, the file synchronization method obviously shows that after the update of synchronization information is started, equipment synchronization directory information and local synchronization directory information are obtained through a client, file change comparison analysis is carried out, the operation behavior of a user is analyzed, corresponding synchronization operation at two ends is carried out, complex synchronization service logic is handed to the client to be carried out, the powerful hardware facilities of the client are called to support the high-quality implementation of the synchronization service, the work of the network storage equipment is simplified, the task pressure of the network storage equipment is relieved, the task execution effect is guaranteed, and the file synchronization effect is effectively guaranteed, the service quality is improved.
The application also provides a file synchronization device based on the network storage equipment applied to the client, the client equipment, a file synchronization method based on the network storage equipment applied to the network storage equipment, a device, the network storage equipment, a file synchronization system based on the network storage equipment and a computer readable storage medium, which have the beneficial effects and are not described herein again.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a file synchronization method applied to a client based on a network storage device according to an embodiment of the present application;
fig. 2 is a block diagram illustrating a structure of a file synchronization apparatus based on a network storage device and applied to a client device according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of a client device according to an embodiment of the present application;
fig. 4 is a flowchart of a file synchronization method based on a network storage device, which is applied to the network storage device according to an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating an exemplary implementation of steps provided in an embodiment of the present application;
FIG. 6 is a schematic diagram illustrating another exemplary implementation of the steps provided in the embodiments of the present application;
FIG. 7 is a schematic diagram illustrating another exemplary implementation of the steps provided in the embodiments of the present application;
fig. 8 is a block diagram of a structure of a file synchronization apparatus based on a network storage device, which is applied to the network storage device according to an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit 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.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the description relating to "first", "second", etc. in the present invention is for descriptive purposes only and is not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
When all files in the appointed directories of user terminal equipment such as a PC (personal computer), a mobile phone and the like need to be synchronized into the appointed directory folder of the network storage equipment mounted hard disk; or when the content of the file, the folder or the file in the specified directory of the terminal device changes, the changed content needs to be uploaded to the specified directory corresponding to the network storage device; or, when the content of the file, folder or file in the designated directory of the network storage device changes, the changed content needs to be downloaded to the designated directory corresponding to the terminal device. File synchronization is required in the above scenarios.
The two synchronous parties are a synchronous directory specified by the network storage device and a synchronous directory specified by the user local machine, the network storage device generates synchronous information capable of reflecting the structure and the content of the synchronous directory aiming at the synchronous directory on the device, a client of the user local machine also generates the synchronous information according to the same rule for the synchronous directory of the local machine, then the client acquires the synchronous directory information on the device from the network storage device and carries out comparison analysis, and further obtains the operation to be executed for the synchronization, and once synchronization is completed after all the operations are executed, at this time, the synchronous directory on the network storage device is consistent with the content and the structure of the synchronous directory of the user local machine.
However, the hardware performance of the personal network storage device is relatively weak and limited by a CPU, a memory, a disk IO, and the like of the single network storage device, the personal network storage device cannot bear too high file processing capability and a complex synchronization policy, the supportable service quality is poor, and situations such as blocking, synchronization failure, and the like easily occur. In view of the above situation, the present application provides a file synchronization method based on a network storage device, which calls a strong hardware facility at a client to support high-quality execution of a synchronization service, simplifies work of the network storage device, reduces task pressure of the network storage device, ensures a task execution effect, effectively ensures a file synchronization effect, and improves service quality.
Example one
Referring to fig. 1, fig. 1 is a flowchart of a file synchronization method based on a network storage device according to an embodiment of the present application, and it should be noted that an execution subject of each step in the embodiment is a client, which mainly includes the following steps:
s110: the client acquires the synchronous directory information of the network storage device as the device synchronous directory information;
the client inquires the information of the synchronous directory from the network storage device, the network storage device returns the synchronous information of the directory to the client, and the synchronous directory information essentially represents all file information and directory structure information under the synchronous directory and expresses two parts of information of the structure and the content of the directory.
S120: generating local synchronous directory information according to the structure and the content of the local synchronous directory;
it should be noted that the generation manner of the local synchronization directory information should be consistent with the synchronization directory information of the network storage device side, and accordingly, the local synchronization directory information should also represent all file information and directory structure information under the synchronization directory in the current client side. In this embodiment, a generation manner of the synchronous directory information is not limited, and may cover two parts of information, i.e., a structure and a content of the directory, and optionally, a calculation method of the synchronous directory information is as follows:
s 121: determining files and directories which are changed in the synchronous directory;
s 122: recalculating the changed file MD5(Message-Digest Algorithm 5 information-Digest Algorithm 5) value according to the file content;
s 123: according to names corresponding to the MD5 value splicing of all subfiles and subdirectories under the directory, recalculating the MD5 value of the changed directory;
s 124: an MD5 information tree is constructed from all files and directories under the synchronization directory as local synchronization directory information.
The MD5 value is recalculated for the changed file or directory. Here, the file uses the file content to calculate MD5, and the directory uses all its subfiles/directories MD5 to join the corresponding names to calculate MD5, and this MD5 calculation uses both content and name dimensions to accurately reflect any change in content or name.
Optionally, before step s121, the following steps may be further performed;
s 124: the sync directory on the disk is monitored and when the sync directory changes, s121 is executed.
The network storage device monitors the synchronous directory on the disk, and once the content of the synchronous directory changes, the updating of the synchronous information is triggered immediately, so that the synchronous directory information can be obtained immediately when the file synchronous updating is triggered, and the synchronization delay caused by real-time calculation is avoided.
It should be noted that, when the client and the network storage device need to generate the information of the synchronization directory by using the same information statistical rule with respect to the synchronization directory, that is, if the client generates the local synchronization directory information in the above manner, the synchronization directory information in the corresponding network storage device may construct an MD5 information tree from all files and directories under the synchronization directory according to the above steps, so as to express two parts of information, namely, the structure and the content of the directory at the same time.
The above-mentioned method for generating the synchronization directory can simplify the implementation steps on the basis of ensuring the information coverage is comprehensive, and in this embodiment, only the above-mentioned method for generating the synchronization directory information is described as an example, and other methods for generating the synchronization directory information based on the present application can refer to the description of this embodiment, and are not described herein again.
In addition, the execution sequence of step S110 and step S120 is not limited, step S110 may be executed first, step S120 may be executed first, or both steps may be executed at the same time, the former is taken as an example in fig. 1, and the specific execution sequence may be set according to the actual use requirement.
S130: performing file modification comparison analysis according to the local synchronous directory information and the equipment synchronous directory information to obtain a file sequence to be synchronized;
and analyzing the synchronous directory information of the local and the equipment to finally obtain the operation queue to be executed in the synchronization.
The process of performing file change comparison analysis can compare the synchronous directory information of the local and the equipment to determine a difference point, and then determine which end the difference point originates from by comparing the difference point with the original synchronous directory information or searching the change records of the local and the equipment, so that the difference point can be used as one member of an operation queue which needs to be executed synchronously at the other end; or directly comparing the synchronous directory information at the local and equipment ends with the synchronous directory information updated last time, and exchanging the synchronous directory information as the operation queue to be executed of the other side after determining respective change points. In this embodiment, only the two implementation manners described above are described as examples, and all other implementation manners can refer to the description of this embodiment.
Optionally, an implementation manner of performing file modification comparison analysis on the local synchronization directory information and the device synchronization directory information is as follows:
s 131: determining the last synchronous directory information; the last synchronous directory information is unified synchronous directory information in the last file synchronization;
s 132: comparing and analyzing the local synchronous directory information with the last synchronous directory information to obtain local change of the local synchronous directory relative to the local synchronous directory after the last synchronization is completed;
s 133: comparing and analyzing the equipment synchronization directory information with the last synchronization directory information to obtain the equipment change of the equipment synchronization directory relative to the equipment change after the last synchronization is completed;
s 134: and taking the local modification as a file sequence to be synchronized of the network storage equipment, and taking the equipment modification as a file sequence to be synchronized of the client.
The client compares and analyzes the local synchronous directory information with the last synchronous directory information stored after the last synchronization is completed to obtain the change of the local synchronous directory relative to the change of the local synchronous directory after the last synchronization is completed, and compares and analyzes the equipment synchronous directory information with the last synchronous information to obtain the change of the equipment synchronous directory relative to the change of the equipment synchronous directory after the last synchronization is completed. And combining the local and equipment changes to finally obtain the operation queue to be executed in the synchronization. The comparison of the directory information may be implemented by comparing MD5 value linked lists, which is not limited in this embodiment.
The data comparison amount of the implementation mode is small, efficient comparison execution can be guaranteed, overall implementation efficiency is improved, data sources are reliable, and accurate comparison analysis can be achieved.
In this embodiment, a detailed execution process is described by taking the latter of the two implementation manners as an example, and other implementation manners can refer to the above description, which is not described herein again.
S140: and carrying out file synchronization operation on the network storage device and/or the local computer according to the file sequence to be synchronized.
The file sequence to be synchronized may include a file sequence to be synchronized by the network storage device and a file sequence to be synchronized by the client, and specifically, the file sequence to be synchronized by the network storage device is sent to the network storage device, and the file sequence to be synchronized by the client (i.e., the local machine) is sent to the corresponding synchronization module, so that the network storage device and the client update files according to the corresponding file sequence, where the client executes in sequence according to the synchronization operation queue, and updates the synchronization directory information every time a synchronization operation is successfully completed, or updates the synchronization directory information after all the updates are completed, where no limitation is imposed, and this synchronization is completed after all the operations in the synchronization operation queue are completed.
The implementation process of performing the file synchronization operation according to the synchronization file sequence to be executed may refer to an implementation process in a conventional method, which is not limited in this embodiment.
Based on the above introduction, the file synchronization method based on the network storage device provided in this embodiment obtains the device synchronization directory information and the local synchronization directory information through the client after the synchronization information update is started, performs file modification comparison analysis, analyzes the user operation behavior, performs corresponding synchronization operations at both ends, hands over complex synchronization service logics to the client, and calls a powerful hardware facility of the client to support high-quality execution of the synchronization service, thereby simplifying the work of the network storage device, reducing the task pressure of the network storage device, ensuring the task execution effect, effectively ensuring the file synchronization effect, and improving the service quality.
Example two
Referring to fig. 2, fig. 2 is a block diagram of a structure of a file synchronization apparatus based on a network storage device according to an embodiment of the present application, where the apparatus is applied to a client device, and mainly includes:
the device synchronization information obtaining unit 110 is mainly configured to obtain synchronization directory information of the network storage device as device synchronization directory information;
the local synchronization information obtaining unit 120 is mainly configured to generate local synchronization directory information according to the structure and content of the local synchronization directory;
the information comparison and analysis unit 130 is mainly used for performing file modification comparison and analysis according to the local synchronization directory information and the device synchronization directory information to obtain a file sequence to be synchronized;
the synchronization operation unit 140 is mainly used for performing file synchronization operation on the network storage device and/or the local computer according to a file sequence to be synchronized.
The present embodiment exists as an apparatus embodiment corresponding to the above method embodiment, and the two parts can be referred to each other, and have all the advantages of the method embodiment, which are not described in detail herein.
EXAMPLE III
In the above, detailed description has been made on implementation of file synchronization based on a network storage device to solve the defects in the prior art through some embodiments, the present application further provides an entity hardware device corresponding to the method, a content principle of this portion corresponds to a scheme portion, a portion of the implementation principle is not described herein again, a hardware composition of the entity hardware device is described below, please refer to fig. 3, and fig. 3 is a schematic structural diagram of a client device provided in an embodiment of the present application:
the client device 300 includes a memory 310, a processor 320 and a bus 330, wherein the memory 310 stores a network storage device-based file synchronization program that can run on the processor 320, the network storage device-based file synchronization program is transmitted to the processor 320 through the bus 330, and when being executed by the processor 320, the network storage device-based file synchronization program can implement the steps of the network storage device-based file synchronization method described in the foregoing embodiments.
The memory 310 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, and the like. The memory 310 may in some embodiments be an internal storage unit of the client device 300, such as a hard disk of the electronic device 300. The memory 310 may also be an external storage device of the client device 300 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the client device 300. Further, the memory 310 may also be simultaneously composed of an internal storage unit and an external storage device. Further, the memory 310 may be used not only to store various application software and various types of data installed in the client device 300, but also to temporarily store data that has been output or is to be output.
Processor 320, which in some embodiments may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor or other data Processing chip, executes program code or processes data stored in memory 310, such as a network storage based file synchronization program, etc.
The bus 330 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one bi-directional hollow indicator line is shown in FIG. 3, but does not indicate only one bus or one type of bus.
Example four
Referring to fig. 4, fig. 4 is a flowchart of a file synchronization method based on a network storage device according to an embodiment of the present application, and it should be noted that an execution subject of each step in the embodiment is the network storage device, and the method mainly includes the following steps:
s210: the network storage equipment generates synchronous directory information according to the structure and the content of the synchronous directory;
it should be noted that the manner in which the network storage device and the client device generate the synchronization directory information should be consistent, so that the information comparison is performed quickly, and the manner in which the network storage device generates the synchronization directory information may refer to the process in which the client generates the synchronization directory information in the foregoing embodiment, which is not described herein again.
S220: receiving a file sequence to be synchronized;
the file sequence to be synchronized is sent from the client to the network storage device, where the file sequence to be synchronized includes information related to the file sequence to be synchronized, and the network storage client may directly invoke a file synchronization update thread according to the sequence information to execute the following step S130.
S230: and performing data synchronization update on the synchronization directory according to the file sequence to be synchronized.
In this step, the process of performing data synchronization update by the network storage client may also refer to an implementation manner in a conventional method, which is not described herein again.
It should be noted that, the contents of the two parts of the file synchronization method based on the network storage device provided in this embodiment and the file synchronization method based on the network storage device introduced in this embodiment can be referred to each other, and details of the overlapping part are not described again in this embodiment.
Based on the above introduction, it can be seen that in this embodiment, the network storage device does not need to execute the operation, and only needs to perform corresponding data synchronization update according to the received information, so that the execution logic of the network storage device is simplified, and accordingly, the problem that the data synchronization service quality is limited due to relatively weak hardware performance of the existing network storage device is also overcome.
EXAMPLE five
The disk externally connected to the personal network storage device belongs to consumables, the hard disk is damaged due to long-term read-write operation, the user can take out the externally connected disk to modify the disk file in other places without being in the controllable range of the device, and after the disk is taken out, the conventional network storage device cannot continue the original file synchronization process, so that the normal operation of the file synchronization operation is influenced, and the user experience is poor.
Based on the fourth embodiment, a specific implementation manner that the network storage device generates the synchronization directory information according to the structure and the content of the synchronization directory in step S210 is introduced in this embodiment, so as to solve the above problem.
Specifically, step S210 includes the steps of:
s211: when the disk is detected to be inserted again, traversing the disk file system, and determining a changed file and the changed content of the changed file;
s212: and generating synchronous directory information according to the structure and the content of the change file, the change content and the synchronous directory before the change.
In this embodiment, a user is allowed to take out a disk accessed by the device and modify a file outside the device by himself, after the user reinserts the disk into the NAS device, the NAS background traverses the disk file system, traverses the file system to find out a changed file and calculates an MD5 value of the file content, stores the found changed file and the MD5 value generated by calculation into the database, and synchronizes to the database when the information of modifying the file outside the device is up to the database, so that the client can perform file information comparison and file synchronization with respect to a new database, and still can perform correct file synchronization.
It should be noted that, when a disk plug-in situation occurs in the device to which the client belongs, the file change identification may also be performed according to the processing method based on the network storage device, which is not described in detail in this embodiment.
EXAMPLE six
To deepen understanding of the file synchronization method based on the network storage device, in this embodiment, a flowchart of a file synchronization method including a client and a network storage device is described, where fig. 5 is a schematic diagram of steps 1) to 3), fig. 6 is a schematic diagram of steps 4) to 6), and fig. 7 is a schematic diagram of step 7), and specifically includes the following steps:
1) and the network storage device monitors the synchronous directory on the disk, triggers the updating of the synchronous information once the content of the synchronous directory is changed, and recalculates the MD5 value of the changed file or directory. Here, the file uses the file content to calculate MD5, and the directory uses all its subfiles/directories MD5 to join the corresponding names to calculate MD5, and this MD5 uses both content and name dimensions to accurately reflect any change in content or name.
2) The client inquires the information of the synchronous directory from the device, and the device returns the synchronous information of the directory to the client, wherein the synchronous information is essentially an MD5 information tree constructed by all files and directories under the synchronous directory, and expresses the information of both the structure and the content of the directory.
3) And the client also adopts the same MD5 calculation rule as the equipment for the local synchronous directory to generate the information of the local synchronous directory.
4) And the client compares and analyzes the local synchronous directory information with the last synchronous directory information stored after the last synchronization is completed to obtain the change of the local synchronous directory relative to the local synchronous directory stored after the last synchronization is completed.
5) And similar to the step 4, the client compares and analyzes the equipment synchronization directory information and the last synchronization information to obtain the change of the equipment synchronization directory relative to the change of the equipment synchronization directory after the last synchronization is completed.
6) And combining the local and equipment changes to finally obtain the operation queue to be executed in the synchronization.
7) And the client executes in sequence according to the synchronous operation queue, and updates the last synchronous directory information when one synchronous operation is successfully completed.
8) And after all the operations in the synchronous operation queue are completed, finishing the synchronization.
The file synchronization process based on the network storage device introduced in this embodiment adopts a scheme of a fat client, simplifies the work of the device end, and delivers complex synchronization service logic to the client, so that only necessary synchronization information needs to be provided at the device, the client analyzes and compares the synchronization information, then user operation behaviors are analyzed, and corresponding synchronization operations at two ends are performed, so that the problem that the data synchronization service quality is limited due to the fact that the hardware performance of the existing network storage device is relatively weak can be solved, the overall service quality is improved, and the user experience is improved.
EXAMPLE seven
Referring to fig. 8, fig. 8 is a block diagram of a structure of a file synchronization apparatus based on a network storage device according to an embodiment of the present application, where the apparatus is applied to the network storage device, and mainly includes:
the device synchronization information generating unit 210 is mainly configured to generate synchronization directory information according to the structure and content of a synchronization directory;
the file sequence receiving unit 220 is mainly used for receiving a file sequence to be synchronized;
the synchronization updating unit 230 is mainly used for performing data synchronization updating on the synchronization directory according to the file sequence to be synchronized.
This embodiment exists as an apparatus embodiment corresponding to the four-way method embodiment of the above embodiment, and the two parts can be referred to each other, and have all the advantages of the method embodiment, which are not described in detail herein.
Example eight
The present application further provides an entity hardware apparatus corresponding to the fourth embodiment or the fifth embodiment, where the content principle of this part corresponds to the scheme part, and details of a part implementing the principle are not described here, and the structure of the network storage device provided in the embodiment of the present application may refer to the structure configuration of the client device in the third embodiment, and is not described here again.
Example nine
In this embodiment, a file synchronization system based on a network storage device is introduced, where the system mainly includes: a client device and a network storage device.
The network storage device is connected to the client device, and specifically, the connection mode of the two devices may refer to the connection mode in the conventional method, which is not described herein again.
The client device may refer to the description of the third embodiment, and the network storage device may refer to the description of the eighth embodiment, which is not described herein again.
By applying the network storage device with the functions and the structure and the file synchronization system of the client, the work of the network storage device can be simplified, the task pressure of the network storage device is reduced, the task execution effect is ensured, the file synchronization effect is effectively ensured, and the service quality is improved.
Example ten
The present embodiment discloses a readable storage medium, on which a program is stored, and the program, when executed by a processor, implements the steps of the file synchronization method based on a network storage device applied to a client and/or the steps of the file synchronization method based on a network storage device applied to a network storage device as described in the above embodiments, which may be referred to in detail in the above embodiments.
The readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various other readable storage media capable of storing program codes.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method provided in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It should be noted that the above-mentioned numbers of the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments. And the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (12)

1. A file synchronization method based on network storage equipment is applied to a client and comprises the following steps:
the client acquires the synchronous directory information of the network storage device as the device synchronous directory information;
generating local synchronous directory information according to the structure and the content of the local synchronous directory;
performing file modification comparison analysis according to the local synchronous directory information and the equipment synchronous directory information to obtain a file sequence to be synchronized;
and carrying out file synchronization operation on the network storage equipment and/or the local machine according to the file sequence to be synchronized.
2. The method for file synchronization based on network storage device according to claim 1, wherein the generating local synchronization directory information according to the structure and content of the local synchronization directory comprises:
determining files and directories which are changed in the synchronous directory;
recalculating the changed value of the MD5 according to the content of the file;
according to names corresponding to the MD5 value splicing of all subfiles and subdirectories under the directory, recalculating the MD5 value of the changed directory;
and constructing an MD5 information tree according to all files and directories under the synchronous directory to serve as the local synchronous directory information.
3. The method for file synchronization based on network storage device according to claim 2, further comprising:
monitoring a synchronous directory on a disk;
when the synchronization directory changes, the step of determining a changed object in the synchronization directory is performed.
4. The method for file synchronization based on network storage device according to claim 1, wherein performing a file modification comparison analysis on the local synchronization directory information and the device synchronization directory information to obtain a file sequence to be synchronized comprises:
determining the last synchronous directory information; the last synchronous directory information is unified synchronous directory information in last file synchronization;
comparing and analyzing the local synchronous directory information with the last synchronous directory information to obtain local change of the local synchronous directory relative to the local synchronous directory after the last synchronization is completed;
comparing and analyzing the equipment synchronization directory information with the last synchronization directory information to obtain the equipment change of the equipment synchronization directory relative to the equipment change after the last synchronization is completed;
and taking the local change as a file sequence to be synchronized of the network storage equipment, and taking the equipment change as the file sequence to be synchronized of the client.
5. A file synchronization device based on network storage equipment is characterized in that the file synchronization device is applied to client equipment and comprises:
the device synchronization information acquisition unit is used for acquiring the synchronization directory information of the network storage device as the device synchronization directory information;
the local synchronous information acquisition unit is used for generating local synchronous directory information according to the structure and the content of a local synchronous directory;
the information comparison and analysis unit is used for carrying out file modification comparison and analysis according to the local synchronous directory information and the equipment synchronous directory information to obtain a file sequence to be synchronized;
and the synchronous operation unit is used for carrying out file synchronous operation on the network storage equipment and/or the local computer according to the file sequence to be synchronized.
6. A client device, comprising:
a memory for storing a computer program;
a processor for implementing the method of file synchronization based on network storage device according to any one of claims 1 to 4 when executing the computer program.
7. A file synchronization method based on network storage equipment is characterized in that the file synchronization method is applied to the network storage equipment and comprises the following steps:
the network storage equipment generates synchronous directory information according to the structure and the content of the synchronous directory;
receiving a file sequence to be synchronized;
and performing data synchronization updating on the synchronization directory according to the file sequence to be synchronized.
8. The method for file synchronization based on network storage device according to claim 7, wherein the network storage device generates the synchronization directory information according to the structure and content of the synchronization directory, including:
when the disk is detected to be inserted again, traversing a disk file system, and determining a changed file and the changed content of the changed file;
and generating synchronous directory information according to the structure and the content of the change file, the change content and the synchronous directory before the change.
9. A file synchronization device based on network storage equipment is characterized in that the file synchronization device is applied to the network storage equipment and comprises:
the equipment synchronization information generating unit is used for generating synchronization directory information according to the structure and the content of the synchronization directory;
the file sequence receiving unit is used for receiving a file sequence to be synchronized;
and the synchronous updating unit is used for synchronously updating the data of the synchronous directory according to the file sequence to be synchronized.
10. A network storage device, comprising:
a memory for storing a computer program;
a processor for implementing the method of claim 7 or 8 when executing the computer program.
11. A file synchronization system based on a network storage device, comprising:
the client device of claim 6;
the network storage device of claim 10;
the network storage device is connected with the client device.
12. A computer-readable storage medium, characterized in that a computer program is stored thereon, which, when being executed by a processor, implements the steps of the network storage device-based file synchronization method according to any one of claims 1 to 4 and/or the steps of the network storage device-based file synchronization method according to any one of claims 7 to 8.
CN201911228722.1A 2019-12-04 2019-12-04 File synchronization method based on network storage device and related components Pending CN110990360A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911228722.1A CN110990360A (en) 2019-12-04 2019-12-04 File synchronization method based on network storage device and related components

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911228722.1A CN110990360A (en) 2019-12-04 2019-12-04 File synchronization method based on network storage device and related components

Publications (1)

Publication Number Publication Date
CN110990360A true CN110990360A (en) 2020-04-10

Family

ID=70090089

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911228722.1A Pending CN110990360A (en) 2019-12-04 2019-12-04 File synchronization method based on network storage device and related components

Country Status (1)

Country Link
CN (1) CN110990360A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112615918A (en) * 2020-12-16 2021-04-06 杭州迪普科技股份有限公司 Network management system and information synchronization method thereof
CN113672678A (en) * 2020-05-14 2021-11-19 杭州海康存储科技有限公司 Data synchronization method, device and system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104919451A (en) * 2012-12-19 2015-09-16 卓普网盘股份有限公司 Application programming interfaces for data synchronization with online storage systems
US20160292437A1 (en) * 2015-03-31 2016-10-06 Symantec Corporation Technique for data loss prevention for a cloud sync application
CN108063779A (en) * 2016-11-07 2018-05-22 天脉聚源(北京)科技有限公司 A kind of cloud storage method and system synchronous with realization is locally stored

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104919451A (en) * 2012-12-19 2015-09-16 卓普网盘股份有限公司 Application programming interfaces for data synchronization with online storage systems
US20160292437A1 (en) * 2015-03-31 2016-10-06 Symantec Corporation Technique for data loss prevention for a cloud sync application
CN108063779A (en) * 2016-11-07 2018-05-22 天脉聚源(北京)科技有限公司 A kind of cloud storage method and system synchronous with realization is locally stored

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113672678A (en) * 2020-05-14 2021-11-19 杭州海康存储科技有限公司 Data synchronization method, device and system
CN112615918A (en) * 2020-12-16 2021-04-06 杭州迪普科技股份有限公司 Network management system and information synchronization method thereof

Similar Documents

Publication Publication Date Title
CN107483627B (en) File distribution method, file download method, distribution server, client and system
CN109492380B (en) Equipment authentication method and device and block link point
EP2706719B1 (en) File synchronization method and device
CN110309161B (en) Data synchronization method and device and server
US20170031948A1 (en) File synchronization method, server, and terminal
CN107423070B (en) Page generation method and device
CN111262726B (en) Configuration information updating method and device and computer readable storage medium
CN110928950A (en) Block chain transaction information management method and device, computer equipment and storage medium
CN113961510B (en) File processing method, device, equipment and storage medium
CN110990360A (en) File synchronization method based on network storage device and related components
CN111064626A (en) Configuration updating method, device, server and readable storage medium
CN110460668B (en) File uploading method and device, computer equipment and storage medium
CN110311855B (en) User message processing method and device, electronic equipment and storage medium
TW201423420A (en) Data synchronization system and method for synchronizing data
CN112732702B (en) Database engine file processing method and device
CN113541987A (en) Method and device for updating configuration data
CN109542981B (en) Data synchronization system and method, electronic device and storage medium
CN115002507A (en) Video data updating method, device, equipment and readable storage medium
CN110896391B (en) Message processing method and device
CN107332679B (en) Centerless information synchronization method and device
CN113742376A (en) Data synchronization method, first server and data synchronization system
CN106941413B (en) Service management method and device
KR101298852B1 (en) Method of restoring file and system for the same
CN110929500B (en) File comparison method and related device
CN113127164B (en) Method, apparatus and computer program product for managing tasks in application nodes

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