Log backup method and device and smart card

A smart card and log technology, applied in the communication field, can solve problems such as backup time extension, large memory consumption, and inability to ensure the atomicity and integrity of restored data, so as to achieve the effect of ensuring accuracy

Inactive Publication Date: 2012-07-11
BEIJING WATCH DATA SYST
5 Cites 22 Cited by

AI-Extracted Technical Summary

Problems solved by technology

[0010] (1) Each sub-log item of the communication data is directly written into the non-volatile storage medium in turn. Therefore, it is necessary to perform multiple read or write operations on the non-volatile storage medium, which not only consumes a large memory, but also And the backup time is longer;
[0011] (2) A corresponding check value is set for each sub-log item of the communication data. Therefore, when the subsequent power failure occurs, when restoring the data in the backup area of ​​the non-volatile ...
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Abstract

The invention discloses a log backup method, a log backup device and a smart card. By the method and the device, the backup speed of data in the smart card is improved, and a memory consumed by data backup is reduced. The log backup method comprises the following steps of: dividing communication data corresponding to the current service communication into a plurality of log sub-items, and caching the log sub-items to a volatile storage medium; and when the current service communication is finished, writing the log sub-items cached in the volatile storage medium in the corresponding backup area in a non-volatile storage medium at one time.

Application Domain

Technology Topic

Image

  • Log backup method and device and smart card
  • Log backup method and device and smart card
  • Log backup method and device and smart card

Examples

  • Experimental program(1)

Example Embodiment

[0053] The embodiment of the present invention provides a method and device for realizing log backup, and a smart card, so as to increase the speed of backing up data in the smart card and reduce the memory consumed by data backup. The method for implementing log backup includes: dividing the communication data corresponding to this business communication into multiple sub-log items, and buffering the multiple sub-log items in a volatile storage medium; when this business communication ends, The multiple sub-log entries cached in the volatile storage medium are written into the corresponding backup area in the non-volatile storage medium at one time.
[0054] The technical solution of the present invention will be described in detail below in conjunction with the accompanying drawings of the specification.
[0055] See figure 2 , Is a flowchart of a method for implementing log backup in an embodiment of the present invention, including:
[0056] Step 201: Divide the communication data corresponding to this business communication into multiple sub-log items.
[0057] Step 202: Cache the multiple sub-log entries in a volatile storage medium.
[0058] Step 203: When the current business communication ends, write the multiple sub-log entries cached in the volatile storage medium into the corresponding backup area in the non-volatile storage medium at one time.
[0059] In the embodiment of the present invention, there is no need to initialize the backup area in the non-volatile storage medium.
[0060] Preferably, in the embodiment of the present invention, when storing communication data of a transaction in the corresponding backup area of ​​the non-volatile storage medium, the following data structure is adopted: the communication data is used as the parent log item, and the parent log item is set Corresponding status mark T mother , Data content length value L mother And check value C mother; Each sub-log entry includes: the identifier T of the sub-log entry child , The data content length of the sub-log entry L child , The data content of the sub-log entry V child And the starting address A of the modified data in this sub-log entry child; The data content of the parent log entry V mother That includes the corresponding sub-log entry. In the embodiment of the present invention, the status mark T corresponding to the parent log entry mother , Data length value L mother And check value C mother It can be represented by 1-byte, 2-byte and 2-byte values ​​respectively; T of the sub-log entry child , Data content length L child , Modify the starting address A of the data child 1 byte, 1 byte and 2 bytes can be used respectively. Such as image 3 As shown, the parent log entry includes: T (that is, status mark), L (data content length), V (data content), C (check value), where V includes the first sub log entry and the second sub log entry ,..., the nth sub-log entry; T1, L1, V1 and A1 constitute the first sub-log entry, T2, L2, V2, and A2 constitute the second sub-log entry, and Tn, Ln, Vn and An constitute the n-th sub-log entry Log entry.
[0061] In step 203 of the above method flow, writing the multiple sub-log entries cached in the volatile storage medium to the corresponding backup area in the non-volatile storage medium at one time specifically includes: Write the first sub-log entry of communication data in the backup area; then write the status mark T corresponding to the communication data in the backup area mother , Data length value L mother And check value C mother; Then write the other sub-log items of the communication data to the backup area in the corresponding order, and update the data length value L corresponding to the communication data after writing a sub-log item in the backup area mother And check value C mother; Before writing all sub-log entries in the communication data to the backup area, mark the status T mother Set as the first state value used to characterize that the current state is the writing state; after all the sub-log entries in the communication data are written into the backup area, the state is marked as T mother Modified to the second state value used to characterize the completion state. The specific backup process can be described in detail using the following example: suppose that the communication data of this business communication includes three sub-log items, the first sub-log item includes T1, L1, V1 and A1, and the second sub-log item includes T2, L2 , V2 and A2, the third sub log entry includes T3, L3, V3 and A3, the backup area in the non-volatile storage medium such as Figure 4A As shown, no initialization is required. The first, second, and third sub-log entries of the communication data are added to the backup area, as follows:
[0062] Step 1. Write the first sub-log entry of the communication data into the backup area, such as Figure 4B Shown
[0063] Step 2. Add the status mark T corresponding to the communication data in the backup area mother (which is Figure 4C In T), data length value L mother (which is Figure 4C L) and check value C mother (which is Figure 4C C), such as Figure 4C Shown
[0064] Step 3. Write the second sub-log entry of the communication data into the backup area, such as Figure 4D Shown
[0065] Step 4. Mark the status T corresponding to the communication data in the backup area mother , Data length value L mother And check value C mother Update.
[0066] Step 5. Write the third sub-log entry of the communication data to the backup area, such as Figure 4E Shown
[0067] Step 6. Mark the status T corresponding to the communication data in the backup area mother , Data length value L mother And check value C mother Update.
[0068] In the embodiment of the present invention, when a power failure occurs, the above method flow further includes step 204, such as Figure 5 Shown:
[0069] Step 204: Mark T according to the status in the backup area mother When it is determined that all the sub log entries of the communication data have been written into the backup area, the check value C mother Perform verification; when the verification succeeds, the communication data is restored based on the data in the backup area, and when the verification fails, the communication data is not restored based on the data in the backup area.
[0070] In the embodiment of the present invention, the non-volatile storage medium is EEPROM or FLASH.
[0071] Based on the foregoing method flow, an embodiment of the present invention also provides a device for implementing log backup. The structure of the device is as follows: Image 6 Shown, including:
[0072] The log generating unit 61 is configured to divide the communication data corresponding to this business communication into multiple sub-log items;
[0073] The data caching unit 62 is configured to cache the multiple sub-log entries generated by the log generating unit 61 in a volatile storage medium;
[0074] The data processing unit 63 is configured to write the multiple sub-log entries buffered in the data buffering unit 62 into a non-volatile storage medium when it is determined that the current business communication ends.
[0075] Preferably, when each sub-log item corresponding to the communication data includes the identifier T of each sub-log item child , L used to characterize the length of each sub-log entry child Value, the data content of each sub-log entry V child And the starting address A of the modified data in each sub-log entry child When, the data processing unit 63 is specifically configured to:
[0076] Write the status flag T of the communication data in the backup area mother , Data content length value L mother And check value C mother; After each sub-log entry of the communication data is written into the backup area, the data content length value L corresponding to the communication data is updated mother And check value C mother; Before writing all sub-log entries in the communication data to the backup area, mark the status T mother Set as the first state value used to characterize that the current state is a positive state; after all the sub-log entries in the communication data are written into the backup area, the state is marked as T mother Modified to the second state value used to characterize the completion of the write state.
[0077] Preferably, in the embodiment of the present invention, the above-mentioned device may further include a data recovery unit 64, such as Figure 7 Shown:
[0078] The data recovery unit 64 is configured to mark T according to the state in the backup area when a power failure occurs mother When it is determined that all the sub log entries of the communication data have been written into the backup area, the check value C mother Perform verification; when the verification succeeds, the communication data is restored based on the data in the backup area, and when the verification fails, the communication data is not restored based on the data in the backup area.
[0079] In the embodiment of the present invention, the non-volatile storage medium is EEPROM or FLASH.
[0080] The embodiment of the present invention also provides a smart card, which includes the aforementioned Image 6 or Figure 7 The device, volatile storage medium and non-volatile storage medium are shown.
[0081] The operating system adopted by the smart card in the embodiment of the present invention may be a COS system, Image 6 or Figure 7 The functions realized by the device can be realized by applications in the COS system.
[0082] In the embodiment of the present invention, on the one hand, for the communication data of this business communication, multiple sub-log entries of the communication data are sequentially cached in a volatile storage medium, and when the business communication ends, the multiple log entries Each sub-log entry is written into the non-volatile storage medium at one time. Therefore, with the technical solution of the present invention, for a transaction, only one data write operation is required to the non-volatile storage medium to realize the communication of the transaction Data backup overcomes the need to perform multiple write operations on non-volatile storage media for backing up communication data of a transaction in the prior art, which leads to the problem of large memory consumption and long time delay when backing up communication data On the other hand, in the embodiment of the present invention, when the communication data of a transaction is backed up, only a check value needs to be set for the communication data, and each sub-log entry in the communication data is written to The corresponding check value is changed in the non-volatile storage medium to ensure the atomicity of the communication data backup. There is no need to set the check value for each sub-log item in the communication data. Therefore, the subsequent data need to be restored in the event of a power failure When you only need to judge the check value corresponding to the communication data, you can determine whether the communication data stored in the non-volatile memory is accurate, and you can determine whether to restore based on the communication data in the non-volatile storage medium, which not only ensures the data The accuracy of recovery, and the atomicity of the entire backup area (that is, the data in the entire backup area is valid or the data in the entire backup area is invalid), and there is no need to verify the check value of each sub-log entry, so not only Improve the efficiency of data recovery, and reduce the complexity of backing up sub-log entries.
[0083] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. In this way, if these modifications and variations to the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these modifications and variations.
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

no PUM

Description & Claims & Application Information

We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Similar technology patents

Intelligent metering management system and method for construction engineering

InactiveCN101504741AGuaranteed accuracyGuaranteed science and accuracyResourcesManagement systemEngineering humans
Owner:ROAD AND BRIDGE CONSTRUCTION

Classification and recommendation of technical efficacy words

Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products