Movatterモバイル変換


[0]ホーム

URL:


CN112445761B - File checking method and device and storage medium - Google Patents

File checking method and device and storage medium
Download PDF

Info

Publication number
CN112445761B
CN112445761BCN201910817324.7ACN201910817324ACN112445761BCN 112445761 BCN112445761 BCN 112445761BCN 201910817324 ACN201910817324 ACN 201910817324ACN 112445761 BCN112445761 BCN 112445761B
Authority
CN
China
Prior art keywords
file
verified
verification code
verification
moment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910817324.7A
Other languages
Chinese (zh)
Other versions
CN112445761A (en
Inventor
汤永伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software 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 China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co LtdfiledCriticalChina Mobile Communications Group Co Ltd
Priority to CN201910817324.7ApriorityCriticalpatent/CN112445761B/en
Publication of CN112445761ApublicationCriticalpatent/CN112445761A/en
Application grantedgrantedCritical
Publication of CN112445761BpublicationCriticalpatent/CN112445761B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

Translated fromChinese

本发明公开了一种文件校验方法,在第一时刻读取待校验文件的状态信息;基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成第二校验码;将所述第二校验码与已保存的所述待校验文件的第一校验码进行比较,得到比较结果,基于所述比较结果确定所述待校验文件是否完整。本发明还同时公开了一种文件校验装置及存储介质。这里,整个校验过程中所述待校验文件一直处于未被打开的状态,而不是处于读写状态的待校验文件,能够减少校验过程中资源的浪费。进一步的,若所述待校验文件被打开,则结束校验过程,因此不会影响上层业务。

Figure 201910817324

The invention discloses a file verification method, which reads the state information of the file to be verified at the first moment; based on the state information of the file to be verified, it is determined that the file to be verified has not been opened, and the The file to be verified is verified to generate a second verification code; the second verification code is compared with the saved first verification code of the file to be verified to obtain a comparison result, based on the The comparison result determines whether the file to be verified is complete. The invention also discloses a file checking device and a storage medium at the same time. Here, the file to be verified is always in an unopened state throughout the verification process, rather than a file to be verified in a read-write state, which can reduce waste of resources in the verification process. Further, if the file to be verified is opened, the verification process will end, so the upper layer business will not be affected.

Figure 201910817324

Description

Translated fromChinese
一种文件校验方法、装置及存储介质A file verification method, device and storage medium

技术领域technical field

本发明涉及信息处理领域,尤其涉及一种文件校验方法、装置及存储介质。The invention relates to the field of information processing, in particular to a file verification method, device and storage medium.

背景技术Background technique

现有技术中,为了校验文件数据的完整性,一般是通过启动检查进程,生成针对多个副本的校验码,进而通过校验码之间的比对,确定出待校验文件是否完整。如果校验码一致,则所述待校验文件是完整的;若校验码不一致,则所述待校文件不是完整的,对所述待校验文件进行修复。In the prior art, in order to verify the integrity of the file data, the verification process is generally started to generate verification codes for multiple copies, and then through the comparison between the verification codes, it is determined whether the file to be verified is complete . If the verification codes are consistent, the file to be verified is complete; if the verification codes are inconsistent, the file to be verified is not complete, and the file to be verified is repaired.

由于位衰减、磁盘坏块等原因是导致文件不完整的主要因素,一般文件不完整的情况多出现在不常打开的文件,而现有的文件校验方法是对所有的文件进行检验,导致了资源的浪费。并且,现有技术中,对文件进行校验时,为了保证校验码的正确性,一般会阻塞该文件的正常输入输出操作,进而影响正常业务。Due to reasons such as bit decay and bad disk blocks are the main factors leading to incomplete files, generally incomplete files often appear in files that are not often opened, and the existing file verification method is to check all files, resulting in A waste of resources. Moreover, in the prior art, when verifying a file, in order to ensure the correctness of the verification code, the normal input and output operations of the file are generally blocked, thereby affecting normal business.

发明内容Contents of the invention

有鉴于此,本发明实施例期望提供一种文件校验方法、装置及存储介质,旨在解决现有技术中存在的上述问题。In view of this, the embodiments of the present invention expect to provide a file verification method, device and storage medium, aiming at solving the above-mentioned problems existing in the prior art.

为达到上述目的,本发明实施例的技术方案是这样实现的:In order to achieve the above object, the technical solution of the embodiment of the present invention is achieved in this way:

本发明实施例提供一种文件校验方法,所述方法包括:An embodiment of the present invention provides a file verification method, the method comprising:

在第一时刻读取待校验文件的状态信息;Read the status information of the file to be verified at the first moment;

基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成第二校验码;Based on the status information of the file to be verified, it is determined that the file to be verified has not been opened, then verifying the file to be verified to generate a second verification code;

将所述第二校验码与已保存的所述待校验文件的第一校验码进行比较,得到比较结果,基于所述比较结果确定所述待校验文件是否完整。Comparing the second verification code with the saved first verification code of the file to be verified to obtain a comparison result, and determining whether the file to be verified is complete based on the comparison result.

上述方案中,所述基于所述比较结果确定所述待校验文件是否完整,包括:In the above solution, the determining whether the file to be verified is complete based on the comparison result includes:

若所述第一校验码和所述第二校验码一致,则确定所述待校验文件是完整的;If the first verification code is consistent with the second verification code, it is determined that the file to be verified is complete;

若所述第一校验码和所述第二校验码不一致,则确定所述待校验文件不完整,对所述待校验文件进行修复。If the first verification code is inconsistent with the second verification code, it is determined that the file to be verified is incomplete, and the file to be verified is repaired.

上述方案中,所述方法还包括:In the above scheme, the method also includes:

在第二时刻读取目标文件的状态信息;其中,所述第二时刻早于所述第一时刻;Reading the state information of the target file at a second moment; wherein, the second moment is earlier than the first moment;

基于所述目标文件的状态信息,确定所述目标文件未被打开,则开启针对所述目标文件的窗口;Based on the status information of the target file, it is determined that the target file is not opened, and then a window for the target file is opened;

在所述针对所述目标文件的窗口结束之后,读取所述目标文件的状态信息;After the window for the target file ends, read the state information of the target file;

当所述目标文件的状态信息表征所述目标文件保持为未被打开的状态时,将所述目标文件确定为待校验文件。When the state information of the target file indicates that the target file remains unopened, the target file is determined as the file to be verified.

上述方案中,所述方法还包括:In the above scheme, the method also includes:

在第三时刻读取所述待校验文件的状态信息;其中,所述第三时刻早于所述第一时刻,所述第三时刻晚于所述第二时刻;Reading the status information of the file to be verified at a third moment; wherein, the third moment is earlier than the first moment, and the third moment is later than the second moment;

基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成所述第一校验码,并将所述第一校验码作为所述待校验文件的一种属性信息进行保存。Based on the status information of the file to be verified, it is determined that the file to be verified has not been opened, then the file to be verified is verified, the first verification code is generated, and the first verification code is The verification code is saved as a kind of attribute information of the file to be verified.

本发明实施例还提供一种文件校验装置,所述装置包括:读取模块、第一生成模块和判别模块;其中,The embodiment of the present invention also provides a file verification device, the device includes: a reading module, a first generation module and a discrimination module; wherein,

所述读取模块,用于在第一时刻读取待校验文件的状态信息;The reading module is used to read the state information of the file to be verified at the first moment;

所述第一生成模块,用于基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成第二校验码;The first generation module is configured to determine that the file to be verified has not been opened based on the status information of the file to be verified, then verify the file to be verified, and generate a second verification code;

所述判别模块,用于将所述第二校验码与已保存的所述待校验文件的第一校验码进行比较,得到比较结果,基于所述比较结果确定所述待校验文件是否完整。The discrimination module is configured to compare the second verification code with the saved first verification code of the file to be verified to obtain a comparison result, and determine the file to be verified based on the comparison result is it complete.

上述方案中,所述判别模块,具体用于若所述第一校验码和所述第二校验码一致,则确定所述待校验文件是完整的;若所述第一校验码和所述第二校验码不一致,则确定所述待校验文件不完整,对所述待校验文件进行修复。In the above solution, the discrimination module is specifically used to determine that the file to be verified is complete if the first verification code is consistent with the second verification code; if the first verification code If it is inconsistent with the second verification code, it is determined that the file to be verified is incomplete, and the file to be verified is repaired.

上述方案中,所述装置还包括确定模块,用于在第二时刻读取目标文件的状态信息;其中,所述第二时刻早于所述第一时刻;基于所述目标文件的状态信息,确定所述目标文件未被打开,则开启针对所述目标文件的窗口;在所述针对所述目标文件的窗口结束之后,读取所述目标文件的状态信息;当所述目标文件的状态信息表征所述目标文件保持为未被打开的状态时,将所述目标文件确定为待校验文件。In the above solution, the device further includes a determination module, configured to read the state information of the target file at a second moment; wherein, the second moment is earlier than the first moment; based on the state information of the target file, Determine that the target file is not opened, then open the window for the target file; after the end of the window for the target file, read the status information of the target file; when the status information of the target file When it is indicated that the target file remains unopened, the target file is determined as the file to be verified.

上述方案中,所述装置还包括第二生成模块,用于在第三时刻读取所述待校验文件的状态信息;其中,所述第三时刻早于所述第一时刻,所述第三时刻晚于所述第二时刻;基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成所述第一校验码,并将所述第一校验码作为所述待校验文件的一种属性信息进行保存。In the above solution, the device further includes a second generating module, configured to read the status information of the file to be verified at a third moment; wherein, the third moment is earlier than the first moment, and the second The third time is later than the second time; based on the state information of the file to be verified, it is determined that the file to be verified has not been opened, then the file to be verified is verified, and the first proof is generated. code verification, and save the first verification code as a kind of attribute information of the file to be verified.

本发明实施例还提供一种存储介质,其上存储有可执行程序,所述可执行程序被处理器执行时实现上述技术方案中的步骤。An embodiment of the present invention also provides a storage medium on which an executable program is stored, and when the executable program is executed by a processor, the steps in the above technical solution are implemented.

本发明实施例还提供一种文件校验装置,包括存储器、处理器及存储在存储器上并能够由所述处理器运行的可执行程序,其特征在于,所述处理器运行所述可执行程序时执行上述技术方案中的步骤。An embodiment of the present invention also provides a file verification device, including a memory, a processor, and an executable program stored on the memory and capable of being run by the processor, wherein the processor runs the executable program When performing the steps in the above technical solution.

本发明实施例提供的文件校验方法、装置及存储介质,将针对目标文件的窗口之后仍然处于未被打开状态的所述目标文件确定为待校验文件。当所述待校验文件处于未被打开的状态时,对所述待校验文件进行校验,生成第二校验码,进而将所述第二校验码与已保存的所述待校验文件的第一校验码进行比较,由比较结果确定所述待校验文件是否完整。这里,所述待校验文件的整个校验过程所述待校验文件一直处于未被打开的状态。若所述待校验文件处于打开状态,则结束校验过程。也就是说,本实例的文件校验方法针对的未被打开的文件,而不是正在读写的文件,因此减少了校验过程中资源的浪费。进一步的,在校验过程中,若所述待校验文件被打开,则结束校验过程。这样,本实施例的文件校验方法,不会影响上层业务,不会阻塞所述待校验文件的正常输入输出操作。In the file verification method, device and storage medium provided by the embodiments of the present invention, the target file whose window for the target file is still not opened afterward is determined as the file to be verified. When the file to be verified is not opened, the file to be verified is verified to generate a second verification code, and then the second verification code is combined with the saved verification code to be verified. compare the first verification code of the file to be verified, and determine whether the file to be verified is complete by the comparison result. Here, the file to be verified is always in an unopened state during the entire verification process of the file to be verified. If the file to be verified is in an open state, the verification process is ended. That is to say, the file verification method in this example is aimed at the unopened file, rather than the file being read and written, thus reducing the waste of resources in the verification process. Further, during the verification process, if the file to be verified is opened, the verification process ends. In this way, the file verification method in this embodiment will not affect the upper-layer business and will not block the normal input and output operations of the file to be verified.

附图说明Description of drawings

图1为本发明实施例的文件校验方法的实现流程示意图一;Fig. 1 is a schematic diagram of the implementation flow of the file verification method according to the embodiment of the present invention;

图2为本发明实施例的文件校验方法的实现流程示意图二;FIG. 2 is a second schematic diagram of the implementation flow of the file verification method according to the embodiment of the present invention;

图3为本发明实施例的文件校验方法的待校验文件确定流程示意图;FIG. 3 is a schematic diagram of a process for determining a file to be verified in a file verification method according to an embodiment of the present invention;

图4为本发明实施例的文件校验方法的第一校验码生成过程示意图;Fig. 4 is a schematic diagram of the first verification code generation process of the file verification method according to the embodiment of the present invention;

图5为本发明实施例的文件校验方法的校验码比较过程示意图;5 is a schematic diagram of a verification code comparison process of a file verification method according to an embodiment of the present invention;

图6为本发明实施例的文件校验装置的组成结构示意图一;FIG. 6 is a schematic diagram of the composition and structure of a file verification device according to an embodiment of the present invention;

图7为本发明实施例的文件校验装置的组成结构示意图二;FIG. 7 is a second schematic diagram of the composition and structure of the file verification device according to the embodiment of the present invention;

图8为本发明实施例的文件校验装置的硬件结构示意图。FIG. 8 is a schematic diagram of a hardware structure of a file verification device according to an embodiment of the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚明白,下文中将结合附图对本发明实施例进行详细说明。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings.

实施例一、Embodiment one,

本发明实施例中,文件校验方法的实现流程示意图如图1所示,包括以下步骤:In the embodiment of the present invention, the schematic diagram of the implementation process of the file verification method is shown in Figure 1, including the following steps:

步骤101:在第一时刻读取待校验文件的状态信息;Step 101: read the status information of the file to be verified at the first moment;

步骤102:基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成第二校验码;Step 102: Based on the status information of the file to be verified, it is determined that the file to be verified has not been opened, then verify the file to be verified, and generate a second verification code;

步骤103:将所述第二校验码与已保存的所述待校验文件的第一校验码进行比较,得到比较结果,基于所述比较结果确定所述待校验文件是否完整。Step 103: Compare the second verification code with the saved first verification code of the file to be verified to obtain a comparison result, and determine whether the file to be verified is complete based on the comparison result.

在本发明实施例中的步骤101中,所述待校验文件的状态信息包括文件被打开的状态、文件未被打开的状态等。这里,每个文件都有描述符,当所述描述符处于被打开的状态时,所述文件则处于被打开的状态。进一步的,读取所述待校验文件的描述符。根据所述待校验文件描述符的状态,确定所述待校验文件的状态信息。In step 101 in the embodiment of the present invention, the status information of the file to be verified includes the status of the file being opened, the status of the file not being opened, and the like. Here, each file has a descriptor, and when the descriptor is opened, the file is opened. Further, read the descriptor of the file to be verified. Determine the state information of the file to be verified according to the state of the file descriptor to be verified.

其中,所述第一时刻用于表征读取所述待校验文件的状态信息的某一个时刻。Wherein, the first moment is used to represent a certain moment when the status information of the file to be verified is read.

进一步的,所述待校验文件的确定过程为:在第二时刻读取目标文件的状态信息;其中,所述第二时刻早于所述第一时刻;基于所述目标文件的状态信息,确定所述目标文件未被打开,则开启针对所述目标文件的窗口;在所述针对所述目标文件的窗口结束之后,读取所述目标文件的状态信息;当所述目标文件的状态信息表征所述目标文件保持为未被打开的状态时,将所述目标文件确定为待校验文件。Further, the process of determining the file to be verified is: reading the state information of the target file at a second moment; wherein, the second moment is earlier than the first moment; based on the state information of the target file, Determine that the target file is not opened, then open the window for the target file; after the end of the window for the target file, read the status information of the target file; when the status information of the target file When it is indicated that the target file remains unopened, the target file is determined as the file to be verified.

具体的,在第二时刻读取目标文件的状态信息,基于所述目标文件的状态信息,确定所述文件为被打开,则开启针对所述目标文件的窗口;若基于所述目标文件的状态,确定所述文件被打开,则结束校验过程。进一步的,所述目标文件在窗口保持未被打开的状态,在针对所述目标文件的窗口结束之后,读取所述目标文件的状态信息。当所述目标文件的状态信息表征所述目标文件保持为未被打开的状态时,将所述目标文件确定为待校验文件;若所述目标文件的处于被打开状态,则结束校验过程,将所述目标文件移出窗口,记录所述目标文件的此时状态信息。Specifically, read the state information of the target file at the second moment, and based on the state information of the target file, determine that the file is opened, then open the window for the target file; if based on the state of the target file , if it is determined that the file is opened, then the verification process ends. Further, the window of the target file remains unopened, and the state information of the target file is read after the window for the target file ends. When the state information of the target file indicates that the target file remains unopened, the target file is determined as the file to be verified; if the target file is in the opened state, the verification process is ended , move the target file out of the window, and record the status information of the target file at this time.

进一步的,在确定待校验文件后,所述方法还包括:在第三时刻读取所述待校验文件的状态信息;其中,所述第三时刻早于所述第一时刻,所述第三时刻晚于所述第二时刻;所述第二时刻和第三时刻分别用于表征读取所述待校验文件的状态信息的某一个时刻。基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成所述第一校验码,并将所述第一校验码作为所述待校验文件的一种属性信息进行保存。Further, after the file to be verified is determined, the method further includes: reading the state information of the file to be verified at a third moment; wherein, the third moment is earlier than the first moment, and the The third time is later than the second time; the second time and the third time are respectively used to represent a certain time when the status information of the file to be verified is read. Based on the status information of the file to be verified, it is determined that the file to be verified has not been opened, then the file to be verified is verified, the first verification code is generated, and the first verification code is The verification code is saved as a kind of attribute information of the file to be verified.

具体的,在第三时刻读取所述待校验文件的状态信息。基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成所述第一校验码,并将所述第一校验码作为所述待校验文件的一种属性信息进行保存;基于所述待校验文件的状态信息,确定所述待校验文件被打开,则结束校验过程。这里,所述第一校验码作为所述待校验文件的一种属性信息,保存到所述待校验文件的属性信息列表中。所述待校验文件的状态信息同样保存在所述待校验文件的属性信息列表中。Specifically, read the state information of the file to be verified at the third moment. Based on the status information of the file to be verified, it is determined that the file to be verified has not been opened, then the file to be verified is verified, the first verification code is generated, and the first verification code is The verification code is saved as a kind of attribute information of the file to be verified; based on the state information of the file to be verified, it is determined that the file to be verified is opened, and the verification process ends. Here, the first verification code is saved as a kind of attribute information of the file to be verified in the attribute information list of the file to be verified. The state information of the file to be verified is also stored in the attribute information list of the file to be verified.

在步骤102中,基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成第二校验码。具体的,在确定所述待校验文件未被打开后,通过对所述待校验文件进行散列计算得到所述第二校验码。其中,所述散列计算可以采用消息摘要(Message Digest Algorithm,MD5)算法,所述散列计算的值具有唯一性。In step 102, based on the status information of the file to be verified, it is determined that the file to be verified has not been opened, and then the file to be verified is verified to generate a second verification code. Specifically, after it is determined that the file to be verified has not been opened, the second verification code is obtained by performing hash calculation on the file to be verified. Wherein, the hash calculation may adopt a message digest (Message Digest Algorithm, MD5) algorithm, and the value of the hash calculation is unique.

在步骤103中,将所述第二校验码与已保存的所述待校验文件的第一校验码进行比较,得到比较结果,基于所述比较结果确定所述待校验文件是否完整。In step 103, the second verification code is compared with the saved first verification code of the file to be verified to obtain a comparison result, and based on the comparison result, it is determined whether the file to be verified is complete .

这里,在所述待校验文件的属性信息列表中保存有所述待校验文件的第一校验码,在生成所述第二校验码后,将所述第一校验码和所述第二校验码进行比较,并根据比较结果确定所述待校验文件是否完整。具体的,若所述第一校验码和所述第二校验码一致,则确定所述待校验文件是完整的;若所述第一校验码和所述第二校验码不一致,则确定所述待校验文件不完整,对所述待校验文件进行修复。Here, the first verification code of the file to be verified is stored in the attribute information list of the file to be verified, and after the second verification code is generated, the first verification code and the compare the second verification code, and determine whether the file to be verified is complete according to the comparison result. Specifically, if the first verification code is consistent with the second verification code, it is determined that the file to be verified is complete; if the first verification code is inconsistent with the second verification code , it is determined that the file to be verified is incomplete, and the file to be verified is repaired.

然而,现有技术方案中一般采用如下方法来校验文件是否完整:However, in the prior art solutions, the following methods are generally adopted to check whether the file is complete:

首先,根据文件主副本的启动节点,触发校验过程;First, trigger the verification process according to the startup node of the master copy of the file;

然后,提取文件的主副本和其他副本的校验码,对比所述校验码。其中,在比对过程中,副本的数据是不能被修改的。并且,由于每个主副本和其他副本在实际写入到底层存储的时间会有差异。校验过程需要同时维护几个副本间的版本信息,直到这些副本具备相同的版本。Then, the verification codes of the master copy and other copies of the file are extracted, and the verification codes are compared. Among them, during the comparison process, the data of the copy cannot be modified. And, because each master copy and other copies will have differences in the actual writing time to the underlying storage. The verification process needs to maintain version information between several copies at the same time until these copies have the same version.

进一步的,若所述校验码一致,则确定所述文件是完整的;若所述校验码不一致,则确定所述文件是不完整的,对所述文件进行修复。Further, if the check codes are consistent, it is determined that the file is complete; if the check codes are inconsistent, it is determined that the file is incomplete, and the file is repaired.

可见,现有技术中,对文件进行校验时,为了保证校验码的正确性,一般会阻塞该文件的正常输入输出操作,进而影响正常业务。并且,对所有的文件进行检验,导致了资源的浪费。此外。现有技术方案中,若分布式文件系统启用的是双副本模式,在出现校验码不一致的情况下,由于没有相对原始的校验码,便不能给服务器或者客户端有效的副本正确建议。若分布式文件系统各个文件的副本之间存在先后读写顺序,还需要维护主副本与其他副本的版本统一,增加了额外开销。其中,所述分布式文件系统用于表征将不同的服务器节点通过网络聚合成统一的存储资源池,为应用提供统一命名空间的文件系统服务。It can be seen that in the prior art, when verifying a file, in order to ensure the correctness of the verification code, the normal input and output operations of the file are generally blocked, thereby affecting normal business. Moreover, checking all files results in a waste of resources. also. In the existing technical solutions, if the distributed file system is enabled in the double-copy mode, in the case of inconsistent check codes, since there is no relatively original check code, it is impossible to give the server or client a valid copy of the correct suggestion. If there is a sequence of reading and writing among the copies of each file in the distributed file system, it is also necessary to maintain the version unity of the master copy and other copies, which increases additional overhead. Wherein, the distributed file system is used to represent a file system service that aggregates different server nodes into a unified storage resource pool through a network and provides a unified namespace for applications.

可见,现有的文件校验方法有着明显的不足,本实施例采用的文件校验方法与现有的文件校验方法相比,有些明显的进步。It can be seen that the existing file verification methods have obvious deficiencies, and the file verification method adopted in this embodiment has some obvious improvements compared with the existing file verification methods.

本实施例中,将针对目标文件的窗口之后,仍处于未被打开的目标文件确定为待校验文件,通过多次读取待校验文件的状态信息,根据所述待校验文件的状态信息,确定所述待校验文件处于未被打开的状态,进而继续后续的校验过程。在生成第一校验码和第二校验码后,进行所述第一校验码和所述第二校验码之间的比较,根据比较的结果确定所述待校验文件是否完整。也就是说,本实施例的文件校验方法是未被打开的文件进行校验,能够减少资源的浪费。而且,在所述待校验文件处于打开状态的情况下,结束校验过程。可见,不会影响上层业务,不会阻塞所述待校验文件的正常输入输出操作。此外,本实施例的文件校验方法将所述待校验文件的校验码作为所述待校验文件的一种属性信息进行保存,从而避免了无法提供正确副本参考的问题。In this embodiment, after the window for the target file, the target file that is still not opened is determined as the file to be verified, and by reading the status information of the file to be verified multiple times, according to the state of the file to be verified information, determine that the file to be verified is not opened, and then continue the subsequent verification process. After the first verification code and the second verification code are generated, a comparison between the first verification code and the second verification code is performed, and it is determined whether the file to be verified is complete according to a result of the comparison. That is to say, the file verification method in this embodiment performs verification on unopened files, which can reduce waste of resources. Moreover, when the file to be verified is in an open state, the verification process ends. It can be seen that the upper-layer business will not be affected, and the normal input and output operations of the file to be verified will not be blocked. In addition, the file verification method of this embodiment saves the verification code of the file to be verified as a kind of attribute information of the file to be verified, thereby avoiding the problem that a correct copy reference cannot be provided.

实施例二、Embodiment two,

本实施例中,针对待校验文件X的校验方法的实现流程示意图如图2所示,包括以下步骤:In this embodiment, the implementation flow diagram of the verification method for the file X to be verified is shown in Figure 2, including the following steps:

步骤201:在时刻A读取目标文件X的状态信息;基于所述目标文件X的状态信息,确定所述目标文件X未被打开,则开启针对所述目标文件X的窗口;在所述针对所述目标文件X的窗口结束之后,读取所述目标文件X的状态信息;当所述目标文件X的状态信息表征所述目标文件X保持为未被打开的状态时,将所述目标文件X确定为待校验文件X;Step 201: read the status information of the target file X at time A; determine that the target file X is not opened based on the status information of the target file X, then open a window for the target file X; After the window of the target file X ends, read the state information of the target file X; when the state information of the target file X indicates that the target file X remains unopened, the target file X is determined as the file X to be verified;

步骤202:在时刻B读取所述待校验文件X的状态信息;其中,所述时刻B晚于所述时刻A;基于所述待校验文件X的状态信息,确定所述待校验文件X未被打开,则对所述待校验文件X进行校验,生成所述第一校验码,并将所述第一校验码作为所述待校验文件X的一种属性信息进行保存;Step 202: Read the state information of the file X to be verified at time B; wherein, the time B is later than the time A; determine the state information of the file X to be verified based on the state information of the file X to be verified If the file X is not opened, verify the file X to be verified, generate the first verification code, and use the first verification code as a kind of attribute information of the file X to be verified to save;

步骤203:在时刻C读取待校验文件X的状态信息;其中,所述时刻C晚于所述时刻B;基于所述待校验文件X的状态信息,确定所述待校验文件X未被打开,则对所述待校验文件X进行校验,生成第二校验码;将所述第二校验码与已保存的所述待校验文件X的第一校验码进行比较,得到比较结果,基于所述比较结果确定所述待校验文件X是否完整。Step 203: Read the state information of the file X to be verified at time C; wherein, the time C is later than the time B; based on the state information of the file X to be verified, determine the file X to be verified If it is not opened, then verify the file X to be verified to generate a second verification code; compare the second verification code with the saved first verification code of the file X to be verified Comparing to obtain a comparison result, and determining whether the file X to be verified is complete based on the comparison result.

在步骤201中,如图3所示,服务模块在时刻A读取目标文件X的状态信息;基于所述目标文件X的状态信息,确定所述目标文件X未被打开,便将所述目标文件X未被打开的状态信息发送给校验模块1,校验模块1接收到所述目标文件X未被打开的状态信息后,开启针对所述目标文件X的窗口。若所述目标文件X被打开,则服务模块结束校验过程。这里,服务模块读取所述目标文件X的描述符。根据所述目标文件X的描述符的状态,确定所述目标文件X的状态信息。具体的,当所述目标文件X的描述符处于未被打开的状态,所述目标文件X也处于未被打开的状态。In step 201, as shown in Figure 3, the service module reads the state information of the target file X at time A; based on the state information of the target file X, it is determined that the target file X is not opened, and the target The status information that the file X is not opened is sent to the verification module 1, and the verification module 1 opens a window for the target file X after receiving the status information that the target file X is not opened. If the target file X is opened, the service module ends the verification process. Here, the service module reads the descriptor of the target file X. Determine the status information of the target file X according to the status of the descriptor of the target file X. Specifically, when the descriptor of the target file X is not opened, the target file X is also not opened.

进一步的,在所述针对所述目标文件X的窗口结束之后,服务模块读取所述目标文件X的状态信息;当所述目标文件X的状态信息表征所述目标文件X保持为未被打开的状态时,服务模块将所述目标文件X未被打开的状态信息发送给校验模块1,校验模块1将所述目标文件X确定为待校验文件X。进一步的,在所述针对所述目标文件X的窗口结束之后,服务模块读取所述目标文件X的状态信息。若所述目标文件X处于打开状态,则服务模块结束校验过程。Further, after the window for the target file X ends, the service module reads the status information of the target file X; when the status information of the target file X indicates that the target file X remains unopened , the service module sends the status information that the target file X is not opened to the verification module 1, and the verification module 1 determines the target file X as the file X to be verified. Further, after the window for the target file X ends, the service module reads the state information of the target file X. If the target file X is in an open state, the service module ends the verification process.

在步骤202中,如图4所示,服务模块在时刻B读取所述待校验文件X的状态信息;其中,所述时刻B晚于所述时刻A。若服务模块确定所述待校验文件X被打开,则结束校验过程。若服务模块基于所述待校验文件X的状态信息,确定所述待校验文件X未被打开,服务模块会将所述待校验文件X未被打开的状态信息发送至校验模块1,校验模块1将所述待校验文件X加入校验队列,对所述待校验文件X进行校验,生成所述第一校验码,并将所述第一校验码发送给服务模块,服务模块将所述第一校验码作为所述待校验文件X的一种属性信息进行保存。In step 202, as shown in FIG. 4 , the service module reads the status information of the file X to be verified at time B; wherein, the time B is later than the time A. If the service module determines that the file X to be verified is opened, the verification process ends. If the service module determines that the file X to be verified is not opened based on the status information of the file X to be verified, the service module will send the status information that the file X to be verified has not been opened to the verification module 1 , the verification module 1 adds the file X to be verified to the verification queue, verifies the file X to be verified, generates the first verification code, and sends the first verification code to A service module, the service module saves the first verification code as a kind of attribute information of the file X to be verified.

在步骤203中,如图5所示,服务模块在时刻C读取待校验文件X的状态信息;其中,所述时刻C晚于所述时刻B;基于所述待校验文件X的状态信息,若所述待校验文件X被打开,则服务模块结束校验过程;若确定所述待校验文件X未被打开,则服务模块将所述待校验文件X未被打开的状态信息发送给校验模块2,校验模块2对所述待校验文件X进行校验,生成第二校验码。进一步的,校验模块2通过对所述待校验文件X进行散列计算得到所述第二校验码,所述散列计算的值具有唯一性。In step 203, as shown in Figure 5, the service module reads the state information of the file X to be verified at time C; wherein, the time C is later than the time B; based on the state of the file X to be verified information, if the file X to be verified is opened, the service module ends the verification process; if it is determined that the file X to be verified has not been opened, the service module puts the file X to be verified in the unopened state The information is sent to the verification module 2, and the verification module 2 verifies the file X to be verified to generate a second verification code. Further, the verification module 2 obtains the second verification code by performing hash calculation on the file X to be verified, and the hash calculation value is unique.

进一步的,校验模块2从服务模块获取所述待校验文件X保存在属性列表中的所述第一校验码,将所述第二校验码与所述第一校验码进行比较,得到比较结果,基于所述比较结果确定所述待校验文件X是否完整,并记录所述比较结果。具体的,若所述第一校验码和所述第二校验码一致,则确定所述待校验文件X是完整的;若所述第一校验码和所述第二校验码不一致,则确定所述待校验文件X不完整,对所述待校验文件X进行修复。Further, the verification module 2 obtains the first verification code stored in the attribute list of the file X to be verified from the service module, and compares the second verification code with the first verification code , to obtain a comparison result, determine whether the file X to be verified is complete based on the comparison result, and record the comparison result. Specifically, if the first verification code is consistent with the second verification code, it is determined that the file X to be verified is complete; if the first verification code and the second verification code If not, it is determined that the file X to be verified is incomplete, and the file X to be verified is repaired.

本实施例中,在对所述待校验文件X的校验过程中,设置了窗口,将所述窗口后仍保持未被打开的目标文件X确定为待校验文件X,并且多次读取所述待校验文件X的状态信息,以保证所述待校验文件X保持为未被打开状态。也就说,本实施例中的文件校验方法针对的是未被打开的文件,这样能够减少资源的浪费,并且不会影响上层正常的业务。In this embodiment, during the verification process of the file X to be verified, a window is set, and the target file X that remains unopened after the window is determined as the file X to be verified, and read multiple times Obtain the state information of the file X to be verified to ensure that the file X to be verified remains unopened. That is to say, the file verification method in this embodiment is aimed at unopened files, which can reduce the waste of resources and will not affect the normal business of the upper layer.

实施例三、Embodiment three,

为实现上述文件校验方法,本发明实施例还提供了一种文件校验装置,所述装置的组成结构示意图如图6所示,包括:读取模块61、第一生成模块62和判别模块63;其中,In order to realize the above-mentioned file verification method, an embodiment of the present invention also provides a file verification device. The schematic diagram of the composition and structure of the device is shown in Figure 6, including: a reading module 61, a first generation module 62 and a discrimination module 63; among them,

所述读取模块61,用于在第一时刻读取待校验文件的状态信息;The reading module 61 is used to read the status information of the file to be verified at the first moment;

所述第一生成模块62,用于基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成第二校验码;The first generation module 62 is configured to determine that the file to be verified has not been opened based on the status information of the file to be verified, then verify the file to be verified, and generate a second verification code ;

所述判别模块63,用于将所述第二校验码与已保存的所述待校验文件的第一校验码进行比较,得到比较结果,基于所述比较结果确定所述待校验文件是否完整。The discrimination module 63 is configured to compare the second verification code with the saved first verification code of the file to be verified to obtain a comparison result, and determine the verification code based on the comparison result Whether the file is complete.

具体的,所述判别模块63在确定所述待校验文件未被打开后,通过对所述待校验文件进行散列计算得到所述第二校验码。其中,所述散列计算可以采用MD5算法,所述散列计算的值具有唯一性。Specifically, after the determination module 63 determines that the file to be verified has not been opened, it obtains the second verification code by performing hash calculation on the file to be verified. Wherein, the hash calculation may adopt the MD5 algorithm, and the value of the hash calculation is unique.

这里,所述判别模块63,具体用于若所述第一校验码和所述第二校验码一致,则确定所述待校验文件是完整的;若所述第一校验码和所述第二校验码不一致,则确定所述待校验文件不完整,对所述待校验文件进行修复。Here, the discrimination module 63 is specifically configured to determine that the file to be verified is complete if the first verification code is consistent with the second verification code; If the second verification code is inconsistent, it is determined that the file to be verified is incomplete, and the file to be verified is repaired.

这里,所述读取模块61,读取所述待校验文件的描述符。根据所述待校验文件描述符的状态,确定所述待校验文件的状态信息。Here, the reading module 61 reads the descriptor of the file to be verified. Determine the state information of the file to be verified according to the state of the file descriptor to be verified.

进一步的,所述装置还包括确定模块64,用于在第二时刻读取目标文件的状态信息;其中,所述第二时刻早于所述第一时刻;基于所述目标文件的状态信息,确定所述目标文件未被打开,则开启针对所述目标文件的窗口;在所述针对所述目标文件的窗口结束之后,读取所述目标文件的状态信息;当所述目标文件的状态信息表征所述目标文件保持为未被打开的状态时,将所述目标文件确定为待校验文件。Further, the device further includes a determination module 64, configured to read the state information of the target file at a second moment; wherein, the second moment is earlier than the first moment; based on the state information of the target file, Determine that the target file is not opened, then open the window for the target file; after the end of the window for the target file, read the status information of the target file; when the status information of the target file When it is indicated that the target file remains unopened, the target file is determined as the file to be verified.

具体的,所述确定模块64在第二时刻读取目标文件的状态信息,基于所述目标文件的状态信息,确定所述文件为被打开,则开启针对所述目标文件的窗口;若基于所述目标文件的状态,确定所述文件被打开,则结束校验过程。进一步的,针对所述目标文件的窗口结束之后,读取所述目标文件的状态信息。当所述目标文件的状态信息表征所述目标文件保持为未被打开的状态时,将所述目标文件确定为待校验文件;若所述目标文件的处于被打开状态,则结束校验过程,将所述目标文件移出窗口,记录所述目标文件的此时状态信息。Specifically, the determination module 64 reads the state information of the target file at the second moment, and determines that the file is opened based on the state information of the target file, then opens a window for the target file; The status of the target file is determined, and the verification process is ended if it is determined that the file is opened. Further, after the window for the target file ends, read the state information of the target file. When the state information of the target file indicates that the target file remains unopened, the target file is determined as the file to be verified; if the target file is in the opened state, the verification process is ended , move the target file out of the window, and record the status information of the target file at this time.

进一步的,所述装置还包括第二生成模块65,用于在第三时刻读取所述待校验文件的状态信息;其中,所述第三时刻早于所述第一时刻,所述第三时刻晚于所述第二时刻;基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成所述第一校验码,并将所述第一校验码作为所述待校验文件的一种属性信息进行保存。Further, the device further includes a second generation module 65, configured to read the status information of the file to be verified at a third moment; wherein, the third moment is earlier than the first moment, and the second The third time is later than the second time; based on the state information of the file to be verified, it is determined that the file to be verified has not been opened, then the file to be verified is verified, and the first proof is generated. code verification, and save the first verification code as a kind of attribute information of the file to be verified.

具体的,所述第二生成模块65在第三时刻读取所述待校验文件的状态信息。基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成所述第一校验码,并将所述第一校验码作为所述待校验文件的一种属性信息进行保存;基于所述待校验文件的状态信息,确定所述待校验文件被打开,则结束校验过程。其中,所述第一校验码作为所述待校验文件的一种属性信息,保存到所述待校验文件的属性信息列表中。Specifically, the second generation module 65 reads the state information of the file to be verified at the third moment. Based on the status information of the file to be verified, it is determined that the file to be verified has not been opened, then the file to be verified is verified, the first verification code is generated, and the first verification code is The verification code is saved as a kind of attribute information of the file to be verified; based on the state information of the file to be verified, it is determined that the file to be verified is opened, and the verification process ends. Wherein, the first verification code is saved in the attribute information list of the file to be verified as a kind of attribute information of the file to be verified.

进一步的,图6中的文件校验装置的结构组成还应用于图7中所示的结构组成,具体包括:所述读取模块61、第一生成模块62、判别模块63、确定模块64及第二生成模块65。Further, the structural composition of the file verification device in FIG. 6 is also applied to the structural composition shown in FIG. 7, specifically including: the reading module 61, the first generation module 62, the discrimination module 63, the determination module 64 and The second generation module 65 .

另外,本实施例的具体实施过程在前面的技术方案中已详细阐明,这里不再进行赘述。In addition, the specific implementation process of this embodiment has been explained in detail in the previous technical solutions, and will not be repeated here.

在实际应用中,所述读取模块61、第一生成模块62、判别模块63、确定模块64及第二生成模块65均可由位于服务器或终端的中央处理器(CPU,Central Processing Unit)、微处理器(MPU,Micro Processor Unit)、数字信号处理器(DSP,Digital SignalProcessor)、或现场可编程门阵列(FPGA,Field Programmable Gate Array)等实现。In practical applications, the reading module 61, the first generation module 62, the discrimination module 63, the determination module 64 and the second generation module 65 can all be located at the central processing unit (CPU, Central Processing Unit) of the server or terminal, microcomputer Processor (MPU, Micro Processor Unit), digital signal processor (DSP, Digital Signal Processor), or field programmable gate array (FPGA, Field Programmable Gate Array) and other implementations.

需要说明的是:上述实施例提供的文件校验装置在进行文件校验时,仅以上述各程序模块的划分进行举例说明,实际应用中,可以根据需要而将上述处理分配由不同的程序模块完成,即将装置的内部结构划分成不同的程序模块,以完成以上描述的全部或者部分处理。另外,上述实施例提供的文件校验装置与文件校验方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that: when the file verification device provided by the above-mentioned embodiment performs file verification, the division of the above-mentioned program modules is used as an example for illustration. In practical applications, the above-mentioned processing can be assigned to different program modules according to needs. Completion means that the internal structure of the device is divided into different program modules to complete all or part of the processing described above. In addition, the file verification device and the file verification method embodiments provided in the above embodiments belong to the same idea, and the specific implementation process thereof is detailed in the method embodiments, and will not be repeated here.

为实现上述方法,本发明实施例还提供了另一种文件校验装置,该装置包括存储器、处理器及存储在存储器上并能够由所述处理器运行的可执行程序,所述处理器运行所述可执行程序时,执行以下操作:In order to implement the above method, the embodiment of the present invention also provides another file verification device, which includes a memory, a processor, and an executable program stored on the memory and capable of being run by the processor, and the processor runs When the executable program is executed, do the following:

在第一时刻读取待校验文件的状态信息;Read the status information of the file to be verified at the first moment;

基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成第二校验码;Based on the status information of the file to be verified, it is determined that the file to be verified has not been opened, then verifying the file to be verified to generate a second verification code;

将所述第二校验码与已保存的所述待校验文件的第一校验码进行比较,得到比较结果,基于所述比较结果确定所述待校验文件是否完整。Comparing the second verification code with the saved first verification code of the file to be verified to obtain a comparison result, and determining whether the file to be verified is complete based on the comparison result.

所述处理器还用于运行所述可执行程序时,执行以下操作:The processor is also configured to perform the following operations when running the executable program:

若所述第一校验码和所述第二校验码一致,则确定所述待校验文件是完整的;If the first verification code is consistent with the second verification code, it is determined that the file to be verified is complete;

若所述第一校验码和所述第二校验码不一致,则确定所述待校验文件不完整,对所述待校验文件进行修复。If the first verification code is inconsistent with the second verification code, it is determined that the file to be verified is incomplete, and the file to be verified is repaired.

所述处理器还用于运行所述可执行程序时,执行以下操作:The processor is also configured to perform the following operations when running the executable program:

在第二时刻读取目标文件的状态信息;其中,所述第二时刻早于所述第一时刻;Reading the state information of the target file at a second moment; wherein, the second moment is earlier than the first moment;

基于所述目标文件的状态信息,确定所述目标文件未被打开,则开启针对所述目标文件的窗口;Based on the status information of the target file, it is determined that the target file is not opened, and then a window for the target file is opened;

在所述针对所述目标文件的窗口结束之后,读取所述目标文件的状态信息;After the window for the target file ends, read the state information of the target file;

当所述目标文件的状态信息表征所述目标文件保持为未被打开的状态时,将所述目标文件确定为待校验文件。When the state information of the target file indicates that the target file remains unopened, the target file is determined as the file to be verified.

所述处理器还用于运行所述可执行程序时,执行以下操作:The processor is also configured to perform the following operations when running the executable program:

在第三时刻读取所述待校验文件的状态信息;其中,所述第三时刻早于所述第一时刻,所述第三时刻晚于所述第二时刻;Reading the status information of the file to be verified at a third moment; wherein, the third moment is earlier than the first moment, and the third moment is later than the second moment;

基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成所述第一校验码,并将所述第一校验码作为所述待校验文件的一种属性信息进行保存。Based on the status information of the file to be verified, it is determined that the file to be verified has not been opened, then the file to be verified is verified, the first verification code is generated, and the first verification code is The verification code is saved as a kind of attribute information of the file to be verified.

下面以文件校验装置实施为用于文件校验的服务器或终端为例,对该文件校验装置的硬件结构做进一步说明。The hardware structure of the file verification device will be further described below by taking the file verification device implemented as a server or terminal for file verification as an example.

图8给出了本发明实施例的文件校验装置的硬件结构示意图,图8所示的文件校验装置800包括:至少一个处理器801、存储器802、用户接口803和至少一个网络接口804。所述文件校验装置800中的各个组件通过总线系统805耦合在一起。可理解,总线系统805用于实现这些组件之间的连接通信。总线系统805除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图8中将各种总线都标为总线系统805。FIG. 8 shows a schematic diagram of the hardware structure of a file verification device according to an embodiment of the present invention. Thefile verification device 800 shown in FIG. Various components in thefile checking device 800 are coupled together through abus system 805 . It can be understood that thebus system 805 is used to realize connection and communication between these components. In addition to the data bus, thebus system 805 also includes a power bus, a control bus and a status signal bus. However, the various buses are labeled asbus system 805 in FIG. 8 for clarity of illustration.

其中,用户接口803可以包括显示器、键盘、鼠标、轨迹球、点击轮、按键、按钮、触感板或者触摸屏等。Wherein, theuser interface 803 may include a display, a keyboard, a mouse, a trackball, a click wheel, keys, buttons, a touch panel or a touch screen, and the like.

可以理解,存储器802可以是易失性存储器或非易失性存储器,也可包括易失性和非易失性存储器两者。It can be understood that thememory 802 may be a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories.

本发明实施例中的存储器802用于存储各种类型的数据以支持文件校验装置800的操作。这些数据的示例包括:用于在文件校验装置800上操作的任何计算机程序,如可执行程序8021,实现本发明实施例方法的程序可以包含在可执行程序8021中。Thememory 802 in the embodiment of the present invention is used to store various types of data to support the operation of thefile verification apparatus 800 . Examples of these data include: any computer program for operating on thefile verification device 800, such as anexecutable program 8021, and the program for implementing the method of the embodiment of the present invention may be included in theexecutable program 8021.

上述本发明实施例揭示的方法可以应用于处理器801中,或者由处理器801实现。处理器801可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器801中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器801可以是通用处理器、DSP,或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。处理器801可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本发明实施例所公开的方法的步骤,可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于存储介质中,该存储介质位于存储器802,处理器801读取存储器802中的信息,结合其硬件完成前述方法的步骤。The methods disclosed in the foregoing embodiments of the present invention may be applied to theprocessor 801 or implemented by theprocessor 801 . Theprocessor 801 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by an integrated logic circuit of hardware in theprocessor 801 or instructions in the form of software. Theaforementioned processor 801 may be a general processor, DSP, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. Theprocessor 801 may implement or execute various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the methods disclosed in the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, and the storage medium is located in thememory 802. Theprocessor 801 reads the information in thememory 802, and completes the steps of the foregoing method in combination with its hardware.

在示例性实施例中,本发明实施例还提供了一种存储介质,其上存储有可执行程序,所述可执行程序在处理器运行时,执行前述方法。In an exemplary embodiment, the embodiment of the present invention further provides a storage medium on which an executable program is stored, and when the executable program is run by a processor, the aforementioned method is executed.

本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或可执行程序产品。因此,本发明可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的可执行程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, systems, or executable program products. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of an executable program product embodied on one or more computer-usable storage media (including but not limited to magnetic disk storage, optical storage, etc.) having computer-usable program code embodied therein.

本发明是参照根据本发明实施例的方法、设备(系统)、和可执行程序产品的流程图和/或方框图来描述的。应理解可由可执行程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些可执行程序指令到通用计算机、专用计算机、嵌入式处理机或参考可编程数据处理设备的处理器以产生一个机器,使得通过计算机或参考可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and executable program products according to embodiments of the invention. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by executable program instructions. These executable program instructions can be provided to a general purpose computer, special purpose computer, embedded processor or processor of a reference programmable data processing device to produce a machine such that the instructions executed by the computer or a processor of a reference programmable data processing device produce Means for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些可执行程序指令也可存储在能引导计算机或参考可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These executable program instructions may also be stored in a computer-readable memory capable of directing a computer or reference programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the The instruction means implements the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些可执行程序指令也可装载到计算机或参考可编程数据处理设备上,使得在计算机或参考可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或参考可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These executable program instructions can also be loaded onto a computer or reference programmable data processing device, causing a series of operational steps to be performed on the computer or reference programmable device to produce a computer-implemented process for execution on the computer or reference programmable device The instructions provide steps for implementing the functions specified in the procedure or procedures of the flowchart and/or the block or blocks of the block diagram.

以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention.

Claims (6)

Translated fromChinese
1.一种文件校验方法,其特征在于,所述方法包括:1. A file verification method, characterized in that the method comprises:在第二时刻读取目标文件的状态信息;Read the status information of the target file at the second moment;基于所述目标文件的状态信息,确定所述目标文件未被打开,则开启针对所述目标文件的窗口;Based on the status information of the target file, it is determined that the target file is not opened, and then a window for the target file is opened;在针对所述目标文件的窗口结束之后,读取所述目标文件的状态信息;After the window for the target file ends, read the state information of the target file;当所述目标文件的状态信息表征所述目标文件保持为未被打开的状态时,将所述目标文件确定为待校验文件;When the status information of the target file indicates that the target file remains unopened, determining the target file as the file to be verified;在晚于所述第二时刻的第三时刻读取所述待校验文件的状态信息;reading the status information of the file to be verified at a third moment later than the second moment;基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成第一校验码,并将所述第一校验码作为所述待校验文件的一种属性信息进行保存;Based on the state information of the file to be verified, it is determined that the file to be verified has not been opened, then the file to be verified is verified, a first verification code is generated, and the first verification code is Save as a kind of attribute information of the file to be verified;在第一时刻读取所述待校验文件的状态信息;其中,所述第一时刻晚于所述第三时刻;Reading the status information of the file to be verified at a first moment; wherein, the first moment is later than the third moment;基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成第二校验码;Based on the status information of the file to be verified, it is determined that the file to be verified has not been opened, then verifying the file to be verified to generate a second verification code;将所述第二校验码与已保存的所述待校验文件的所述第一校验码进行比较,得到比较结果,基于所述比较结果确定所述待校验文件是否完整。comparing the second verification code with the saved first verification code of the file to be verified to obtain a comparison result, and determining whether the file to be verified is complete based on the comparison result.2.根据权利要求1所述的方法,其特征在于,所述基于所述比较结果确定所述待校验文件是否完整,包括:2. The method according to claim 1, wherein the determining whether the file to be verified is complete based on the comparison result comprises:若所述第一校验码和所述第二校验码一致,则确定所述待校验文件是完整的;If the first verification code is consistent with the second verification code, it is determined that the file to be verified is complete;若所述第一校验码和所述第二校验码不一致,则确定所述待校验文件不完整,对所述待校验文件进行修复。If the first verification code is inconsistent with the second verification code, it is determined that the file to be verified is incomplete, and the file to be verified is repaired.3.一种文件校验装置,其特征在于,所述装置包括:确定模块、第二生成模块、读取模块、第一生成模块和判别模块;其中,3. A file verification device, characterized in that the device comprises: a determination module, a second generation module, a reading module, a first generation module and a discrimination module; wherein,所述确定模块,用于在第二时刻读取目标文件的状态信息;基于所述目标文件的状态信息,确定所述目标文件未被打开,则开启针对所述目标文件的窗口;在所述针对所述目标文件的窗口结束之后,读取所述目标文件的状态信息;当所述目标文件的状态信息表征所述目标文件保持为未被打开的状态时,将所述目标文件确定为待校验文件;The determination module is configured to read the status information of the target file at the second moment; based on the status information of the target file, it is determined that the target file is not opened, and then a window for the target file is opened; After the window for the target file ends, read the state information of the target file; when the state information of the target file indicates that the target file remains unopened, determine the target file as pending verification file;所述第二生成模块,用于在晚于所述第二时刻的第三时刻读取所述待校验文件的状态信息;基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成第一校验码,并将所述第一校验码作为所述待校验文件的一种属性信息进行保存;The second generation module is configured to read the state information of the file to be verified at a third moment later than the second moment; determine the state information of the file to be verified based on the state information of the file to be verified If the file is not opened, then verify the file to be verified, generate a first verification code, and save the first verification code as a kind of attribute information of the file to be verified;所述读取模块,用于在第一时刻读取所述待校验文件的状态信息;其中,所述第一时刻晚于所述第三时刻;The reading module is configured to read the state information of the file to be verified at a first moment; wherein, the first moment is later than the third moment;所述第一生成模块,用于基于所述待校验文件的状态信息,确定所述待校验文件未被打开,则对所述待校验文件进行校验,生成第二校验码;The first generation module is configured to determine that the file to be verified has not been opened based on the status information of the file to be verified, then verify the file to be verified, and generate a second verification code;所述判别模块,用于将所述第二校验码与已保存的所述待校验文件的所述第一校验码进行比较,得到比较结果,基于所述比较结果确定所述待校验文件是否完整。The discrimination module is used to compare the second verification code with the saved first verification code of the file to be verified to obtain a comparison result, and determine the to-be-verified file based on the comparison result Verify that the file is complete.4.根据权利要求3所述的装置,其特征在于,所述判别模块,具体用于若所述第一校验码和所述第二校验码一致,则确定所述待校验文件是完整的;若所述第一校验码和所述第二校验码不一致,则确定所述待校验文件不完整,对所述待校验文件进行修复。4. The device according to claim 3, wherein the discrimination module is specifically configured to determine that the file to be verified is Complete; if the first check code is inconsistent with the second check code, it is determined that the file to be checked is incomplete, and the file to be checked is repaired.5.一种存储介质,其上存储有可执行程序,其特征在于,所述可执行程序被处理器执行时实现权利要求1或2所述方法的步骤。5. A storage medium on which an executable program is stored, wherein the executable program implements the steps of the method according to claim 1 or 2 when the executable program is executed by a processor.6.一种文件校验装置,包括存储器、处理器及存储在存储器上并能够由所述处理器运行的可执行程序,其特征在于,所述处理器运行所述可执行程序时执行权利要求1或2所述方法的步骤。6. A file verification device, comprising a memory, a processor, and an executable program stored on the memory and capable of being run by the processor, wherein the processor executes the claim when running the executable program 1 or 2 the steps of the method.
CN201910817324.7A2019-08-302019-08-30File checking method and device and storage mediumActiveCN112445761B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201910817324.7ACN112445761B (en)2019-08-302019-08-30File checking method and device and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201910817324.7ACN112445761B (en)2019-08-302019-08-30File checking method and device and storage medium

Publications (2)

Publication NumberPublication Date
CN112445761A CN112445761A (en)2021-03-05
CN112445761Btrue CN112445761B (en)2023-04-07

Family

ID=74735184

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201910817324.7AActiveCN112445761B (en)2019-08-302019-08-30File checking method and device and storage medium

Country Status (1)

CountryLink
CN (1)CN112445761B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114356857B (en)*2021-12-232025-06-17中国航空工业集团公司西安航空计算技术研究所 A method for improving file system reliability based on bitmap mapping table mechanism
CN117076706A (en)*2023-10-082023-11-17河北安在信息技术有限公司 Court trial data management methods and devices, electronic equipment, storage media

Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20090199039A1 (en)*2008-02-062009-08-06Inventec CorporationFile data restoring system and method of computer operating system and software thereof
CN108108260A (en)*2016-11-252018-06-01沈阳美行科技有限公司The method of calibration and device of a kind of resource file
CN109582907A (en)*2018-12-062019-04-05深圳前海微众银行股份有限公司Method of calibration, device, equipment and the readable storage medium storing program for executing of web page resources integrality

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20090199039A1 (en)*2008-02-062009-08-06Inventec CorporationFile data restoring system and method of computer operating system and software thereof
CN108108260A (en)*2016-11-252018-06-01沈阳美行科技有限公司The method of calibration and device of a kind of resource file
CN109582907A (en)*2018-12-062019-04-05深圳前海微众银行股份有限公司Method of calibration, device, equipment and the readable storage medium storing program for executing of web page resources integrality

Also Published As

Publication numberPublication date
CN112445761A (en)2021-03-05

Similar Documents

PublicationPublication DateTitle
CN107577427B (en)data migration method, device and storage medium for blockchain system
RU2554847C2 (en)Reference points for file system
CN103729442B (en)Record the method and database engine of transaction journal
CN108681565B (en)Block chain data parallel processing method, device, equipment and storage medium
US8281229B2 (en)Firmware verification using system memory error check logic
CN110928559A (en)Data burning method and device, electronic equipment and storage medium
CN110443712A (en)Contract conflict detection method and device, readable storage medium and computer equipment
CN107346268B (en)Generalized write operation verification method
CN112445761B (en)File checking method and device and storage medium
CN101763318B (en)Data dumping method and data dumping device
CN110457353A (en)Contract data processing method and device, computer readable storage medium and computer equipment
CN111782353A (en) Migration method and apparatus from public cloud to private cloud
CN107729541A (en)A kind of data processing method, device and computer-readable recording medium
CN112231403B (en)Consistency verification method, device, equipment and storage medium for data synchronization
CN105608150A (en)Business data processing method and system
WO2016127557A1 (en)Method for re-establishing standby database, and apparatus thereof
WO2021129005A1 (en)Blockchain state change-based transaction tracking method and device
CN119105799A (en) Code analysis method, electronic device, and computer readable medium
US11822663B2 (en)Supervisor-based firmware hardening
WO2023030013A1 (en)Data processing method and apparatus
CN114816478A (en)Offline resource packet difference method, device, equipment and medium
CN112433675B (en)Storage space optimization method and system for super fusion architecture
CN112766875B (en) Document data processing method, device, computer equipment and storage medium
CN111310238B (en)File management method and device
JP5017396B2 (en) Information processing apparatus and program verification method

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp