CN105354311A - Data key value pair storage method based on embedded equipment file system - Google Patents
Data key value pair storage method based on embedded equipment file system Download PDFInfo
- Publication number
- CN105354311A CN105354311A CN201510760517.5A CN201510760517A CN105354311A CN 105354311 A CN105354311 A CN 105354311A CN 201510760517 A CN201510760517 A CN 201510760517A CN 105354311 A CN105354311 A CN 105354311A
- Authority
- CN
- China
- Prior art keywords
- data
- key
- value pair
- key value
- attribute
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/172—Caching, prefetching or hoarding of files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/13—File access structures, e.g. distributed indices
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to a data key value pair storage method based on an embedded equipment file system. The method comprises the following steps: according to the data attribute of data, defining a plurality of key value pairs, wherein each defined key value pair can describe the storage characteristics of single piece of data; integrating all key value pairs, and establishing a key value pair comparison table; when data needs to be stored or acquired, traversing the key value pair comparison table according to the data attribute of the data, and finding the key value pair suitable for the data; and according to the attribute of the key value pair, packaging and analyzing the data; and storing or obtaining the data packaged by key value pair in the file. Data objects and the key value pairs correspond one by one, and the key value pair can correspond to the data objects of the single data type, also can correspond to the data objects of a plurality of data type sets, can be flexibly used and enhance data independence. When data is stored on batch or one by one, the storage positions and sequences of the data objects do not need to be considered, and the expandability of the equipment data on a storage aspect is enhanced.
Description
Technical field
The present invention relates to embedded device technical field of data administration, especially a kind of data key values based on file system of embedded device is to storage means.
Background technology
The introducing of file system has lot of advantages relative to the storage means of direct control storer, it makes date storage method more flexible, the independence of data and program is better, also simplify the work of maintenance, this makes file system be widely used on embedded device, in the Data Storage Solution especially more than middleweight.
When using file system to store data, general way is directly stored in the middle of file in the mode of 16 systems by data, this kind of method is mainly used in the data object that in embedded device, some data volumes are larger, it is simple, faster that the object done so mainly can make access data change, but also there are some problems: (1) is because the form that data are all 16 systems stores, be not easy to data check, the maintenance of equipment can strengthen; (2) if data storage object comprises the data of multiple different types of data, and each data store or read operation order is rambling, so usually, be all that whole data storage object is operated, implement and comparatively bother, this reduces the dirigibility that data store, read; (3) during newly-increased data object, in order to not affect other data be kept in same storage file, be no matter definition or the storage of data object, additional mode generally all can only be adopted to realize, but also exist to other had that data object has an impact may; In addition, for the situation that the data that structure is identical are repeatedly stored in same file, adopt the mode of adding to implement then more difficult, this reduces the extensibility of functions of the equipments to a great extent.
A kind of way is also had to be that character string combinations data being formed title and numerical value is deposited in file, this kind of way, mainly for some configuration datas in embedded device and supplemental characteristic, mainly considers that the frequency of maintenance of these type of data is higher, data volume is also relatively little; When using this kind of method, usually without the need to setting up the table of comparisons of data attribute and title, application layer programming personnel directly defines title and the data layout of data according to some rules and custom, complete the storage of data, this kind of method is convenient to plant maintenance, but when processing the data object that some data class are various, data volume is larger, be very restricted.
Summary of the invention
The object of the present invention is to provide and a kind ofly can strengthen the dirigibility of date storage method and the extensibility of equipment, and make data be more convenient for safeguarding, implement also the comparatively simple data key values based on file system of embedded device to storage means.
For achieving the above object, present invention employs following technical scheme: a kind of data key values based on file system of embedded device is to storage means, and the method comprises the step of following order:
(1) according to the data attribute of data, define multiple key-value pair, each key-value pair defined can describe the storage characteristics of individual data;
(2) integrate all key-value pairs, set up the key-value pair table of comparisons;
(3) when needs store or obtain data, according to the data attribute traversal key-value pair table of comparisons of these data, the key-value pair of these data applicable is found out;
(4) carry out encapsulating to data according to the attribute of key-value pair and resolve;
(5) hereof stored in or obtain key-value pair encapsulation after data.
Described data attribute comprises purposes and the form of data, the purposes of data refers to that programming personnel is the virtual concept of its function of description that it is given when defining these data, the Formats User of data represents the content of these data, is the data of a data type or the data acquisition of some data types composition.
The attribute of described key-value pair comprises sequence number for showing key-value pair position in the key-value pair table of comparisons, be used for the title of data of description purposes and the form for data of description content.
The method setting up the key-value pair table of comparisons in described step (2) is: first, sets up a sequence, key-value pair identical for form is placed on the same area of sequence; Secondly, all regions are arranged by short and long order according to byte length shared by form, for the region that total length is equal, by byte length shared by first data type in the order comparison format by short and length, if still equal, then continue more next data type, until last data type; Again, according to the key-value pair of key-value pair title arrangement same format, the name of key-value pair is called character string, arrange according to character sequence of positions initial character to character string from low to high in ASCII character table, if identical, the character of more next position, until last character of character string; Finally, the key-value pair table of comparisons is set up according to the key-value pair sequence after arrangement.
In described step (4), the encapsulation of data and the method for parsing are: the title of key-value pair and form are considered as labeled blank document, and the file storing data is considered as a cubbyhole; When data store, by the content record of data in the blank document of corresponding label, then put into cubbyhole to realize the storage of data, the operation of this record and data encapsulation; Otherwise the reading of data is considered as finding corresponding document according to label and make a copy of the content of paper trail get off the process of imparting data, this operation of making a copy of and Data Analysis on cubbyhole.
As shown from the above technical solution, advantage of the present invention is as follows: first, data object and key-value pair one_to_one corresponding, key-value pair can the data object of corresponding individual data type, also can the data object of corresponding multiple data type set, use comparatively flexible, and also enhance the independence of data; The second store because the data object that will store is encapsulated as comparatively independently data block by key-value pair, therefore data at batch or when storing one by one without the need to consider position that data object stores with sequentially, enhance the extensibility of device data storage aspect; 3rd, data are after encapsulation, and maintainer can read the content of data like a cork, enhances the maintainability of equipment.
Accompanying drawing explanation
Fig. 1 is method flow diagram of the present invention;
Fig. 2 is that in the present invention, data Data completes encapsulation and the schematic diagram stored.
Embodiment
As shown in Figure 1, a kind of data key values based on file system of embedded device is to storage means, the method comprises the step of following order: (1), according to the data attribute of data, defines multiple key-value pair, and each key-value pair defined can describe the storage characteristics of individual data; (2) integrate all key-value pairs, set up the key-value pair table of comparisons; (3) when needs store or obtain data, according to the data attribute traversal key-value pair table of comparisons of these data, the key-value pair of these data applicable is found out; (4) carry out encapsulating to data according to the attribute of key-value pair and resolve; (5) hereof stored in or obtain key-value pair encapsulation after data, because the value of data and key-value pair are bound hereof, store in file be all some through key-value pair encapsulation after data block, therefore when data store, without the need to considering its order stored in file and position, make storage means more flexible like this.
Described data attribute comprises purposes and the form of data, the purposes of data refers to that programming personnel is the virtual concept of its function of description that it is given when defining these data, the Formats User of data represents the content of these data, is the data of a data type or the data acquisition of some data types composition.When the data volume of data object is comparatively large, when data content is more, a data object can be considered as according to application scenarios, also again can be divided into the same or analogous data object of several functions.Step (1), for realizing key of the present invention, is first analyzed the Various types of data object of this embedded device, according to purposes and the form of data object, is partitioned into the data object of least unit, then defines suitable key-value pair.Such as, one for describing the data object Time of time, comprise the data hour of 3 character types, minute and second, successively represent hour, minute and second, can be a data object depending on Time, define a key-value pair corresponding with it, also can define three key-value pairs its 3 character type datas comprised corresponding respectively, to see during definition whether this data object is indivisible in this embedded device function, and the key-value pair defined so also can have higher independence.
The attribute of described key-value pair comprises sequence number for showing key-value pair position in the key-value pair table of comparisons, be used for the title of data of description purposes and the form for data of description content.The method setting up the key-value pair table of comparisons in described step (2) is: first, sets up a sequence, key-value pair identical for form is placed on the same area of sequence; Secondly, all regions are arranged by short and long order according to byte length shared by form, for the region that total length is equal, by byte length shared by first data type in the order comparison format by short and length, if still equal, then continue more next data type, until last data type; Again, according to the key-value pair of key-value pair title arrangement same format, the name of key-value pair is called character string, arrange according to character sequence of positions initial character to character string from low to high in ASCII character table, if identical, the character of more next position, until last character of character string; Finally, the key-value pair table of comparisons is set up according to the key-value pair sequence after arrangement.When needs newly add some key-value pairs, find the position of insertion according to queueing discipline in the table of comparisons, be easy to realize, good sequence also makes the key-value pair table of comparisons be easier to safeguard.Ordering rule can be not limited to character string initial order etc.Well-regulated arrangement can strengthen the maintainability of the table of comparisons, is also the key improving step (4) search efficiency simultaneously.
In described step (4), the encapsulation of data and the method for parsing are: the title of key-value pair and form are considered as labeled blank document, and the file storing data is considered as a cubbyhole; When data store, by the content record of data in the blank document of corresponding label, then put into cubbyhole to realize the storage of data, the operation of this record and data encapsulation; Otherwise the reading of data is considered as finding corresponding document according to label and make a copy of the content of paper trail get off the process of imparting data, this operation of making a copy of and Data Analysis on cubbyhole.Such method for packing makes the independence of data better, implements also comparatively simple.
When there being data to perform storage, perform according to the step (3) shown in Fig. 1, (4), (5).First the storage file of data is found, according to the attribute traversal key-value pair table of comparisons of these data, find out the key-value pair of these data applicable, the method for traversal depends on the method that step (2) sorts, and finally according to the attribute of key-value pair, data is completed to encapsulation and resolves and complete the storage of data.
Core concept of the present invention is: do not carry out any change and remarks to the attribute of data, set up the attribute that the key-value pair table of comparisons is used for recording all data, according to comparatively independently key-value pair, data are encapsulated, there is this encapsulation, data storage file is more easily understood, there is this independence, just there is better extendability, data object carrying out inserting, the sequence of operations such as newly-built, deletion time, just can break away from the limiting factor such as data structure change, data volume size, data content complexity.
As shown in Figure 2, Fig. 2 describes data and realizes encapsulation and the process stored, and the realization of whole process is based upon key-value pair corresponding to data Data by under the prerequisite that is successfully defined in the key-value pair table of comparisons, and whole process concrete methods of realizing is:
(1) the key-value pair table of comparisons (2-2) is made up of multiple key-value pair, wherein contains data Data(2-1) corresponding key-value pair KEY_X(2-3).First according to the set up key-value pair table of comparisons, the key-value pair KEY_X finding data corresponding, the ordering rule followed when this process is set up with the key-value pair table of comparisons is relevant, if the table of comparisons is arrange according to the form of key-value pair and name order successively when sorting, that lookup method is the form region first finding key-value pair, then the key-value pair traveling through this region is according to the position of key-value pair title determination key-value pair;
(2) title (Name_X) defined according to KEY_X and form (Format_X) realize the encapsulation to data Data.Such as above mention example, data object Time, suppose that it is exactly data Data, the name that so can define key-value pair is called character string " Time ", form is character string " HH:MM:SS ", wherein HH, MM, SS represents data cell hour, minute and second of Time successively, if these three its numerical value of data cell are followed successively by 20,15,26, so just can be that the time data Time of 20: 15: 26 is encapsulated as character string " Time=20:15:26 " and stores by data content.Obviously, the method for encapsulation is like this highly susceptible to realizing, and the data after encapsulation are more conducive to safeguard.
(3) data storage file (2-5) is made up of the data (2-4) after the encapsulation of batch; Data after encapsulation are equivalent to one by one independently data block, when carrying out data and storing, can be stored into any position in file according to random order.
In sum, data object of the present invention and key-value pair one_to_one corresponding, key-value pair can the data object of corresponding individual data type, also can the data object of corresponding multiple data type set, uses comparatively flexible, and also enhances the independence of data; Because the data object stored is encapsulated as comparatively independently data block by key-value pair and stores, therefore data at batch or when storing one by one without the need to consider position that data object stores with sequentially, enhance the extensibility of device data storage aspect; Data are after encapsulation, and maintainer can read the content of data like a cork, enhances the maintainability of equipment.
Claims (5)
1. based on the data key values of file system of embedded device to a storage means, the method comprises the step of following order:
(1) according to the data attribute of data, define multiple key-value pair, each key-value pair defined can describe the storage characteristics of individual data;
(2) integrate all key-value pairs, set up the key-value pair table of comparisons;
(3) when needs store or obtain data, according to the data attribute traversal key-value pair table of comparisons of these data, the key-value pair of these data applicable is found out;
(4) carry out encapsulating to data according to the attribute of key-value pair and resolve;
(5) hereof stored in or obtain key-value pair encapsulation after data.
2. the data key values based on file system of embedded device according to claim 1 is to storage means, it is characterized in that: described data attribute comprises purposes and the form of data, the purposes of data refers to that programming personnel is the virtual concept of its function of description that it is given when defining these data, the Formats User of data represents the content of these data, is the data of a data type or the data acquisition of some data types composition.
3. the data key values based on file system of embedded device according to claim 1 is to storage means, it is characterized in that: the attribute of described key-value pair comprises sequence number for showing key-value pair position in the key-value pair table of comparisons, be used for the title of data of description purposes and the form for data of description content.
4. the data key values based on file system of embedded device according to claim 1 is to storage means, it is characterized in that: the method setting up the key-value pair table of comparisons in described step (2) is: first, set up a sequence, key-value pair identical for form is placed on the same area of sequence; Secondly, all regions are arranged by short and long order according to byte length shared by form, for the region that total length is equal, by byte length shared by first data type in the order comparison format by short and length, if still equal, then continue more next data type, until last data type; Again, according to the key-value pair of key-value pair title arrangement same format, the name of key-value pair is called character string, arrange according to character sequence of positions initial character to character string from low to high in ASCII character table, if identical, the character of more next position, until last character of character string; Finally, the key-value pair table of comparisons is set up according to the key-value pair sequence after arrangement.
5. the data key values based on file system of embedded device according to claim 1 is to storage means, it is characterized in that: in described step (4), the encapsulation of data and the method for parsing are: the title of key-value pair and form are considered as labeled blank document, the file storing data is considered as a cubbyhole; When data store, by the content record of data in the blank document of corresponding label, then put into cubbyhole to realize the storage of data, the operation of this record and data encapsulation; Otherwise the reading of data is considered as finding corresponding document according to label and make a copy of the content of paper trail get off the process of imparting data, this operation of making a copy of and Data Analysis on cubbyhole.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510760517.5A CN105354311B (en) | 2015-11-10 | 2015-11-10 | It is a kind of based on the data key values of file system of embedded device to storage method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510760517.5A CN105354311B (en) | 2015-11-10 | 2015-11-10 | It is a kind of based on the data key values of file system of embedded device to storage method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105354311A true CN105354311A (en) | 2016-02-24 |
CN105354311B CN105354311B (en) | 2018-06-19 |
Family
ID=55330283
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510760517.5A Active CN105354311B (en) | 2015-11-10 | 2015-11-10 | It is a kind of based on the data key values of file system of embedded device to storage method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105354311B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110851136A (en) * | 2019-09-18 | 2020-02-28 | 平安科技(深圳)有限公司 | Data acquisition method and device, electronic equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101770291A (en) * | 2009-04-30 | 2010-07-07 | 广东国笔科技股份有限公司 | Semantic analysis data hashing storage and analysis methods for input system |
US20140280172A1 (en) * | 2013-03-13 | 2014-09-18 | Nice-Systems Ltd. | System and method for distributed categorization |
CN104238963A (en) * | 2014-09-30 | 2014-12-24 | 华为技术有限公司 | Data storage method, device and system |
CN104331453A (en) * | 2014-10-30 | 2015-02-04 | 北京思特奇信息技术股份有限公司 | Distributed file system and constructing method thereof |
-
2015
- 2015-11-10 CN CN201510760517.5A patent/CN105354311B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101770291A (en) * | 2009-04-30 | 2010-07-07 | 广东国笔科技股份有限公司 | Semantic analysis data hashing storage and analysis methods for input system |
US20140280172A1 (en) * | 2013-03-13 | 2014-09-18 | Nice-Systems Ltd. | System and method for distributed categorization |
CN104238963A (en) * | 2014-09-30 | 2014-12-24 | 华为技术有限公司 | Data storage method, device and system |
CN104331453A (en) * | 2014-10-30 | 2015-02-04 | 北京思特奇信息技术股份有限公司 | Distributed file system and constructing method thereof |
Non-Patent Citations (1)
Title |
---|
李季 等: "《Android手机应用程序开发》", 31 August 2014 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110851136A (en) * | 2019-09-18 | 2020-02-28 | 平安科技(深圳)有限公司 | Data acquisition method and device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN105354311B (en) | 2018-06-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105094707B (en) | A kind of data storage, read method and device | |
CN106797446B (en) | Historical search based on memory | |
CN103902653B (en) | A kind of method and apparatus for building data warehouse table genetic connection figure | |
CN103810224B (en) | information persistence and query method and device | |
CN106570018A (en) | Serialization method and apparatus, deserialization method and apparatus, serialization and deserialization system, and electronic device | |
CN103988212A (en) | Methods and systems for routing in state machine | |
CN107608750A (en) | Counter operation in state machine lattice | |
CN107015853A (en) | The implementation method and device of phased mission system | |
CN102075430A (en) | Compression and message matching method for deep message detection deterministic finite automation (DFA) state transfer tables | |
CN109981599A (en) | A kind of the general-purpose data parsing platform and method of communication data stream | |
CN106682042A (en) | Relational data cache and inquiry method and device | |
CN101675415A (en) | Program pattern analyzer, pattern appearance status information production method, pattern information generating device, and program | |
CN110019111A (en) | Data processing method, device, storage medium and processor | |
CN106844288A (en) | A kind of random string generation method and device | |
CN106407442A (en) | Massive text data processing method and apparatus | |
CN104408128B (en) | A kind of reading optimization method indexed based on B+ trees asynchronous refresh | |
CN104142979B (en) | A kind of indexing means for realizing RFID tag storage management | |
CN108009254A (en) | More indexing means and device, cloud system and computer-readable recording medium | |
CN107103035A (en) | This earth's surface data-updating method and device | |
CN102591958B (en) | Matching method and matching device of deterministic finite automation based on ternary content addressable memory (TCAM) | |
CN104951482B (en) | A kind of method and device of the image file of operation Sparse formats | |
CN107766036A (en) | A kind of construction method of module, construction device and terminal device | |
CN105408893B (en) | A kind of data processing and wiring method and relevant apparatus | |
CN106777290A (en) | A kind of method and device for deriving data | |
CN105354311A (en) | Data key value pair storage method based on embedded equipment file system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |