CN110209349A - The method and terminal device of data processing - Google Patents

The method and terminal device of data processing Download PDF

Info

Publication number
CN110209349A
CN110209349A CN201910338717.XA CN201910338717A CN110209349A CN 110209349 A CN110209349 A CN 110209349A CN 201910338717 A CN201910338717 A CN 201910338717A CN 110209349 A CN110209349 A CN 110209349A
Authority
CN
China
Prior art keywords
sector
record
written
attribute information
data
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.)
Granted
Application number
CN201910338717.XA
Other languages
Chinese (zh)
Other versions
CN110209349B (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.)
Guangdong Kehua Qiansheng Cloud Computing Technology Co ltd
Original Assignee
XIAMEN KECAN INFORMATION TECHNOLOGY Co Ltd
Kehua Hengsheng 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 XIAMEN KECAN INFORMATION TECHNOLOGY Co Ltd, Kehua Hengsheng Co Ltd filed Critical XIAMEN KECAN INFORMATION TECHNOLOGY Co Ltd
Priority to CN201910338717.XA priority Critical patent/CN110209349B/en
Publication of CN110209349A publication Critical patent/CN110209349A/en
Application granted granted Critical
Publication of CN110209349B publication Critical patent/CN110209349B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1008Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices
    • G06F11/1048Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices using arrangements adapted for a specific error detection or correction feature
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Human Computer Interaction (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention is suitable for technical field of data storage, the method and terminal device of a kind of data processing is provided, this method comprises: obtaining the first property parameters of record to be written;According to the storage classification in first property parameters, determines and described to be written record sector to be written;Update the head attribute information of the sector;According to first property parameters and the head attribute information of the updated sector, the record to be written is written in the sector, so that the treatment process of record is without additional recording indexes unit, it is easy to operate, effectively solve the problems, such as that multi storage data store the possible data recovery of operating conditions such as asynchronous when power down in storing process.

Description

The method and terminal device of data processing
Technical field
The invention belongs to technical field of data storage more particularly to the methods and terminal device of a kind of data processing.
Background technique
It usually stores data in memory, when the data that needs the data volume stored big or can change, is Reduce the loss to memory, it will usually which the mode that selection divides location to store often writes a data, require change address. The minimum erasure unit for being commonly stored device is that sector is needed when selection point location stores by different storage mediums or difference Storage sector is for storing index information, to achieve the purpose that data directory.However number is stored by the way of point location storage According to when, storing process is cumbersome, and data in storing process when power down restore difficult.
Summary of the invention
In view of this, the embodiment of the invention provides a kind of method of data processing and terminal device, to solve existing skill In art when storing data, storing process is cumbersome, and the data in storing process when power down restore difficult problem.
The first aspect of the embodiment of the present invention provides a kind of method of data processing, comprising:
Obtain the first property parameters of record to be written;
According to the storage classification in first property parameters, determines and described to be written record sector to be written;
Update the head attribute information of the sector;
According to first property parameters and the head attribute information of the updated sector, be written in the sector The record to be written.
In one embodiment, the corresponding one group of data of a record, the record include: data attribute mark, data content The corresponding effective verifying mark of mark, data attribute mark and invalid authentication mark;
The head of the sector stores the head attribute information and customized information of the sector data;
The head attribute information includes: storage class number mark, storage mark and record length indicator.
In one embodiment, before first property parameters for obtaining record to be written, further includes: obtain definition Sector configuration information;
The head attribute information of m-th of sector to be searched is obtained, the m is more than or equal to 1;
When described m-th sector to be searched head attribute information and n-th of sector to be configured head attribute information not When matching, the sector configuration information of the definition is written to each mark of the head attribute information of described n-th sector to be configured Corresponding memory space, the n are more than or equal to 1.
In one embodiment, the head attribute information updated and save the sector, comprising:
The storage overturn in the head attribute information of the sector identifies corresponding content;
The head attribute information of the sector is updated according to first property parameters, saves the updated sector Head attribute information.
In one embodiment, described to be believed according to first property parameters and the head attribute of the updated sector The record to be written is written in the sector in breath, comprising:
According to the corresponding content of record length indicator in the updated head attribute information, the sector has been calculated Storage record total number;
The writing position obtained in first property parameters identifies corresponding data;
When the corresponding data of said write station location marker are greater than the record total number, remember in described sector the last item It records corresponding address to the section between the corresponding address of said write station location marker and the first data is written;And
The record to be written is written in the corresponding address of said write station location marker.
In one embodiment, described to be believed according to first property parameters and the head attribute of the updated sector The record to be written is written in the sector in breath, further includes:
When the corresponding data of said write station location marker are less than the record total number, said write station location marker is wiped Corresponding address to the corresponding address section of the record total number record, and in the corresponding address of said write station location marker The second data are written to the corresponding address section of the record total number;And
The record to be written is written in the corresponding address of said write station location marker;
Alternatively, when the corresponding data of said write station location marker are equal to the record total number, in said write position It identifies and the record to be written is written in corresponding address.
The second aspect of the embodiment of the present invention provides a kind of method of reading data, comprising:
Obtain the second property parameters of record to be read;
According to the storage classification in second property parameters, obtain and the storage classification phase in second property parameters First generic sector;
Obtain the head attribute information of first sector;
According to the head attribute information of first sector, first sector record total number is calculated;
Corresponding content and first fan are identified according to the record number to be read in second property parameters Area records total number, obtains the address of the record to be read;
According to the address of the record to be read, the record to be read is read.
The third aspect of the embodiment of the present invention provides a kind of device of data processing, comprising:
First obtains module, for obtaining the first property parameters of record to be written;
Determining module described records fan to be written for determining according to the storage classification in first property parameters Area;
Processing module, for updating and saving the head attribute information of the sector;
Writing module, for the head attribute information according to first property parameters and the sector, in the fan The record is written in area.
The fourth aspect of the embodiment of the present invention provides a kind of device of reading data, comprising:
Second obtains module, for obtaining the second property parameters of record to be read;
Described second obtains module, is also used to according to the storage classification in second property parameters, obtains and described the First sector of the storage classification the same category in two property parameters;
Described second obtains module, is also used to obtain the head attribute information of first sector;
Computing module calculates first sector record for the head attribute information according to first sector Total number;
Described second obtains module, is also used to be corresponded to according to the record number to be read mark in second property parameters Content and first sector record total number, obtain the address of the record to be read;
Read module reads the record to be read for the address according to the record to be read.
5th aspect of the embodiment of the present invention provides a kind of terminal device, including memory, processor and is stored in In the memory and the computer program that can run on the processor, when the processor executes the computer program The step of the step of realizing any one of such as claim 1 to 6 the method and claim 7 the method.
Existing beneficial effect is the embodiment of the present invention compared with prior art: the embodiment of the present invention is to be written by obtaining First property parameters of record;According to the storage classification in the first property parameters, determines and to be written record sector to be written;More The head attribute information of new sector;According to the first property parameters and the head attribute information of updated sector, in the fan The record to be written is written in area.By the data structure of setting record, so that the treatment process of record is without additional Recording indexes unit, easy to operate, multi storage data store the works such as asynchronous when effectively solving power down in storing process The possible data of condition restore problem.
Detailed description of the invention
It to describe the technical solutions in the embodiments of the present invention more clearly, below will be to embodiment or description of the prior art Needed in attached drawing be briefly described, it should be apparent that, the accompanying drawings in the following description is only of the invention some Embodiment for those of ordinary skill in the art without any creative labor, can also be according to these Attached drawing obtains other attached drawings.
Fig. 1 is a kind of implementation process schematic diagram of data processing method provided in an embodiment of the present invention;
Fig. 2 is the schematic diagram of sector initialization process provided in an embodiment of the present invention;
Fig. 3 is sector header attribute information schematic diagram provided in an embodiment of the present invention;
Fig. 4 (1) is the iterative accumulated schematic diagram of single sector provided in an embodiment of the present invention;
Fig. 4 (2) is more sector increment formula storage mode schematic diagrames provided in an embodiment of the present invention;
Fig. 4 (3) is more sector cover type storage mode schematic diagrames provided in an embodiment of the present invention;
Fig. 5 is the schematic diagram provided in an embodiment of the present invention in sector write-in data flow;
Fig. 6 is a kind of schematic diagram of the method for reading data provided in an embodiment of the present invention;
Fig. 7 is the schematic diagram of the device provided in an embodiment of the present invention to data processing;
Fig. 8 is the schematic diagram of the device provided in an embodiment of the present invention to reading data;
Fig. 9 is the schematic diagram of terminal device provided in an embodiment of the present invention.
Specific embodiment
In being described below, for illustration and not for limitation, the tool of such as particular system structure, technology etc is proposed Body details, to understand thoroughly the embodiment of the present invention.However, it will be clear to one skilled in the art that there is no these specific The present invention also may be implemented in the other embodiments of details.In other situations, it omits to well-known system, device, electricity The detailed description of road and method, in case unnecessary details interferes description of the invention.
In order to illustrate technical solutions according to the invention, the following is a description of specific embodiments.
The embodiment of the present invention provides a kind of method of data processing, as shown in Figure 1, method includes the following steps:
Step 101, the first property parameters of record to be written are obtained.
The corresponding one group of data of the record, shown in following table:
Content ValidFlag UserData CRC16_1 CRC16_2
Length 2 N 2 2
ValidFlag indicates data attribute mark, accounts for the memory space of 2 characters;
UserData indicates data content mark, accounts for the memory space of N number of character;
CRC16_1 indicates the corresponding effective verifying mark of data attribute mark, accounts for the memory space of 2 characters;
CRC16_2 indicates that data attribute mark is corresponding and invalid authentication identifies, and accounts for the memory space of 2 characters.
Optionally, when record is written for the first time, labeled as effectively, ValidFlag=1, CRC16_1 are all bytes in front Check code, CRC16_2 be sky;
When by recording failureization, which is taken out, it is that this records all bytes that ValidFlag, which is set to 0, CRC16_2, Check code re-writes.
" record " described in all embodiments of the invention be it is above-mentioned shown in unified format, difference record is only length Difference.
The head of the sector stores the head attribute information and customized information of the sector data;
The head attribute information includes: storage class number mark, storage mark and record length indicator.
Step 102, it according to the storage classification in first property parameters, determines and described to be written records fan to be written Area.
Step 103, the head attribute information of the sector is updated.
Optionally, the storage overturn in the head attribute information of the sector identifies corresponding content;
The head attribute information of the sector is updated according to first property parameters, saves the updated sector Head attribute information.
Step 104, according to first property parameters and the head attribute information of the updated sector, described The record to be written is written in sector.
Optionally, according to the corresponding content of record length indicator in the updated head attribute information, institute is calculated It states sector and has stored record total number;
The writing position obtained in first property parameters identifies corresponding data;
When the corresponding data of said write station location marker are greater than the record total number, remember in described sector the last item It records corresponding address to the section between the corresponding address of said write station location marker and the first data is written, and in said write The record to be written is written in the corresponding address of station location marker.
When the corresponding data of said write station location marker are less than the record total number, said write station location marker is wiped Corresponding address to the corresponding address section of the record total number record, and in the corresponding address of said write station location marker The second data are written to the corresponding address section of the record total number;And
The record to be written is written in the corresponding address of said write station location marker;
Alternatively, when the corresponding data of said write station location marker are equal to the record total number, in said write position It identifies and the record to be written is written in corresponding address.
The embodiment of the present invention further includes initializing to sector before step 101, specifically includes: matching the sector for obtaining definition Confidence breath;
The head attribute information of m-th of sector to be searched is obtained, the m is more than or equal to 0;
When the head attribute information of described m-th sector to be searched and the sector configuration information of the definition mismatch, It deposits the head attribute information of described m-th sector to be searched is written in the sector configuration information of the definition each mark is corresponding Store up space.
The method of above-mentioned data processing, by the first property parameters for obtaining record to be written;According to first attribute Storage classification in parameter determines and described records sector to be written;Update the head attribute information of the sector;According to described The record to be written is written in the sector in first property parameters and the head attribute information of the updated sector. By the data structure of setting record, so that the treatment process of record is without additional recording indexes unit, it is easy to operate, Multi storage data store the possible data recovery of operating conditions such as asynchronous and ask when effectively solving power down in storing process Topic.
The embodiment of the present invention provides the method for another data processing, this method specifically include sector initialization process, Data flow is written in sector.Two processes are described in detail separately below, as shown in Fig. 2, sector initialization process includes following step It is rapid:
Step 201, the sector configuration information of definition is obtained.
Optionally, it is necessary first to define the sector configuration information of this classification record.This programme it is each can write record fan The head in area opens a piece of land location, for storing the head attribute information and customized information of sector data.
As shown in figure 3, the head attribute information includes: Method, Type, SectorNum, CurrentSecNo., StoreFlag、Overwrite、RecordLength、Reserve、CRC16。
Method is storage mode mark, accounts for the memory space of 1 byte;
Type is storage class number's mark, accounts for the memory space of 1 byte;
SectorNum is the number of sectors mark of category distribution, accounts for the memory space of 1 byte;
It CurrentSecNo. is current sector in the location of current class number-mark, the storage for accounting for 1 byte is empty Between;
StoreFlag is storage mark, accounts for the memory space of 1 byte;
Overwrite is writeable number mark, accounts for the memory space of 1 byte, definition can at most be write 16 times;
RecordLength is record length indicator, accounts for the memory space of 2 bytes, the length of user data;
Reserve is reserved mark, accounts for the memory space of 54 bytes;
CRC16 is header information check code mark, accounts for the memory space of 2 bytes.
Head attribute information accounts for the memory space of 64 bytes altogether, and the storage that customized information can account for 64 bytes is empty Between, the memory space that the content and each content specifically stored can occupy can be defined by user oneself, and initial value 0xFF can Change.
Step 202, sector number to be searched and sector number to be configured are set.
Optionally, in order to search for all sectors, current sector number m=0 to be searched is set here, m is more than or equal to 0, when Next sector is searched for and then has searched for;
In order to give all sector configuration head attribute informations that head attribute information is not configured, setting here is current to be configured Sector label N=0, N are more than or equal to 0, after current sector configuration to be configured completes head attribute information, can continue as it is next not The sector configuration head attribute information of configuration header attribute information.
Step 203, the head attribute information of m-th of sector to be searched is obtained.
Optionally, m=0 first searches for the 1st sector to be searched.
Step 204, judge the head attribute information of described m-th sector to be searched and the sector configuration information of the definition Whether match.
Optionally, such as the sector configuration information of definition can be Method be 1, Type 0, according to the note of required storage Record item number, it is assumed that 2 sectors, i.e. SectorNum=2 need to be distributed.When then initializing, the 1st sector to be searched is first searched for (CurrentSecNo.=0) whether have existed, existing condition are as follows: in the head attribute information of sector to be searched Method=1, Type=0, CurrentSecNo.=0.
Optionally, as shown in Fig. 2, when the head attribute information of described m-th sector to be searched and the sector of the definition When configuration information mismatches, step 205 is executed, when head attribute information and the definition of described m-th sector to be searched When sector configuration information matches, step 208 is executed.
Step 205, (m+1) operation is executed.
Optionally, (m+1) operation can be executed by counter here, at this time m=1.Optionally, when m-th to be searched When the head attribute information of sector and the sector configuration information of the definition mismatch, then need to detect next sector to be searched Head attribute information whether match with the sector configuration information of the definition, until all sector detections to be searched finish.
Step 206, judge whether m is less than sector sum to be searched.
Step 207, when m is greater than sector sum to be searched, by described m-th of sector configuration information write-in of the definition The corresponding memory space of each mark of the head attribute information of sector to be searched.
Optionally, if all sectors to be searched of traversal mismatch, and when m is greater than sector sum to be searched, illustrate this Sector is not opened up also, then opens up not currently used sector, and current fan to be configured is written in the sector configuration information of the definition The corresponding memory space of each mark of the head attribute information of the sector to be searched of area i.e. m-th.
After having executed this step, step 208 is continued to execute.
When m is less than sector sum to be searched, the head attribute information of m-th of sector to be searched is obtained, that is, is continued to execute Step 203.
Step 208, judge whether to have searched all sectors to be configured.
Optionally, when the head attribute information of m-th of sector to be searched is matched with the sector configuration information of the definition, Then illustrate the sector initialized completion, then judge whether to have searched all sectors to be configured, when not searching whole When sector to be configured, step 209 is executed, next sector to be searched is continued searching, continues to detect, until all to be configured Sector detection finishes.When searching all sectors to be configured, terminate current process.
Step 209, m+1 operation is executed.
After executing the step 209, step 203 is continued to execute.
It should be noted that sector can there are many modes of storing data in this programme, as follows.
Mode one: the iterative accumulated mode of single sector.As shown in Fig. 4 (1), a sector can store n item record, and n is big In equal to 1.When single sector is stored and recorded, only newest n-th group record is effective.
Mode two: more sector increment formula storage modes.As shown in Fig. 4 (2), m sector forms more sectors, and m is more than or equal to 1, each sector can store n item record.The storage class of the record of m sector storage is identical.Same type of record is referring to Determining sector, increment type stores backward, and every group of record is all effective.
Mode three: more sector cover type storage modes.As shown in Fig. 4 (3), m sector forms more sectors, and m is more than or equal to 1, each sector can store n item record.The storage class of the record of m sector storage is identical.Same type of record, it is single to fan Be written and recorded as offset using data directory in area, include two kinds of special operations: the data after the data directory must be clearly 0xFF;Current address must write 0 to data between address to be written.
As shown in figure 5, sector write-in data flow is described in detail in the embodiment of the present invention, comprising the following steps:
Step 501, the first property parameters of record to be written are obtained.
Optionally, the first property parameters include storage mode mark, store category label mark, record pointer to be written, And respectively identify corresponding particular content.
Step 502, it according to the storage classification in first property parameters, determines and described to be written records fan to be written Area.
Optionally, according to the storage classification in the first property parameters, the newest sector of the category is searched for, judges this newest sector Whether full record is write;When full record has been write in this newest sector, next available sector is searched for.When this newest sector is to write for the first time Enter, then can determine that this newest sector is to record sector to be written.
Optionally, judge whether sector is newest sector according to StoreFlag.For example, the record classification shares 3 fans Area, under initial unwritten state, the StoreFlag in each sector header attribute information is 0xFF.Start to write the 1st sector, StoreFlag first overturns as 0, write it is full after followed by the 2nd sector and the 3rd sector is continued, equally by the value of StoreFlag by 0xFF overturning is 0.All write it is full after, the record of the 1st sector write-in is wiped, at the same by StoreFlag overturning be 1 after write again Enter record.Therefore, the StoreFlag in 3 sector header attribute informations need to be only judged in order, can navigate to newest fan Area.
Step 503, the storage overturn in the head attribute information of the sector identifies corresponding content.
Step 504, the head attribute information that the sector is updated according to first property parameters saves updated institute State the head attribute information of sector.
It should be understood that further including that storage mode mark and storage mode mark are corresponding interior in the first property parameters Hold;Store class number, and the corresponding content of storage class number, i.e. storage classification;Data pointer mark and data refer to Needle identifies corresponding content;Sector first address mark and sector first address identify corresponding content;Writing position number mark Knowledge and the corresponding data of writing position number-mark.
Step 505, according to the corresponding content of record length indicator in the updated head attribute information, institute is calculated It states sector and has stored record total number.
For example, it is 10 that sector, which has stored record total number,.
Step 506, the corresponding data of writing position number-mark in first property parameters are obtained.
Optionally, the corresponding data of writing position number-mark are a number, such as writing position number is 9.
Step 507, judge that said write Position Number identifies whether corresponding data are greater than the record total number.
Step 508, when said write Position Number, which identifies corresponding data, is greater than the record total number, in the fan Area's the last item records corresponding address to the section between the corresponding address of said write station location marker and the first data is written.
Optionally, when the corresponding data of writing position number-mark are greater than record total number, that is, show record to be written Address to be written is sky, can be written into current record to be written.According to the characteristic of more sector cover type storage modes, need Current address is to being written the first data between address to be written.
Optionally, the first data can be 0.
Step 509, it is identified in corresponding address in said write Position Number and the record to be written is written.
Step 510, when said write Position Number, which identifies corresponding data, is less than the record total number, described in erasing The corresponding address of writing position number-mark to the corresponding address section of the record total number record, and in said write position It sets the corresponding address of mark to the corresponding address section of the record total number and the second data is written.
Optionally, when the corresponding data of writing position number-mark are less than record total number, show into station location marker pair It has been stored with record in the address answered, therefore according to the characteristic of more sector cover type storage modes, has needed to compile writing position Data after number corresponding address of mark must wipe, and the section after the corresponding address of writing position number-mark is write Enter the second data, optionally, the second data can be 0xFF.Then step 509 is executed.
When said write Position Number, which identifies corresponding data, is equal to the record total number, directly in said write position It sets and the record to be written is written in the corresponding address of number-mark, is i.e. execution step 509.
As shown in fig. 6, the present embodiment provides a kind of methods of reading data, method includes the following steps:
Step 601, the second property parameters of record to be read are obtained.
Optionally, the second property parameters include that storage mode mark and storage mode identify corresponding content;Store class It does not number, and the corresponding content of storage class number, i.e. storage classification;Record number mark to be read and note to be read Record the corresponding content of number-mark.
Step 602, it according to the storage classification in second property parameters, obtains and depositing in second property parameters Store up first sector of classification the same category.
Step 603, the head attribute information of first sector is obtained.
Step 604, according to the head attribute information of first sector, the total item of first sector record is calculated Number.
Optionally, according to the corresponding content of record length indicator in the head attribute information of the first sector, first is calculated Total number is recorded in sector.Optionally, the content of RecordLength is obtained, i=0, TotalNumSec=0 { } are set, according to ACurrently=AFirst address+LHead+ iRecordLength is successively read the storage region in the first sector in addition to the attribute information of head Content, every time read RecordLength byte, then the byte of reading is verified, when verify successfully, execution i++ And TotalNumSec++ returns to TotalNumSec, it is hereby achieved that first until having read all bytes in the first sector Total number is recorded in sector.
Step 605, corresponding content and described is identified according to the record number to be read in second property parameters First sector record total number obtains the address of the record to be read.
Optionally, it is identified according to the record number to be read in the second property parameters, obtains corresponding record to be read Number, such as obtaining the number of corresponding record to be read is 18.First sector record total number is 10.Then record to be read Address is the 8th article of record of the 2nd sector.
Step 606, according to the address of the record to be read, the record to be read is read.
Optionally, after step 606, further include being verified to record to be read, when verifying successfully, return and successfully mark Know, when verifying failure, return is unsuccessfully identified.
The embodiment of the present invention provides a kind of method of data processing, is initialized by the head attribute information to sector, so Record can be written according to the attribute information of the record to be written of definition and the head attribute information of sector afterwards, and according to definition The attribute information of record to be read and the head attribute information of sector read corresponding record.By all types of data in the present embodiment It is abstracted as certain record, for different types of data, only length is different, and storing process is all made of the same scheme.Make The data structure that user only needs definition that need to store, determines storage mode according to application scenarios, it can be achieved that various types data are deposited The functions such as storage, reading, erasing simplify applying step, effectively solve in storing process without additional recording indexes unit When power down, the possible data of the multi storage data storage operating conditions such as asynchronous restore problem.
It should be understood that the size of the serial number of each step is not meant that the order of the execution order in above-described embodiment, each process Execution sequence should be determined by its function and internal logic, the implementation process without coping with the embodiment of the present invention constitutes any limit It is fixed.
The embodiment of the present invention provides a kind of device of data processing, as shown in fig. 7, the device includes: the first acquisition module 701, determining module 702, processing module 703, writing module 704.
First obtains module 701, for obtaining the first property parameters of record to be written.
Optionally, the corresponding one group of data of the record, the record include: data attribute mark, data content mark, institute State the corresponding effective verifying mark of data attribute mark and invalid authentication mark;
The head of the sector stores the head attribute information and customized information of the sector data;
The head attribute information includes: storage class number mark, storage mark, record length indicator.
Determining module 702, for according to the storage classification in first property parameters, determine the record to be written to The sector of write-in.
Processing module 703, for updating the head attribute information of the sector.
Optionally, processing module 703 is used for, and the storage mark overturn in the head attribute information of the sector is corresponding interior Hold;The head attribute information of the sector is updated according to first property parameters, saves the head of the updated sector Attribute information.
Writing module 704, for according to first property parameters and the head attribute of updated sector letter The record to be written is written in the sector in breath.
Optionally, writing module 704, for according to the record length indicator pair in the updated head attribute information The content answered calculates the sector and has stored record total number;
The writing position obtained in first property parameters identifies corresponding data;
When the corresponding data of said write station location marker are greater than the record total number, remember in described sector the last item It records corresponding address to the section between the corresponding address of said write station location marker and the first data is written, and in said write The record to be written is written in the corresponding address of station location marker.
When the corresponding data of said write station location marker are less than the record total number, said write station location marker is wiped Corresponding address to the corresponding address section of the record total number record, and in the corresponding address of said write station location marker The second data are written to the corresponding address section of the record total number, and in the corresponding address of said write station location marker The record to be written is written;Alternatively, when the corresponding data of said write station location marker are equal to the record total number, in institute It states in the corresponding address of writing position mark and the record to be written is written.
The embodiment of the present invention provides a kind of device of data processing, and the first category of record to be written is obtained by obtaining module Property parameter, according to the storage classification in first property parameters, determining module determines and described to be written records fan to be written Area;Processing module updates the head attribute information of the sector;According to first property parameters and the updated fan The record to be written is written in the sector in the head attribute information in area, writing module.By all types of data in the present embodiment It is abstracted as certain record, for different types of data, only length is different, and storing process is without additional record rope Draw unit, simplify applying step, when effectively solving power down in storing process, the operating conditions such as the storage of multi storage data is asynchronous Possible data restore problem.
The embodiment of the present invention provides a kind of device of reading data, as shown in figure 8, the device includes: the second acquisition module 801, computing module 802, read module 803.
Second obtains module 801, for obtaining the second property parameters of record to be read.
Optionally, the second property parameters include that storage mode mark and storage mode identify corresponding content;Store class It does not number, and the corresponding content of storage class number, i.e. storage classification;Record number mark to be read and note to be read Record the corresponding content of number-mark.
Described second obtains module 801, is also used to according to the storage classification in second property parameters, obtain with it is described First sector of the storage classification the same category in the second property parameters.
Described second obtains module 801, is also used to obtain the head attribute information of first sector.
Computing module 802 calculates first sector note for the head attribute information according to first sector Record total number.
Optionally, according to the corresponding content of record length indicator in the head attribute information of the first sector, first is calculated Total number is recorded in sector.
Described second obtains module 801, is also used to according to the record number to be read mark in second property parameters Corresponding content and first sector record total number obtain the address of the record to be read.
Optionally, it is identified according to the record number to be read in the second property parameters, obtains corresponding record to be read Number, such as obtaining the number of corresponding record to be read is 18.First sector record total number is 10.Then record to be read Address is the 8th article of record of the 2nd sector.
Read module 803 reads the record to be read for the address according to the record to be read.
Optionally, after reading the record word to be read, record to be read can also be verified, when verification at When function, success flag is returned to, when verifying failure, return is unsuccessfully identified.
All types of data are abstracted as certain record in the present embodiment, for different types of data, only length is not Together, reading process is all made of the same scheme, without additional recording indexes unit, simplifies applying step, effectively solves In storing process when power down, the storage of multi storage data is asynchronous etc., and the possible data of operating conditions restore problem.
Fig. 9 is the schematic diagram for the terminal device that one embodiment of the invention provides.As shown in figure 9, the terminal of the embodiment is set Standby 900 include: processor 901, memory 902 and are stored in the memory 902 and can transport on the processor 901 Capable computer program 903, such as data processor and data read procedure.The processor 901 executes the computer The step in the embodiment of above-mentioned each data processing and reading data, such as step 101 shown in FIG. 1 are realized when program 903 To 104 or step 201 shown in Fig. 2 to step 210, step 501 shown in fig. 5 to step 510, step shown in fig. 6 601 to step 606.The processor 901 realizes each module in above-mentioned each Installation practice when executing the computer program 903 Function, such as the function of module 701 to 704 shown in Fig. 7, the function of module 801 to 803 shown in Fig. 8.
Illustratively, the computer program 903 can be divided into one or more modules, one or more of Module is stored in the memory 902, and is executed by the processor 901, to complete the present invention.It is one or more of Module can be the series of computation machine program instruction section that can complete specific function, and the instruction segment is for describing the computer Implementation procedure of the program 903 in the device or terminal device 900 of the data processing.For example, the computer program 903 The first acquisition module 701, determining module 702, processing module 703, writing module 704, each specific function of module can be divided into It can be as shown in fig. 7, this is no longer going to repeat them.The computer program 903 can be divided into the second acquisition module 801, meter Module 802 is calculated, read module 803, each module concrete function is as shown in figure 8, this is no longer going to repeat them.
The terminal device 900 can be the calculating such as desktop PC, notebook, palm PC and cloud server and set It is standby.The terminal device may include, but be not limited only to, processor 901, memory 902.It will be understood by those skilled in the art that Fig. 9 is only the example of terminal device 900, does not constitute the restriction to terminal device 900, may include more or more than illustrating Few component perhaps combines certain components or different components, such as the terminal device can also be set including input and output Standby, network access equipment, bus etc..
Alleged processor 901 can be central processing unit (Central Processing Unit, CPU), can also be Other general processors, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit (Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field- Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic, Discrete hardware components etc..General processor can be microprocessor or the processor is also possible to any conventional processor Deng.
The memory 902 can be the internal storage unit of the terminal device 900, such as terminal device 900 is hard Disk or memory.The memory 902 is also possible to the External memory equipment of the terminal device 900, such as the terminal device The plug-in type hard disk being equipped on 900, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) etc..Further, the memory 902 can also both include the terminal The internal storage unit of equipment 900 also includes External memory equipment.The memory 902 for store the computer program with And other programs and data needed for the terminal device 900.The memory 902 can be also used for temporarily storing defeated Out or the data that will export.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each function Can unit, module division progress for example, in practical application, can according to need and by above-mentioned function distribution by different Functional unit, module are completed, i.e., the internal structure of described device is divided into different functional unit or module, more than completing The all or part of function of description.Each functional unit in embodiment, module can integrate in one processing unit, can also To be that each unit physically exists alone, can also be integrated in one unit with two or more units, it is above-mentioned integrated Unit both can take the form of hardware realization, can also realize in the form of software functional units.In addition, each function list Member, the specific name of module are also only for convenience of distinguishing each other, the protection scope being not intended to limit this application.Above system The specific work process of middle unit, module, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in detail or remembers in some embodiment The part of load may refer to the associated description of other embodiments.
Those of ordinary skill in the art may be aware that list described in conjunction with the examples disclosed in the embodiments of the present disclosure Member and algorithm steps can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually It is implemented in hardware or software, the specific application and design constraint depending on technical solution.Professional technician Each specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceed The scope of the present invention.
In embodiment provided by the present invention, it should be understood that disclosed device/terminal device and method, it can be with It realizes by another way.For example, device described above/terminal device embodiment is only schematical, for example, institute The division of module or unit is stated, only a kind of logical function partition, there may be another division manner in actual implementation, such as Multiple units or components can be combined or can be integrated into another system, or some features can be ignored or not executed.Separately A bit, shown or discussed mutual coupling or direct-coupling or communication connection can be through some interfaces, device Or the INDIRECT COUPLING or communication connection of unit, it can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme 's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list Member both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated module/unit be realized in the form of SFU software functional unit and as independent product sale or In use, can store in a computer readable storage medium.Based on this understanding, the present invention realizes above-mentioned implementation All or part of the process in example method, can also instruct relevant hardware to complete, the meter by computer program Calculation machine program can be stored in a computer readable storage medium, the computer program when being executed by processor, it can be achieved that on The step of stating each embodiment of the method.Wherein, the computer program includes computer program code, the computer program Code can be source code form, object identification code form, executable file or certain intermediate forms etc..Computer-readable Jie Matter may include: can carry the computer program code any entity or device, recording medium, USB flash disk, mobile hard disk, Magnetic disk, CD, computer storage, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium etc..It should be noted that described The content that computer-readable medium includes can carry out increasing appropriate according to the requirement made laws in jurisdiction with patent practice Subtract, such as does not include electric carrier signal and electricity according to legislation and patent practice, computer-readable medium in certain jurisdictions Believe signal.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although referring to aforementioned reality Applying example, invention is explained in detail, those skilled in the art should understand that: it still can be to aforementioned each Technical solution documented by embodiment is modified or equivalent replacement of some of the technical features;And these are modified Or replacement, the spirit and scope for technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution should all It is included within protection scope of the present invention.

Claims (10)

1. a kind of method of data processing characterized by comprising
Obtain the first property parameters of record to be written;
According to the storage classification in first property parameters, determines and described to be written record sector to be written;
Update the head attribute information of the sector;
According to first property parameters and the head attribute information of the updated sector, described in the write-in of the sector Record to be written.
2. the method for data processing as described in claim 1, which is characterized in that
The corresponding one group of data of one record, the record include: data attribute mark, data content mark, the data attribute Identify corresponding effective verifying mark and invalid authentication mark;
The head of the sector stores the head attribute information and customized information of the sector data;
The head attribute information includes: storage class number mark, storage mark and record length indicator.
3. the method for data processing as claimed in claim 2, which is characterized in that in first category for obtaining record to be written Before property parameter, further includes:
Obtain the sector configuration information of definition;
The head attribute information of m-th of sector to be searched is obtained, the m is more than or equal to 0;
When the head attribute information of described m-th sector to be searched and the sector configuration information of the definition mismatch, by institute The corresponding storage of each mark for the head attribute information that described m-th sector to be searched is written in the sector configuration information for stating definition is empty Between.
4. the method for data processing as claimed in claim 3, which is characterized in that the head attribute letter for updating the sector Breath, comprising:
The storage overturn in the head attribute information of the sector identifies corresponding content;
The head attribute information of the sector is updated according to first property parameters, saves the head of the updated sector Attribute information.
5. the method for data processing as claimed in claim 4, which is characterized in that it is described according to first property parameters and The record to be written is written in the sector in the head attribute information of the updated sector, comprising:
According to the corresponding content of record length indicator in the updated head attribute information, calculates the sector and stored Record total number;
The writing position obtained in first property parameters identifies corresponding data;
When the corresponding data of said write station location marker are greater than the record total number, in described sector the last item record pair The first data are written in the address answered to the section between the corresponding address of said write station location marker, and in said write position It identifies and the record to be written is written in corresponding address.
6. the method for data processing as claimed in claim 5, which is characterized in that it is described according to first property parameters and The record to be written is written in the sector in the head attribute information of the updated sector, further includes:
When the corresponding data of said write station location marker are less than the record total number, erasing said write station location marker is corresponding Address to the corresponding address section of the record total number record, and in the corresponding address of said write station location marker to institute It states the corresponding address section of record total number and the second data is written;And
The record to be written is written in the corresponding address of said write station location marker;Alternatively, working as said write station location marker When corresponding data are equal to the record total number, the note to be written is written in the corresponding address of said write station location marker Record.
7. a kind of method of reading data characterized by comprising
Obtain the second property parameters of record to be read;
According to the storage classification in second property parameters, obtain mutually similar with the storage classification in second property parameters Other first sector;
Obtain the head attribute information of first sector;
According to the head attribute information of first sector, first sector record total number is calculated;
Corresponding content and first sector note are identified according to the record number to be read in second property parameters Total number is recorded, the address of the record to be read is obtained;
According to the address of the record to be read, the record to be read is read.
8. a kind of device of data processing characterized by comprising
First obtains module, for obtaining the first property parameters of record to be written;
Determining module, for according to the storage classification in first property parameters, determine it is described it is to be written record it is to be written Sector;
Processing module, for updating the head attribute information of the sector;
Writing module, for the head attribute information according to first property parameters and the updated sector, in institute It states sector and the record to be written is written.
9. a kind of device of reading data characterized by comprising
Second obtains module, for obtaining the second property parameters of record to be read;
Described second obtains module, is also used to obtain and belong to described second according to the storage classification in second property parameters First sector of the storage classification the same category in property parameter;
Described second obtains module, is also used to obtain the head attribute information of first sector;
Computing module calculates the total item of first sector record for the head attribute information according to first sector Number;
Described second obtains module, is also used to corresponding interior according to the record number to be read mark in second property parameters Appearance and first sector record total number obtain the address of the record to be read;
Read module reads the record to be read for the address according to the record to be read.
10. a kind of terminal device, including memory, processor and storage are in the memory and can be on the processor The computer program of operation, which is characterized in that the processor realizes such as claim 1 to 7 when executing the computer program The step of any one the method.
CN201910338717.XA 2019-04-25 2019-04-25 Data processing method and terminal equipment Active CN110209349B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910338717.XA CN110209349B (en) 2019-04-25 2019-04-25 Data processing method and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910338717.XA CN110209349B (en) 2019-04-25 2019-04-25 Data processing method and terminal equipment

Publications (2)

Publication Number Publication Date
CN110209349A true CN110209349A (en) 2019-09-06
CN110209349B CN110209349B (en) 2022-12-09

Family

ID=67786337

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910338717.XA Active CN110209349B (en) 2019-04-25 2019-04-25 Data processing method and terminal equipment

Country Status (1)

Country Link
CN (1) CN110209349B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112347002A (en) * 2020-11-13 2021-02-09 杭州艾芯智能科技有限公司 flash data storage method and system, computer equipment and storage medium
CN112506918A (en) * 2020-11-03 2021-03-16 深圳市宏电技术股份有限公司 Data access method, terminal and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1280368A (en) * 1999-07-07 2001-01-17 三星电子株式会社 Recording medium for storaging attributive information and method for identifying data by using attributive information
WO2005109427A1 (en) * 2004-05-10 2005-11-17 Matsushita Electric Industrial Co., Ltd. Data recording/reproduction for write-once discs
CN101446921A (en) * 2008-12-23 2009-06-03 青岛海信宽带多媒体技术股份有限公司 Dynamic storage method of Flash memory
CN101546294A (en) * 2009-04-30 2009-09-30 青岛海信宽带多媒体技术有限公司 Method for storing data in Flash memory
CN102693283A (en) * 2012-05-07 2012-09-26 深圳市共进电子股份有限公司 Data partition storage method and system boot method of embedded system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1280368A (en) * 1999-07-07 2001-01-17 三星电子株式会社 Recording medium for storaging attributive information and method for identifying data by using attributive information
WO2005109427A1 (en) * 2004-05-10 2005-11-17 Matsushita Electric Industrial Co., Ltd. Data recording/reproduction for write-once discs
CN101446921A (en) * 2008-12-23 2009-06-03 青岛海信宽带多媒体技术股份有限公司 Dynamic storage method of Flash memory
CN101546294A (en) * 2009-04-30 2009-09-30 青岛海信宽带多媒体技术有限公司 Method for storing data in Flash memory
CN102693283A (en) * 2012-05-07 2012-09-26 深圳市共进电子股份有限公司 Data partition storage method and system boot method of embedded system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112506918A (en) * 2020-11-03 2021-03-16 深圳市宏电技术股份有限公司 Data access method, terminal and computer readable storage medium
CN112506918B (en) * 2020-11-03 2024-06-04 深圳市宏电技术股份有限公司 Data access method, terminal and computer readable storage medium
CN112347002A (en) * 2020-11-13 2021-02-09 杭州艾芯智能科技有限公司 flash data storage method and system, computer equipment and storage medium

Also Published As

Publication number Publication date
CN110209349B (en) 2022-12-09

Similar Documents

Publication Publication Date Title
CN108984211A (en) Neural network processor and the method for executing Givens rotation instruction using processor
CN108769111A (en) A kind of server connection method, computer readable storage medium and terminal device
CN104765745B (en) Loading data in database are carried out with the method and system of logic checking
CN109977274A (en) A kind of data query and verification method, system, equipment and storage medium
CN109656986A (en) A kind of householder method that business datum summarizes, device and electronic equipment
CN107784063B (en) Algorithm generation method and terminal equipment
CN103729303A (en) Data writing and data reading methods of Flash
CN108399025A (en) Method and device for correcting identification deviation and terminal equipment
CN109471797A (en) A kind of environment configurations management method, system and terminal device
CN101963912A (en) Implementation method for storing and checking hardware configuration information of system
CN108279947A (en) The method and device of financial self-service equipment SP installation kits adaptation
CN110209349A (en) The method and terminal device of data processing
CN109408522A (en) A kind of update method and device of user characteristic data
CN109783346A (en) Keyword-driven automatic testing method and device and terminal equipment
CN113139387A (en) Semantic error correction method, electronic device and storage medium
CN108446968A (en) A kind of method, apparatus and terminal device of accounting entry
CN113032420A (en) Data query method and device and server
CN105930390A (en) Relation-type database expansion method and relation-type database expansion system
CN114022148B (en) Transaction conflict detection method, device, equipment and storage medium based on block chain
CN110209357A (en) Improve method, apparatus, computer equipment and the storage medium of the big file write performance of SSD
CN109240936A (en) Compatibility test method, terminal device and the medium of application program
CN106775481B (en) Method for reading data and equipment
CN110335070B (en) WIFI-based user group extension method and device and electronic equipment
CN114265835A (en) Data analysis method and device based on graph mining and related equipment
CN109783321A (en) Monitoring data management method, device, terminal device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 361101 Ma Long Road 457, Torch Garden, Xiamen Torch High-tech Zone, Fujian Province

Applicant after: Kehua Data Co.,Ltd.

Applicant after: XIAMEN KECAN INFORMATION TECHNOLOGY Co.,Ltd.

Address before: 361101 Ma Long Road 457, Torch Garden, Xiamen Torch High-tech Zone, Fujian Province

Applicant before: XIAMEN KEHUAHENGSHENG LIMITED BY SHARE Ltd.

Applicant before: XIAMEN KECAN INFORMATION TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20221104

Address after: Building 7, No. 39, Nanyun 3rd Road, Guangzhou Hi tech Industrial Development Zone, Guangzhou, Guangdong 510663

Applicant after: GUANGDONG KEHUA QIANSHENG CLOUD COMPUTING TECHNOLOGY Co.,Ltd.

Address before: 361101 Ma Long Road 457, Torch Garden, Xiamen Torch High-tech Zone, Fujian Province

Applicant before: Kehua Data Co.,Ltd.

Applicant before: XIAMEN KECAN INFORMATION TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant