CN106844581A - The simulation realizing method of registration table under a kind of Linux - Google Patents

The simulation realizing method of registration table under a kind of Linux Download PDF

Info

Publication number
CN106844581A
CN106844581A CN201710015567.XA CN201710015567A CN106844581A CN 106844581 A CN106844581 A CN 106844581A CN 201710015567 A CN201710015567 A CN 201710015567A CN 106844581 A CN106844581 A CN 106844581A
Authority
CN
China
Prior art keywords
data
registration table
key
realizing method
layer
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.)
Pending
Application number
CN201710015567.XA
Other languages
Chinese (zh)
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.)
Shandong Huaruan Goldencis Software Co Ltd
Original Assignee
Shandong Huaruan Goldencis Software 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 Shandong Huaruan Goldencis Software Co Ltd filed Critical Shandong Huaruan Goldencis Software Co Ltd
Priority to CN201710015567.XA priority Critical patent/CN106844581A/en
Publication of CN106844581A publication Critical patent/CN106844581A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention describes a kind of simulation realizing method of registration table under Linux, the method in Basis of Database by setting up the original table of registration table, and realize that the institute of registration table is functional based on original table, the present invention defines registration table hierarchy, realize that data hierarchy is stored, the institute for realizing registration table is functional(Change including additions and deletions and look into, monitor variation), and layered mode can be adapted to very well with windows, and according further to the present invention, windows registration tablies are using program portable to simple and convenient on linux.

Description

The simulation realizing method of registration table under a kind of Linux
Technical field
The present invention relates to a kind of simulation realizing method of registration table under Linux, belong to field of computer technology.
Background technology
Registration table is the key-value database that Microsoft oneself realizes under Windows, on key-value bases On realize registration table.Registration table has several big characteristics:First, there is the concept of layering, using '/' as the separator of different levels;2nd, deposit Storage content is the mode of key-value, and supports the form of various value;3rd, can arbitrarily carry out additions and deletions and change to look into operation, and Run with efficiency higher;4th, the change of the value of certain key can be monitored.Carrying registration table under Windows systems can The storage of some simple key-value data is very easily realized, while increased the concept of layering again, is easy to data management. Linux system is in itself without registration table, it has not been convenient to the management of data.
The content of the invention
For not having the defect of registration table under current linux system, the present invention provides a kind of simulation of registration table under Linux Implementation method, eaily realizes and manages key-value data.
In order to solve the technical problem, the present invention provides a kind of simulation realizing method of registration table under Linux, the side Method is:The original table of registration table is set up in Basis of Database, original table includes field identification id, keyword key, father node mark Know pid, data type valtype, storage value type data valint, storage character string type data valstr, and in original Relation is deleted in the linkage that father node mark pid and field identification id is set up in beginning table, is then based on original table and is realized that registration table increases The monitoring function looked into is revised, registration table hierarchy is used during registry monitoring function is realized.
The simulation realizing method of registration table under Linux of the present invention, the monitoring function that registration table is completed includes insertion number According to, positioning insertion data, inquiry data, locating query data, delete data and monitoring data and change.
The simulation realizing method of registration table under Linux of the present invention, insert data flow be:1st, according to incoming key Mark location data, no longer perform insertion, and return to mistake to upper strata if failure is positioned;2nd, position successfully, then judge number According to type;3rd, according to data type, insertion operation is performed to database, and returns to whether insertion succeeds, if insertion failure, returns Return mistake.
The simulation realizing method of registration table under Linux of the present invention, positioning insertion data flow be:1st, travel through incoming Key mark, if needing not continue to traversal, return to the position that gets of last time;2nd, if necessary to continue to travel through, by key points Layer, the position of current layer is inquired about in the position of key assignments and last layer according to current layer;If the 3, the position enquiring of current layer loses Lose, then insert new data, content is the key assignments of current layer and the position of last layer, and returns to the position of new insertion;4th, current After the position enquiring success of layer and insertion new data, continue to position next layer, into recursive operation.
The simulation realizing method of registration table under Linux of the present invention, inquire about data flow be:1st, according to incoming key Mark location data, if positioning failure, illustrates not inquire this, mistake are returned to upper strata;If the 2, positioned successfully, root Content is obtained from database according to position, the content for getting is returned to upper strata.
The simulation realizing method of registration table under Linux of the present invention, the flow of locating query data is:1st, travel through incoming Key mark, if needing not continue to traversal, return to the position that gets of last time;2nd, if necessary to continue to travel through, by key points Layer, the position of current layer is inquired about in the position of key assignments and last layer according to current layer;If the 3, the position enquiring of current layer loses Lose, then return to mistake to upper strata;If the 4, the position enquiring success of current layer, continues to position next layer, into recursive operation.
The simulation realizing method of registration table under Linux of the present invention, delete data flow be:1st, according to incoming key Mark location data, if positioning failure, this does not exist, and mistake is returned to upper strata;If the 2, positioned successfully, according to position The adjusting data is deleted in database.
The simulation realizing method of registration table under Linux of the present invention, the prison that monitoring data change is carried by database Control functional realiey.
The simulation realizing method of registration table under Linux of the present invention, set up the database of registration table for sqlite, One kind in mysql, postgres.Preferably, selection lightweight and more stable, perfect PostgreSQL database system sqlite。
In order to registration table is simply and easily transplanted to linux system under Windows, increase by one layer of adapter, by Windows The program that lower use registration table is write, directly transplanting linux system, it is only necessary to link the adapter.
In order to improve the utilization ratio of internal memory, it is to avoid the waste of internal memory, when additions and deletions change and look into, when return value is character string When, return to char* forms;The internal memory of character string is managed collectively in handle is operated, is discharged again when not needed.
Beneficial effects of the present invention:The present invention realizes registration table in linux system Imitating, can eaily realize And manage key-value data;And realize that data hierarchy is stored, the institute for realizing registration table is functional(Change including additions and deletions look into, Monitoring changes), and layered mode can be adapted to very well with Windows;Windows registry uses program portable to Linux It is upper simple and convenient;Internal memory utilization ratio is high, and processing speed is fast.
Brief description of the drawings
Fig. 1 is the flow chart for inserting data;
Fig. 2 is the flow chart of positioning insertion data;
Fig. 3 is the flow chart for inquiring about data;
Fig. 4 is the flow chart of positioning insertion data;
Fig. 5 is the flow chart for deleting data.
Specific embodiment
The present invention is further illustrated with specific embodiment below in conjunction with the accompanying drawings.
The Key Term used in the present invention is explained first.sqlite:Sqlite databases, this is a increasing income Light-weight database, support Linux system.key:Keyword.value:Data value.key-value:Key-value pair, key refers to pass Key word, value refers to the corresponding data of the keyword.Registration table form:HKEY_LOCAL_MACHINE\SOFTWARE\123.
The simulation realizing method of registration table sets up the original of registration table on the basis of sqlite first under Linux of the present invention Beginning table, realizes that the additions and deletions of registration table change and looks into monitoring function based on the original table.
The structure of original table is:
Table structure explanation:
1) id is a unique mark for field;
2) key is keyword, equivalent to the catalogue in registration table or item title;
3) pid is the id of father node(Can be only filled with data present in id row);
4) valtype is the type of value, and 0 is that, without type, 1 is numeral, and 2 is character string;
5) valint is represented:When valtype is numeric type, numeric data is stored using the field;
6) valstr is represented:When valtype is character string type, string data is stored using the field;
7) relation is deleted in the linkage for setting up pid and id, and effect is that its all subitem can be deleted by recurrence when a certain item is deleted;
8) pid is identical represents in same layer, and the key of same layer does not allow to repeat.
Registration table complete monitoring function include insertion data, positioning insertion data, inquiry data, locating query data, Delete data and monitoring data change.
As shown in figure 1, the flow of insertion data is:1st, the position of insertion is needed according to incoming key identifier positioning, such as Fruit positioning unsuccessfully represent without this, do not continue to perform, and to upper strata return mistake, 2, position successfully after judge data class Type, according to data type, insertion operation is performed to database, such as, if numerical value, numeric data is updated, if character String, updates string data, is then back to whether insertion succeeds, if insertion failure, returns to mistake.
As shown in Fig. 2 the flow of positioning insertion data is:1st, positioning needs the position of insertion first, then travels through incoming Key mark, if needing not continue to traversal, return to the position that gets of last time;2nd, if necessary to continue to travel through, by key points Layer, the position of current layer is inquired about in the position of key assignments and last layer according to current layer;If the 3, the position enquiring of current layer loses Lose, then insert new data, content is the key assignments of current layer and the position of last layer, and returns to the position of new insertion;4th, current After the position enquiring success of layer and insertion new data, continue to position next layer, into recursive operation.
As shown in figure 3, the flow of inquiry data is:1st, positioning needs the position of inquiry, i.e., fixed according to incoming key mark Position data, if positioning failure, illustrates not inquire this, mistake are returned to upper strata;If the 2, positioned successfully, judge to need The data type to be obtained, then obtains content according to position from database, the content for getting is returned to upper strata, if that is, It is numerical value to need the data for obtaining, then Authentication-Type, and inquires about numerical value book;Data if necessary to obtain are character string, then test Card type, and polling character string data.
As shown in figure 4, the flow of locating query data is:1st, positioning needs the position of inquiry first, then travels through incoming Key mark, if needing not continue to traversal, return to the position that gets of last time;2nd, if necessary to continue to travel through, by key points Layer, the position of current layer is inquired about in the position of key assignments and last layer according to current layer;If the 3, the position enquiring of current layer loses Lose, then return to mistake to upper strata;If the 4, the position enquiring success of current layer, continues to position next layer, into recursive operation.
As shown in figure 5, the flow for deleting data is:1st, according to incoming key mark location data, if positioning failure, This does not exist, and mistake is returned to upper strata;If the 2, positioned successfully, the adjusting data is deleted in database according to position.
In the present embodiment, the monitoring function carried using sqlite is realized, referenced interface update_hook.
Registration table interface realizes that flow is as follows:
Inquiry key assignments is realized:
1. by HKEY_LOCAL_MACHINE SOFTWARE 123 as a example by time
2. by HKEY_LOCAL_MACHINE SOFTWARE 123 time be converted to { " HKEY_LOCAL_MACHINE ", " SOFTWARE ", " 123 ", " time ", " 0 ", that is, this module needs the key that uses;
3.key points is 4 layers, respectively HKEY_LOCAL_MACHINE, SOFTWARE, 123, time;
4., first according to key ground floors, search criterion key is HKEY_LOCAL_MACHINE, and pid is 0(Namely without father key);
5. find id, using the id as the key second layers search when pid, key is SOFTWARE, and pid finds for last layer id。
6. the like, the id of the key until finding the bottom
If 7. in the process either with or without what is found, illustrating not store this, inquiry failure is returned immediately.
8. to inquiring about the corresponding data of the id in database.
Key assignments is set to realize:
1. by HKEY_LOCAL_MACHINE SOFTWARE 123 as a example by time
2. the mode with the lookup id of inquiry key assignments is identical, positions the id;
If 3. detected during id is positioned without this key, it is empty key to insert a value, returns to new insertion Id, the key of lower floor is created in this way;
4. now the corresponding value contents of final id are sky, perform the update operations of database, set the value of the row entry to want The value of setting.
Key assignments is deleted to realize:
1. by HKEY_LOCAL_MACHINE SOFTWARE 123 as a example by time
2. the mode with the lookup id of inquiry key assignments is identical, positions the id;
If 3. detected without this key during id is positioned, then it is assumed that deleted, return is deleted successfully;
4. couple id for finding performs delete operations in database, is deleted;
If 5. the row also has subitem, cascade is deleted, and has been contemplated that automatic cascade is deleted during sqlite establishment tables, so being not required to Want other operation.
Registry monitoring key assignments changes to be realized:
1. by HKEY_LOCAL_MACHINE SOFTWARE 123 as a example by time
2. the mode with the lookup id of inquiry key assignments is identical, positions the id;
If not navigating to id 3., monitoring failure(Now can first create this);
4. monitoring calls the update_hook interfaces of sqlite to realize, when the value of this changes, can call readjustment letter Number, reaches the purpose of monitoring.
In the present embodiment, in order to improve the utilization ratio of internal memory, it is to avoid the waste of internal memory, when return value is character string, Return to char* forms;The internal memory of character string is managed collectively in handle is operated, is discharged again when not needed.
In addition, sqlite databases support external key when opening, it is necessary to specify.
In the present embodiment, sqlite databases, sqlite is used to use other databases or ordinary file Operation replaces, because sqlite is a lightweight and more stable and perfect PostgreSQL database system, so the present embodiment Based on selecting it.
Registration table described by the present embodiment can simultaneously be used by multiple programs.
In order to registration table is simply and easily transplanted to linux system under Windows, the present embodiment increases by one layer of adapter, The course of work of adapter is:
1), ' ' in automatic parsing registration table, by adir subdir keyword resolve to { " adir ", " subdir ", " Keyword ", " 0 " form, analysis mode for split character string, hand over word array;
2)Registry operations type is converted into int, string type in the module;
3)The corresponding interface of this module is called according to functional requirement.
The program write using registration table under windows systems, is grafted directly to Linux system, it is only necessary to link the dynamic Storehouse and adapter.
In the present embodiment, sqlite databases can be replaced using other databases such as mysql, postgres.
The present invention realizes the institute of registration table based on original table by setting up the original table of registration table in Basis of Database It is functional, the present invention define registration table hierarchy { " cis ", " sub ", " key ", " 0 ", realize data hierarchy store, realize The institute of registration table is functional(Change including additions and deletions and look into, monitor variation), and layered mode can be adapted to very well with windows, According further to the present invention, windows registration tablies are using program portable to simple and convenient on linux.
Described above is only general principle of the invention and preferred embodiment, and those skilled in the art do according to the present invention The improvement and replacement for going out, belong to protection scope of the present invention.

Claims (10)

1. under a kind of Linux registration table simulation realizing method, it is characterised in that:The original of registration table is set up in Basis of Database Beginning table, original table includes field identification id, keyword key, father node mark pid, data type valtype, storage numerical value class Type data valint, storage character string type data valstr, and father node mark pid and field identification are set up in original table Relation is deleted in the linkage of id, is then based on original table and is realized that registration table additions and deletions change the monitoring function looked into, and is realizing registry monitoring Registration table hierarchy is used during function.
2. under Linux according to claim 1 registration table simulation realizing method, it is characterised in that:What registration table was completed Function includes insertion data, positioning insertion data, inquires about data, locating query data, deletes data and monitoring data change.
3. under Linux according to claim 2 registration table simulation realizing method, it is characterised in that:Insert the stream of data Cheng Wei:1st, according to incoming key mark location data, insertion is no longer performed if failure is positioned, and mistake is returned to upper strata; 2nd, position successfully, then judge data type;3rd, according to data type, insertion operation is performed to database, and whether return to insertion Success, if insertion failure, returns to mistake.
4. under Linux according to claim 2 registration table simulation realizing method, it is characterised in that:Positioning insertion data Flow be:1st, incoming key mark is traveled through, if needing not continue to traversal, the position that return last time gets;If the 2, needed Continue traversal, key is layered, the position of key assignments and last layer according to current layer, inquire about the position of current layer;If the 3, worked as The position enquiring failure of front layer, then insert new data, and content is the key assignments of current layer and the position of last layer, and returns to new insertion Position;4th, after the position enquiring success of current layer and insertion new data, continue to position next layer, into recursive operation.
5. under Linux according to claim 2 registration table simulation realizing method, it is characterised in that:Inquire about the stream of data Cheng Wei:1st, according to incoming key mark location data, if positioning failure, illustrates not inquire this, returned to upper strata wrong By mistake;If the 2, positioned successfully, content is obtained from database according to position, the content for getting is returned to upper strata.
6. under Linux according to claim 2 registration table simulation realizing method, it is characterised in that:Locating query data Flow be:1st, incoming key mark is traveled through, if needing not continue to traversal, the position that return last time gets;If the 2, Need to continue to travel through, key is layered, the position of key assignments and last layer according to current layer, inquire about the position of current layer;If the 3, The position enquiring failure of current layer, then return to mistake to upper strata;If the 4, the position enquiring success of current layer, under continuing to position One layer, into recursive operation.
7. under Linux according to claim 2 registration table simulation realizing method, it is characterised in that:Delete the stream of data Cheng Wei:1st, according to incoming key mark location data, if positioning failure, this does not exist, and mistake is returned to upper strata;2nd, such as Fruit positions successfully, deletes the adjusting data in database according to position.
8. under Linux according to claim 2 registration table simulation realizing method, it is characterised in that:Monitoring data changes The monitoring function carried by database is realized.
9. under Linux according to claim 1 registration table simulation realizing method, it is characterised in that:Set up registration table Database is the one kind in sqlite, mysql, postgres.
10. under Linux according to claim 1 registration table simulation realizing method, it is characterised in that:Increase by one layer of adaptation Device.
CN201710015567.XA 2017-01-10 2017-01-10 The simulation realizing method of registration table under a kind of Linux Pending CN106844581A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710015567.XA CN106844581A (en) 2017-01-10 2017-01-10 The simulation realizing method of registration table under a kind of Linux

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710015567.XA CN106844581A (en) 2017-01-10 2017-01-10 The simulation realizing method of registration table under a kind of Linux

Publications (1)

Publication Number Publication Date
CN106844581A true CN106844581A (en) 2017-06-13

Family

ID=59118559

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710015567.XA Pending CN106844581A (en) 2017-01-10 2017-01-10 The simulation realizing method of registration table under a kind of Linux

Country Status (1)

Country Link
CN (1) CN106844581A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109408547A (en) * 2018-11-12 2019-03-01 郑州云海信息技术有限公司 A kind of read method of SAM registration table reads system and relevant apparatus

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6189139B1 (en) * 1997-12-10 2001-02-13 Ncr Corporation INF development environment
US20040045016A1 (en) * 2000-03-09 2004-03-04 Extent Technologies Ltd. Registry emulation
CN103092726A (en) * 2013-01-16 2013-05-08 厦门市美亚柏科信息股份有限公司 Recovery method and recovery device of registry deleted data
CN105912952A (en) * 2016-05-04 2016-08-31 广州广电运通金融电子股份有限公司 Linux based registry service system and method as well as financial self-service device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6189139B1 (en) * 1997-12-10 2001-02-13 Ncr Corporation INF development environment
US20040045016A1 (en) * 2000-03-09 2004-03-04 Extent Technologies Ltd. Registry emulation
CN103092726A (en) * 2013-01-16 2013-05-08 厦门市美亚柏科信息股份有限公司 Recovery method and recovery device of registry deleted data
CN105912952A (en) * 2016-05-04 2016-08-31 广州广电运通金融电子股份有限公司 Linux based registry service system and method as well as financial self-service device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
杜飞明 等: "《计算机组装与维护》", 31 May 2012 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109408547A (en) * 2018-11-12 2019-03-01 郑州云海信息技术有限公司 A kind of read method of SAM registration table reads system and relevant apparatus
CN109408547B (en) * 2018-11-12 2021-11-19 郑州云海信息技术有限公司 SAM registry reading method, reading system and related device

Similar Documents

Publication Publication Date Title
US10417203B2 (en) Compacting data history files
US9740706B2 (en) Management of intermediate data spills during the shuffle phase of a map-reduce job
CN110383261A (en) Stream for multithread storage device selects
CN110291518A (en) Merge tree garbage index
US7730056B2 (en) Software and method for utilizing a common database layout
CN110268399A (en) Merging tree for attended operation is modified
CN104216895B (en) A kind of method and device for generating POI data
CN107025290B (en) Storage method and reading method of fault tree data
JP2001313639A (en) System and method for managing network configuration data and recording medium
CN103795811A (en) Information storage and data statistical management method based on meta data storage
CN101901242A (en) Federated configuration data management
CN102169507A (en) Distributed real-time search engine
US9081637B2 (en) System and method for a software product manager
CN105338113A (en) Multi-platform data interconnected system for sharing urban data resources
JP2001014329A (en) Database processing method and implementation device, and medium stored with the processing program
US20140052813A1 (en) Method and system for identifying storage device
US8880553B2 (en) Redistribute native XML index key shipping
US20110072165A1 (en) Device-configuration-information optimum arrangement method and device-configuration-information optimum arrangement system
CN108376156A (en) Create method, apparatus, server and the storage medium of database index
US20040186843A1 (en) Systems and methods for transforming data in buffer memory without unnecessarily copying data to additional memory locations
CN105912665A (en) Method for model conversion and data migration of Neo4j to relational database
CN106021466A (en) Data storage method and apparatus
CN101393624A (en) Method and apparatus for operating material list to realize production management
CN109741034B (en) Grid tree organization management method and device
CN106844581A (en) The simulation realizing method of registration table under a kind of Linux

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20170613

RJ01 Rejection of invention patent application after publication