Data integrity determination method, device, computer equipment and storage medium
By monitoring interrupts in real time when receiving data and determining interrupt types based on status registers, the problems of storage resource occupation and server development complexity during data integrity determination in the prior art are solved, and efficient data integrity judgment is achieved.
Patent Information
- Application Number
- CN202210025604.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-11
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2042-01-11
AI Technical Summary
The prior art occupies a lot of storage resources when determining data integrity, and the communication protocols in different communication scenarios are different, which increases the complexity of server development.
By monitoring whether an interrupt occurs in real time during the reception of data, the interrupt type is determined based on the status of the status register. If it is a timeout interrupt, the data is determined to be complete, and if it is a data interrupt, the data is determined to be incomplete.
Effectively determine the integrity of data while reducing storage resource usage without increasing the complexity of server development.
Smart Images

Figure CN114372298B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a method, device, computer equipment and storage medium for determining data integrity. Background Art
[0002] In the prior art, the integrity of received data is determined through communication protocols, such as adding verification data to the data and determining the integrity of the data based on the verification data. However, the above solution will occupy more storage resources, and the communication protocols in different communication scenarios are different, which increases the complexity of server development. Therefore, how to determine the integrity of data while reducing the occupation of storage resources and not increasing the complexity of server development is a technical problem that needs to be solved urgently. Summary of the invention
[0003] One of the purposes of the present application is to provide a method, apparatus, computer device and storage medium for determining data integrity, so as to solve the problem of how to determine data integrity while reducing the usage of storage resources and without increasing the complexity of server development.
[0004] In a first aspect, an embodiment of the present application provides a method for determining data integrity, which is applied to a server, wherein the server includes a status register, including:
[0005] Receive data;
[0006] Real-time monitoring of whether interruptions occur during data reception;
[0007] If yes, determining the type of the interrupt according to the state of the status register, wherein the state includes a timeout state and a non-timeout state, and the type includes a timeout interrupt and a data interrupt;
[0008] If the type is the timeout interrupt, determining that the data is complete;
[0009] If the type is the data interruption, it is determined that the data is incomplete.
[0010] In an optional implementation, determining the type of the interrupt according to the state of the status register includes:
[0011] Obtaining the status of the status register;
[0012] If the state is a timeout state, determining the type is a timeout interrupt;
[0013] If the state is not a timeout state, the type is determined to be a data interruption.
[0014] In an optional implementation, the server further includes a data storage device, and before obtaining the status of the status register, the step further includes:
[0015] extracting target data from the data storage according to preset rules;
[0016] Count the number of extractions;
[0017] If the number of times is equal to a preset threshold, the step of obtaining the state of the state register is performed, wherein the preset threshold includes a data interruption threshold minus one.
[0018] In an optional implementation, after counting the number of extractions, the method further includes:
[0019] If the number is less than the preset threshold, determining whether the data storage is empty;
[0020] If so, determining that the type is a timeout interrupt;
[0021] If not, the step of extracting target data from the data storage according to a preset rule is executed.
[0022] In an optional implementation manner, if the type is the data interruption, after determining that the data is incomplete, the method further includes:
[0023] The step of monitoring in real time whether an interruption occurs during the process of receiving data is performed.
[0024] In a second aspect, an embodiment of the present application provides a device for determining data integrity, which is applied to a server, wherein the server includes a status register, including:
[0025] A receiving module, used for receiving data;
[0026] A monitoring module is used to monitor in real time whether an interruption occurs during the process of receiving data;
[0027] A state determination module, for determining the type of the interrupt according to the state of the state register, wherein the state includes a timeout state and a non-timeout state, and the type includes a timeout interrupt and a data interrupt;
[0028] A complete determination module, configured to determine that the data is complete if the type is the timeout interrupt;
[0029] An incomplete determination module is used to determine that the data is incomplete if the type is the data interruption.
[0030] In an optional implementation, the state determination module includes:
[0031] A status acquisition submodule, used to acquire the status of the status register;
[0032] A timeout interrupt determination submodule, configured to determine the type as a timeout interrupt if the state is a timeout state;
[0033] The data interruption determination submodule is used to determine that the type is a data interruption if the state is a non-timeout state.
[0034] In an optional implementation, the server further includes a data storage device, and the state determination module further includes:
[0035] An extraction submodule, used for extracting the data from the data storage according to a preset rule;
[0036] The statistics submodule is used to count the number of extractions;
[0037] The status judgment submodule is used to execute the step of obtaining the status of the status register if the number of times is equal to a preset threshold, wherein the preset threshold includes a data interruption threshold minus one.
[0038] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the method for determining data integrity as described in the first aspect is implemented.
[0039] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method for determining data integrity described in the first aspect is implemented.
[0040] The embodiments of the present application provide a method, device, computer equipment and storage medium for determining data integrity. The method includes: receiving data; monitoring in real time whether an interruption occurs during the process of receiving data; if so, determining the type of the interruption according to the state of the status register, wherein the state includes a timeout state and a non-timeout state, and the type includes a timeout interruption and a data interruption; if the type is the timeout interruption, determining that the data is complete; if the type is the data interruption, determining that the data is incomplete. By monitoring in real time whether an interruption occurs during the process of receiving data, and if an interruption occurs, determining the integrity of the data according to the type of interruption, the integrity of the data can be determined while reducing the occupation of storage resources and without increasing the complexity of server development. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present application and should not be regarded as limiting the scope of protection of the present application. In each of the drawings, similar components are numbered similarly.
[0042] Figure 1 A schematic block diagram showing the steps of a method for determining data integrity provided by an embodiment of the present application is shown;
[0043] Figure 2 A schematic block diagram of the structure of a data integrity determination device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0044] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0045] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0046] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present application, are intended only to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations of the foregoing items.
[0047] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.
[0048] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.
[0049] Example 1
[0050] Please refer to Figure 1 , Figure 1 A schematic block diagram showing the steps of a method for determining data integrity provided in an embodiment of the present application is shown.
[0051] like Figure 1 As shown, a method for determining data integrity provided in an embodiment of the present application can be applied to a server, wherein the server includes a status register, and the method includes S110 to S150.
[0052] S110: receiving data.
[0053] In this embodiment, the server receives data via a serial interface. The server also includes a data storage device, and the server stores the received data in the data storage device.
[0054] S120: During the process of receiving data, monitor in real time whether an interruption occurs.
[0055] In this embodiment, the server monitors in real time whether an interrupt is sent during the process of receiving data, which provides a basis for subsequently determining the type of the interrupt.
[0056] S130: If yes, determine the type of the interrupt according to the state of the status register, wherein the state includes a timeout state and a non-timeout state, and the type includes a timeout interrupt and a data interrupt.
[0057] In this embodiment, if the server detects that an interrupt has occurred, the type of the interrupt is determined according to the state of the status register, thereby providing a basis for subsequently determining the integrity of the data.
[0058] In an optional implementation, determining the type of the interrupt according to the state of the status register includes:
[0059] Obtaining the status of the status register;
[0060] If the state is a timeout state, determining the type is a timeout interrupt;
[0061] If the state is not a timeout state, the type is determined to be a data interruption.
[0062] Specifically, in a normal transmission process, a complete character of data is transmitted continuously. The timeout interrupt refers to an interruption that occurs when the server does not receive the next character within a preset time after receiving a character. The preset time can be set according to actual needs and is not limited here. Exemplarily, the preset time is the reception time of 5 to 8 characters.
[0063] Furthermore, the data interruption refers to an interruption that occurs when the number of characters received by the server is equal to a data interruption threshold. The data interruption threshold can be set according to actual needs and is not limited here. As an example, the data interruption threshold is 16 characters.
[0064] Furthermore, in this embodiment, the data interruption threshold is less than the storage threshold of the data memory, wherein the storage threshold is the maximum number of characters stored in the data memory, for example, the storage threshold is 32 characters.
[0065] It is understandable that when no interruption occurs, the status register maintains a non-timeout state, and when a timeout interruption occurs, the state of the status register switches from a non-timeout state to a timeout state. Therefore, the type of the interruption can be determined according to the state of the status register.
[0066] In the above implementation mode, when the length of the data is the data interruption threshold, only a data interruption occurs, and no timeout interruption occurs, so that the data is determined to be incomplete, and the determination of the data integrity is inaccurate. In order to improve the accuracy of the data integrity determination, before obtaining the state of the status register, it also includes:
[0067] extracting target data from the data storage according to preset rules;
[0068] Count the number of extractions;
[0069] If the number of times is equal to a preset threshold, the step of obtaining the state of the state register is performed, wherein the preset threshold includes a data interruption threshold minus one.
[0070] In this embodiment, the preset rule is to use one character in the data extracted each time as the target data, and the number of times is less than or equal to the preset threshold. If the number of times is equal to the preset threshold, the state of the status register is obtained. When the state is a timeout state, the type is determined to be the timeout interrupt; when the state is a non-timeout state, the type is determined to be a data interrupt.
[0071] Preferably, the data memory is a first-in first-out (FIFO) memory.
[0072] In an optional implementation, after counting the number of extractions, the method further includes:
[0073] If the number is less than the preset threshold, determining whether the data storage is empty;
[0074] If so, determining that the type is a timeout interrupt;
[0075] If not, the step of extracting target data from the data storage according to a preset rule is executed.
[0076] Specifically, if the number of times is less than the preset threshold and the data storage device is empty, it means that all the data has been extracted. Since the number of times is less than the preset threshold, that is, the number of times is less than the data interruption threshold, the condition for the data interruption to occur is not met. Therefore, the type of interruption is a timeout interruption.
[0077] Furthermore, if the number of times is less than the preset threshold and the data storage is not empty, it means that the data has not been completely extracted, and the target data is extracted from the data storage according to the preset rules.
[0078] Still taking the data interruption threshold as 16 characters and the preset threshold as 15 characters as an example, when the length of a data is 16 characters, the target data extracted from the data storage device for the first time is the first character of the data, and the number of extractions is 1. At this time, the number is less than the preset threshold, and the data storage device is not empty. The target data extracted from the data storage device is the second character of the data, and the number of extractions is 2. The above process is repeated until the number is 15, and the state of the status register is obtained. The state is a non-timeout state, and the type is determined to be a data interruption. After the next interruption is detected, the target data extracted from the data storage device for the first time is the last character of the data, and the number of data extractions is 1. At this time, the number is less than the preset threshold, and the data storage device is empty, and the type is determined to be a timeout interruption.
[0079] It can be understood that by setting the preset threshold to the data interruption threshold minus one, when the length of the data is the data interruption threshold, the last interruption that occurs is a timeout interruption, so that the data is determined to be complete, thereby improving the accuracy of the data integrity determination.
[0080] S140: If the type is the timeout interrupt, determine that the data is complete.
[0081] S150: If the type is data interruption, determine that the data is incomplete.
[0082] In this embodiment, the integrity of the data is determined according to the type of interruption, which can determine the integrity of the data while reducing the occupation of storage resources and without increasing the complexity of server development.
[0083] In an optional implementation manner, if the type is the data interruption, after determining that the data is incomplete, the method further includes:
[0084] The step of monitoring in real time whether an interruption occurs during the process of receiving data is performed.
[0085] Specifically, after the server determines that the data is incomplete, it detects in real time whether an interruption occurs during the process of receiving the data, and if so, repeatedly executes S130 to S150 until it determines that the data is complete.
[0086] The embodiment of the present application provides a method for determining data integrity, the method comprising: receiving data; monitoring in real time whether an interruption occurs during the process of receiving data; if so, determining the type of the interruption according to the state of the status register, wherein the state includes a timeout state and a non-timeout state, and the type includes a timeout interruption and a data interruption; if the type is the timeout interruption, determining that the data is complete; if the type is the data interruption, determining that the data is incomplete. By monitoring in real time whether an interruption occurs during the process of receiving data, if an interruption occurs, determining the integrity of the data according to the type of interruption, the integrity of the data can be determined while reducing the occupation of storage resources and without increasing the complexity of server development.
[0087] Example 2
[0088] Please refer to Figure 2 , Figure 2 The structure schematic block diagram of a data integrity determination device provided in an embodiment of the present application is shown. The data integrity determination device 500 can be applied to a server, the server includes a status register, and the data integrity determination device 500 includes a receiving module 510, a monitoring module 520, a status determination module 530, a complete determination module 540, and an incomplete determination module 550.
[0089] Wherein, the receiving module 510 is used to receive data;
[0090] The monitoring module 520 is used to monitor in real time whether an interruption occurs during the process of receiving data;
[0091] The state determination module 530 is used to determine the type of the interrupt according to the state of the state register, wherein the state includes a timeout state and a non-timeout state, and the type includes a timeout interrupt and a data interrupt;
[0092] The complete determination module 540 is used to determine that the data is complete if the type is the timeout interrupt;
[0093] The incomplete determination module 550 is configured to determine that the data is incomplete if the type is the data interruption.
[0094] Optionally, the state determination module 530 includes:
[0095] A status acquisition submodule, used to acquire the status of the status register;
[0096] A timeout interrupt determination submodule, configured to determine the type as a timeout interrupt if the state is a timeout state;
[0097] The data interruption determination submodule is used to determine that the type is a data interruption if the state is a non-timeout state.
[0098] Optionally, the server further includes a data storage device, and the state determination module 530 further includes:
[0099] An extraction submodule, used for extracting the data from the data storage according to a preset rule;
[0100] The statistics submodule is used to count the number of extractions;
[0101] The status judgment submodule is used to execute the step of obtaining the status of the status register if the number of times is equal to a preset threshold, wherein the preset threshold includes a data interruption threshold minus one.
[0102] The above-mentioned device is used to execute the method provided in Example 1, and its implementation principle and technical effect are similar, which will not be repeated here.
[0103] An embodiment of the present application further discloses a computer device, which includes a memory and a processor. The memory stores a computer program. When the computer program is executed by the processor, it implements the method for determining data integrity as described in Example 1.
[0104] The embodiment of the present application further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method for determining data integrity as described in Embodiment 1 is implemented.
[0105] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0106] In addition, the functional modules or units in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0107] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0108] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A method for determining data integrity, characterized in that: Applied to a server, the server comprising a status register, including: Receive data; Real-time monitoring of whether interruptions occur during data reception; If yes, determining the type of the interrupt according to the state of the status register, wherein the state includes a timeout state and a non-timeout state, and the type includes a timeout interrupt and a data interrupt; If the type is the timeout interrupt, determining that the data is complete; If the type is data interruption, determining that the data is incomplete; Determining the type of the interrupt according to the state of the status register includes: acquiring the state of the status register; if the state is a timeout state, determining the type is a timeout interrupt; if the state is a non-timeout state, determining the type is a data interrupt; The server further includes a data storage device, and before obtaining the state of the state register, the method further includes: extracting target data from the data storage device according to a preset rule; counting the number of extractions; if the number of extractions is equal to a preset threshold, executing the step of obtaining the state of the state register, wherein the preset threshold includes a data interruption threshold minus one; After counting the number of extractions, the method further includes: if the number is less than the preset threshold, determining whether the data storage device is empty; if so, determining that the type is a timeout interrupt; if not, executing the step of extracting target data from the data storage device according to preset rules.
2. The method according to claim 1, characterized in that If the type is data interruption, after determining that the data is incomplete, the method further includes: The step of monitoring in real time whether an interruption occurs during the process of receiving data is performed.
3. A device for determining data integrity, characterized in that: Applied to a server, the server comprising a status register, including: A receiving module, used for receiving data; A monitoring module is used to monitor in real time whether an interruption occurs during the process of receiving data; A state determination module, for determining the type of the interrupt according to the state of the state register, wherein the state includes a timeout state and a non-timeout state, and the type includes a timeout interrupt and a data interrupt; A complete determination module, configured to determine that the data is complete if the type is the timeout interrupt; an incomplete determination module, configured to determine that the data is incomplete if the type is the data interruption; The state determination module comprises: A status acquisition submodule, used to acquire the status of the status register; A timeout interrupt determination submodule, configured to determine the type as a timeout interrupt if the state is a timeout state; A data interruption determination submodule, configured to determine that the type is a data interruption if the state is a non-timeout state; The server further includes a data storage device, and the state determination module further includes: An extraction submodule, used for extracting the data from the data storage according to a preset rule; The statistics submodule is used to count the number of extractions; a state judgment submodule, configured to execute the step of obtaining the state of the state register if the number of times is equal to a preset threshold, wherein the preset threshold includes a data interruption threshold minus one; The state determination module is also used to determine whether the data storage is empty if the number is less than the preset threshold; if so, determine that the type is a timeout interrupt; if not, execute the step of extracting target data from the data storage according to preset rules.
4. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the method for determining data integrity as claimed in claim 1 or 2 is implemented.
5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for determining data integrity as claimed in claim 1 or 2 is implemented.
Citation Information
Patent Citations
Data receiving method and device, image forming apparatus and system, and electronic device
CN111026694A