CN110287220A - It is a kind of to generate the method and device for configuring reverse textual - Google Patents

It is a kind of to generate the method and device for configuring reverse textual Download PDF

Info

Publication number
CN110287220A
CN110287220A CN201910673000.0A CN201910673000A CN110287220A CN 110287220 A CN110287220 A CN 110287220A CN 201910673000 A CN201910673000 A CN 201910673000A CN 110287220 A CN110287220 A CN 110287220A
Authority
CN
China
Prior art keywords
buildrun
node
dbm
template
target
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
CN201910673000.0A
Other languages
Chinese (zh)
Other versions
CN110287220B (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.)
New H3C Big Data Technologies Co Ltd
Original Assignee
New H3C Big Data Technologies 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 New H3C Big Data Technologies Co Ltd filed Critical New H3C Big Data Technologies Co Ltd
Priority to CN201910673000.0A priority Critical patent/CN110287220B/en
Publication of CN110287220A publication Critical patent/CN110287220A/en
Application granted granted Critical
Publication of CN110287220B publication Critical patent/CN110287220B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • 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/24Querying
    • G06F16/248Presentation of query results

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (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 present invention provides a kind of method and device for generating and configuring reverse textual, which comprises when main DBM receives Buildrun request, it is determined whether there is the target DBM for generating Buildrun;If it exists, then the main DBM requests the Buildrun to be sent to the target DBM, is requested to generate Buildrun according to the Buildrun by the target DBM, and refresh the time-to-live of the target DBM;If it does not exist, then the main DBM generates the target DBM, the time-to-live of the target DBM is arranged, and Buildrun request is sent to the target DBM, is requested to generate Buildrun according to the Buildrun by the target DBM.The efficiency of Buildrun generation can be improved using the present invention.

Description

It is a kind of to generate the method and device for configuring reverse textual
Technical field
The present invention relates to network communication technology field more particularly to a kind of methods and dress for generating the reverse textual of configuration It sets.
Background technique
The current operating conditions of the network equipment are intuitively checked in order to facilitate user, network equipment offer is matched what is currently come into force The function (configuring reverse textual function) of being inversely converted into the text that user can be visually seen is set, this function can claim For Buildrun.
Many functions on the network equipment all rely on Buildrun at present, such as:
1, configuration variance records: needing to compare the configuration variation of Buildrun after operating each time and is reported in monitoring The heart.
2, configuration snapshot is generated, for user's rollback etc..
The data organization that Buildrun is relied on is divided into two major classes: template and common order.Buildrun passes through specific Symbol (such as " # ") distinguishes paragraph, and the hierarchical relationship of configuration is indicated by retraction.Tissue inside Buildrun is with template root node The root node of (English: Root) as entire Buildrun, below according to the readjustment or son of priority arrangement plug-in registration The information of template.Priority is used to control the genesis sequence of Buildrun content, guarantees for same running configuration Buildrun's the result is that the same.
When Builrun is generated, since template Root, according to priority, successively call readjustment (English: Callback).Using the mode of depth-first, the readjustment of each plug-in unit (English: Plugin) registration is called, each Plugin's Readjustment (usually memory database (English: Database in Memory, abbreviation DBM)) from system obtains operation data, Text information output is generated according to the logic of itself.
Currently, the product process of Buildrun is as follows: user/other applications send Buildrun and request to main DBM; The copy that (English: fork) goes out a DBM after main DBM receives request, is derived from, above-mentioned Buildrun product process is called to carry out As a result user is returned to.
It wherein, the use of fork is so that winner DBM is continued with acquisition/setting (English of DB in order to not influence main DBM Literary GET/SET) request.The copy of DBM accesses database when Buildrun is generated, and access is that database is copied in this process Shellfish.After generating Buildrun, the copy of the DBM will be exited.
However, being generated in the implementation of Buildrun at present, when main DBM receives Buildrun request each time, Fork is needed to go out the copy of a DBM, the copy of the DBM can generate Buildrun backed off after random (being deleted), connect when frequently When receiving Buildrun request, the copy of fork and DBM repeatedly exit the efficiency that can reduce Buildrun generation.
Summary of the invention
In view of this, the present invention provides a kind of method and device for generating and configuring reverse textual, to solve the prior art The exiting for copy of the middle fork generated in the scheme for configuring reverse textual repeatedly and DBM can reduce Buildrun formation efficiency The problem of.
According to the first aspect of the invention, a kind of method for generating and configuring reverse textual is provided, comprising:
When main memory database D BM, which is received, configures reverse textual Buildrun request, it is determined whether exist and be used for Generate the target DBM of Buildrun;
If it exists, then the main DBM requests the Buildrun to be sent to the target DBM, by the target DBM root It requests to generate Buildrun according to the Buildrun, and refreshes the time-to-live of the target DBM;
If it does not exist, then the main DBM generates the target DBM, is arranged the time-to-live of the target DBM, and by institute It states Buildrun request and is sent to the target DBM, request to generate according to the Buildrun by the target DBM Buildrun。
According to the second aspect of the invention, a kind of device for generating and configuring reverse textual is provided, comprising: main DBM and mesh Mark DBM;Wherein:
The main DBM, for when receiving Buildrun request, it is determined whether there is the mesh for generating Buildrun Mark DBM;
The main DBM, is also used to if it exists, then Buildrun request is sent to the target DBM, by the mesh It marks DBM to be requested to generate Buildrun according to the Buildrun, and refreshes the time-to-live of the target DBM;
The main DBM, is also used to if it does not exist, then generates the target DBM, and the time-to-live of the target DBM is arranged, And Buildrun request is sent to the target DBM, it requests to generate according to the Buildrun by the target DBM Buildrun。
Using technical solution disclosed by the invention, when main DBM receives Buildrun request, it is determined whether exist and be used for Generate the target DBM of Buildrun;If it exists, then main DBM by Buildrun request be sent to target DBM, by target DBM according to Buildrun request generates Buildrun, and refreshes the time-to-live of target DBM;If it does not exist, then main DBM generates target DBM, The time-to-live of target DBM is set, and Buildrun request is sent to target DBM, is requested by target DBM according to Buildrun Buildrun is generated, using the consecutive hours of the demand of Buildrun in time is obtained, what main DBM was generated is used to generate The target DBM of Buildrun can't complete just to exit after Buildrun is generated, but there are a time-to-live, it avoids Target DBM's frequently generates and exits, and improves the efficiency of Buildrun generation.
Detailed description of the invention
Fig. 1 is a kind of flow diagram of method for generating the reverse textual of configuration provided in an embodiment of the present invention;
Fig. 2 is a kind of schematic diagram of Buildrun output provided in an embodiment of the present invention;
Fig. 3 A is the institutional framework schematic diagram of Buildrun provided in an embodiment of the present invention a kind of;
Fig. 3 B is the incremental update configuration diagram of basis Buildrun provided in an embodiment of the present invention a kind of;
Fig. 3 C is a kind of schematic diagram of the incremental update logic of basis Buildrun provided in an embodiment of the present invention;
Fig. 3 D is a kind of structural schematic diagram for increasing the basic Buildrun after dummy node provided in an embodiment of the present invention;
Fig. 3 E is a kind of schematic diagram of the initialization of basis Buildrun provided in an embodiment of the present invention;
Fig. 3 F is a kind of flow diagram of the initialization of configurations Object node provided in an embodiment of the present invention;
Fig. 3 G is a kind of flow diagram of the initialization of template instances Object node provided in an embodiment of the present invention;
Fig. 3 H is a kind of flow diagram of incremental update provided in an embodiment of the present invention;
Fig. 3 I is the structural schematic diagram of the basic Buildrun after a kind of BDR data summarization provided in an embodiment of the present invention;
Fig. 4 is a kind of structural schematic diagram of device for generating the reverse textual of configuration provided in an embodiment of the present invention;
Fig. 5 is a kind of hardware structural diagram of device for generating the reverse textual of configuration provided in an embodiment of the present invention.
Specific embodiment
Technical solution in embodiment in order to enable those skilled in the art to better understand the present invention, and make of the invention real The above objects, features, and advantages for applying example can be more obvious and easy to understand, with reference to the accompanying drawing to technical side in the embodiment of the present invention Case is described in further detail.
It referring to Figure 1, is a kind of process signal for generating the method for configuring reverse textual provided in an embodiment of the present invention Figure, as shown in Figure 1, the method that the generation configures reverse textual may comprise steps of:
Step 101, when main DBM receive Buildrun request when, it is determined whether there is the mesh for generating Buildrun Mark DBM.If so, going to step 102;Otherwise, step 103 is gone to.
In the embodiment of the present invention, it is contemplated that obtain continuity of the demand there are the time of Buildrun, i.e., in a time It, may be than relatively frequently there is the demand for obtaining Buildrun in section.
The DBM gone out based on this characteristic that Buildrun is obtained, fork copy (i.e. for generating the DBM of Buildrun, Referred to herein as target DBM) it can't just be exited after generating Buildrun, but may exist a time-to-live, when When the duration that target DBM does not receive Buildrun request reaches the time-to-live, target DBM is just exited;Otherwise, Buildrun request can be sent to target DBM and be handled, to avoid target DBM frequent fork and exit, improve Generate the efficiency of Buildrun.
Correspondingly, in embodiments of the present invention, when main DBM receives Buildrun request, main DBM be may determine whether There are target DBM.
Buildrun request is sent to target DBM by step 102, main DBM, requests to generate according to the Buildrun by DBM Buildrun, and refresh the time-to-live of DBM.
In the embodiment of the present invention, if main DBM is determined there are target DBM, i.e. target DBM is still in existing state, then main DBM The Buildrun can be requested to be sent to target DBM, (not need fork without regenerating target DBM New target DBM).
When target DBM receives Buildrun request, on the one hand, Buidlrun can be generated based on the database of itself, And the Buildrun of generation is returned into requesting party.
Illustratively, target DBM may refer to existing life according to the specific implementation that the database of itself generates Buildrun At the related realization in the implementation of Buildrun, this will not be repeated here for the embodiment of the present invention.
On the other hand, target DBM can refresh the time-to-live of itself.
For example, it is assumed that the time-to-live of target DBM is 15 minutes, then when target DBM receives Buildrun request, mesh Time-to-live can be re-set as 15 minutes by mark DBM by the current residual time (such as 5 minutes), i.e. target DBM is at least connecing 15 minutes to get off are existing state.
Step 103, main DBM generate target DBM, the time-to-live of DBM are arranged, and Buildrun request is sent to the mesh DBM is marked, is requested to generate Buildrun according to the Buildrun by target DBM.
In the embodiment of the present invention, if main DBM, which is determined, is not present target DBM, target DBM, i.e. fork is can be generated in main DBM The copy of one DBM, and the time-to-live (time-to-live can be pre-configured with according to demand) of target DBM is set.
After main DBM generates target DBM, the Buildrun received can be requested to be sent to target DBM, by target DBM requests to generate Buildrun according to the Buildrun.
As it can be seen that in method flow shown in Fig. 1, by the target DBM setting time-to-live to generate, so that target DBM It is not exited within the time-to-live, it in turn, can be by Buildrun if receiving Buildrun request in target DBM survival Request is sent to target DBM, without regenerating target DBM, avoids frequently generating and exit for target DBM, mentions The high efficiency for generating Buildrun.
Optionally, the present invention in one embodiment, after above-mentioned main DBM generates target DBM, can also include:
Target DBM constructs basis Buildrun according to the data in own database;Wherein, basis Buildrun is tree Shape structure;
Above-mentioned target DBM requests to generate Buildrun according to Buildrun, may include:
Target DBM generates Buidrun according to basic Buildrun.
In this embodiment, it is contemplated that in target DBM survival, the Buildrun request that main DBM is received can be sent out Target DBM is given, Buildrun is generated by target DBM, the demand for obtaining Buildrun is frequently present of within sometime When, target DBM can frequently generate Buildrun.In order to avoid target DBM generates Buildrun's according to existing each time Mode described in implementation carries out Buildrun generation.After main DBM generates target DBM, target DBM can be according to itself Data in database, construct a basis Buildrun, may include in the Buildrun of the basis generate Buildrun be need The data (being properly termed as Buildrun data) wanted.It, can be with base when target DBM needs to generate Buildrun in follow-up process Buildrun is generated in basis Buildrun.
Illustratively, the mode that target DBM generates basis Buildrun can be with the existing realization side for generating Buildrun The realization that Buildrun is generated in case is identical.
It should be noted that after target DBM generates basis Buildrun, if in the database of target DBM itself Data do not change (data in the database of i.e. main DBM do not change), then include in the Buildrun of basis The Buildrun data for including in Buildrun data and the Buildrun that target DBM is generated are identical.
Further, it is contemplated that when configuration change causes configuration information to change, usually only will affect Buildrun's Sub-fraction, therefore, when the data of database change, target DBM can be based on changed data, to basis The impacted part Buildrun is updated, and in turn, generates newest Buildrun based on updated basis Buildrun.
Correspondingly, the basic Buildrun that target DBM is generated can be tree structure, so that the data in database occur When variation, target DBM can navigate to impacted node, and be updated to impacted node, realize incremental update.
Optionally, in one example, above-mentioned target DBM constructs basis according to the data in own database Buildrun, comprising:
Target DBM successively calls each call back function according to the Buildrun grade of registration;
When calling the case-based system call back function of template registration, template instances Object node, the template instances pair are generated As node includes the Buildrun number of the Instance Name and template instances Object node for identifying template instances Object node According to;
When calling the call back function of normal commands, common configuration Object node, the common configuration Object node packet are generated Include call back function (be properly termed as BDR readjustment) for identifying the common configuration Object node, the common configuration Object node The Buildrun grade of Buildrun data and the common configuration Object node.
In this example, after main DBM generates target DBM, target DBM can be according to the Buildrun grade of registration (Level) (Buildrun priority, hereinafter referred to as priority are referred to as) and successively call each call back function (Callback), i.e., according to priority, (numerical value of Buildrun grade is bigger, and priority is lower) and depth are excellent from high to low First mode, successively calls call back function.
Wherein, the data organization that Buildrun is relied on may include two major classes: template and normal commands.
In this embodiment, for template, target DBM calls the case-based system call back function of template registration, obtains related Example generates template instances Object node, which may include for identifying the template instances object section The Instance Name of point and the Buildrun data of the template instances Object node.
For normal commands, target DBM calls the call back function of the normal commands, generates common configuration Object node, should Common configuration Object node may include for identifying the call back function of the common configuration node, common configuration Object node The Buildrun grade of Buildrun data and common configuration Object node.
Further, in this example, it is contemplated that the priority phase for the different templates example that same template instances obtain Together, the sequence between different templates example that same template instances obtain for convenience, can introduce dummy node (Virtual Node)。
Optionally, in one example, above-mentioned generation template instances Object node may include:
For template, dummy node is created, and the template instances Object node that the template instances are obtained is as the void The child node of quasi- node;
Wherein, the multiple template instance objects node same template instances obtained, using predetermined order function into Row sequence.
In this example, during constructing basis Buildrun, for any template, target DBM can be created pair Should template dummy node (priority of the dummy node and the priority of the template are consistent), what which obtained Template instances Object node is used as the child node of the dummy node, and the multiple template instance objects that the template instances obtain It can be ranked up using predetermined order function between node.
Optionally, in one example, above-mentioned creation dummy node, the template instances object which is obtained Child node of the node as the dummy node may include:
Create the dummy node of the corresponding template;
The subtemplate initialization function being registered under the template is called according to Buildrun grade recycle;
If subtemplate initialization function returns template instances Object node, which is added should The child list of dummy node;
When the subtemplate initialization function being registered under the template be called it is out-of-date, if the dummy node exist son section Point then returns to the dummy node;
Otherwise, the dummy node is deleted.
Optionally, in one example, common configuration Object node is generated, may include:
Call the call back function of the normal commands;
When being output to designated memory space there are the corresponding configuration information of the normal commands, it is corresponding to generate the normal commands Common configuration Object node.
Wherein, above-mentioned generation template instances Object node and generate the specific implementation of common configuration Object node can be It is illustrated below in association with specific example, this will not be repeated here for the embodiment of the present invention.
Optionally, the present invention in one embodiment, above-mentioned target DBM according in own database data construct After basic Buildrun, can also include:
When data change event occurs for the database of main DBM, change notification is sent to target DBM;
Target DBM determines changed data according to change notification, and updates itself according to changed data Database;
And the destination node for needing to update in the basis Buildrun is determined according to changed data, and right Destination node is updated.
In this embodiment, it is contemplated that when configuration change causes configuration information to change (data change in database) When, it usually only will affect the sub-fraction of Buildrun, if data change in database every time, regenerate primary complete Whole Buildrun, the formation efficiency that will lead to Buildrun is poor, therefore, in order to improve the formation efficiency of Buildrun, when When data change in database, the update of Buildrun can be carried out in such a way that enhancing updates.
Correspondingly, in this embodiment, it when data change event occurs for the database of main DBM, sends and changes to main DBM Notice.
When target DBM receives the change notification that main DBM is sent, changed data are determined according to the change notification, At this point, on the one hand target DBM can update the database of itself according to changed data, with guarantee itself database with Data in the database of main DBM are consistent;On the one hand, needs in the Buildrun of basis can be determined according to changed data The node (referred to herein as destination node) of update, and destination node is updated.
Optionally, in one example, above-mentioned determined in the Buildrun of basis according to changed data needs to update Destination node, and destination node is updated, comprising:
Corresponding database change process call back function is determined according to changed data, and is called at database variation Manage call back function;
If the corresponding database change process call back function is normal commands, the common configuration object section of variation is positioned Point;If the common configuration Object node exists, call the call back function of the common configuration Object node, carry out knot removal or Modification;If the common configuration Object node is not present, the call back function of the normal commands is called, generates corresponding common configuration Object node;
If the corresponding database change process call back function is template, the template instances Object node of variation is positioned; If drawing template establishment example, then new template instances Object node is generated;If template instances are deleted, then the template instances are deleted Object node and its child node.
In this example, in order to support incremental update, need to establish database data, renewal function (is referred to as counting According to library change process call back function) and the triangular connection of Buildrun result can become in turn according in database The data of change determine corresponding database change process call back function, in turn, the section for needing to update in location base Buildrun Point (i.e. above-mentioned destination node), and destination node is updated, specific implementation is carried out hereinafter in conjunction with specific example Illustrate, this will not be repeated here for the embodiment of the present invention.
In order to make those skilled in the art more fully understand technical solution provided in an embodiment of the present invention, below with reference to specific Example is illustrated technical solution provided in an embodiment of the present invention.
For the output of the Buildrun shown in Fig. 2, as shown in Fig. 2, passing through the area specific symbol (in Fig. 2 by taking " # " as an example) It paragraphs, the hierarchical relationship of configuration is indicated by retraction.
Institutional framework inside Buildrun can be as shown in Figure 3A, and as shown in Figure 3A, template Root (root node) makees For the root node of entire Buildrun, the information of readjustment or subtemplate below according to priority arrangement plug-in registration.It is excellent First grade is used to control the genesis sequence of Buildrun content, guarantees for same running configuration Buildrun's the result is that the same 's.
When Builrun is generated, since template Root, according to priority, call back function is successively called.Use depth Preferential mode, calls the call back function of each plug-in registration or the information of subtemplate, the call back function of each plug-in registration from Operation data is obtained in system (by taking DBM as an example), text information output is generated according to the logic of itself.
In this embodiment, it is contemplated that two features of Buildrun:
Feature 1: obtaining continuity of the demand there are the time of Buildrun, i.e., in a period of time, can be relatively more frequent Acquisition Buildrun information.
Feature 2: when the change configured every time causes configuration information to change (data i.e. in database change), usually Only influence the sub-fraction content of Buildrun.
In order to utilize above-mentioned two feature of Buildrun, while the influence to DBM performance is avoided, receives Buildrun and ask After asking, main DBM may determine whether that (i.e. above-mentioned target DBM is known as in the embodiment DBM for generating Buildrun DBM4B)。
If it does not exist, then the time-to-live of the DBM4B can be arranged as DBM4B with the copy of mono- DBM of fork in main DBM (for 15 minutes), and Buildrun request is sent to the DBM4B, it is generated by DBM4B according to own database Buildrun。
If it exists, then main DBM requests Buildrun to be sent to DBM4B, is generated by DBM4B according to own database Buildrun。
In this embodiment, after main DBM generates DBM4B, DBM4B can construct one according to the data in own database Basic Buildrun, and it is added to the channel of backing up in realtime of DBM;The subsequent data modification to main DBM by channel of backing up in realtime, It backs up in realtime to DBM4B;On the one hand DBM4B updates the data in data, on the other hand, impacted to basic Buildrun Part quickly updated, to guarantee the data in the Buildrun and own database that generate based on basic Buildrun It is consistent.
In this embodiment, Fig. 3 B is referred to, it, can be to the basis of DBM4B generation in order to realize incremental update Buildrun carries out structuring (by taking tree structure as an example).
When data variation occurs for the database of DBM4B, data variation can be notified to plug-in unit;Plug-in unit parses generation The data of variation, and the interface (including addition/deletion/modification interface) provided by basis Buildrun, positioning needs in DBM4B Update the node (i.e. above-mentioned destination node) (including addition/deletion/modification).
In this embodiment, Fig. 3 C is referred to, in order to realize incremental update, letter can be adjusted back with registration database change process Number, and database (referred to as DB) the change process call back function is associated with call back function.When data are sent out in DB example When changing, data variation can be notified to give DB change process call back function, be positioned and needed by DB change process call back function The node (in Fig. 3 C by taking template instances Object node as an example) of update calls corresponding call back function to carry out incremental update in turn.
Wherein, DB example and DB change process call back function are the relationships of multi-to-multi.One DB change process call back function The data variation of multiple DB examples can be paid close attention to.The data variation of one DB example can be by multiple DB change process call back functions Concern.
DB change process call back function and call back function are one-to-one relationships.
In this embodiment, the core data of basic Buildrun includes: template instances Object node and common configuration pair As node;Wherein:
Template instances Object node includes two core datas:
1, Instance Name, for identifying template instances Object node;
2, Buildrun data call the data of the readjustment output of the template instances, for accelerating the output of Buildrun.
Common configuration Object node includes three core datas:
1, call back function for updating Buildrun data, and identifies common configuration Object node;
2, Buildrun data, the data for calling the call back function to export, for accelerating the output of Buildrun;
3, Buildrun Level (i.e. priority), for being ranked up between same node layer.
The priority of the template instances object dissolved due to same template instances is identical, and plug-in unit is needed to participate in sequence, in order to Facilitate the sequence of template instances object, Virtual Node can be introduced, the template instances Object node which dissolves Child node as the Virtual Node, each template instances Object node under same Virtual Node are mentioned using plug-in unit The ranking functions of confession sort.Virtual Node and other same node layers (Virtual Node or common configuration Object node) are pressed According to priority ranking, schematic diagram can be as shown in Figure 3D.
Basic Buildrun (being referred to as Cfg Tree (configuration tree)) based on above-mentioned tree structure, when DBM4B connects When receiving Buildrun request, each node is traversed by depth-first traversal, traverses the Buildrun data of each node, And export the Buildrun data of each node in a binary fashion, character string assembly is avoided, and (i.e. without useless traversal There is no the template instances of Buildrun data or normal commands will not generate corresponding node, and specific implementation will hereinafter It is illustrated), improve the efficiency of Buildrun generation.
In order to make those skilled in the art more fully understand the basis of tree structure described in the embodiment of the present invention Buildrun is below illustrated the initialization building process of basic Buildrun.
In this embodiment, after main DBM generates DBM4B, DBM4B is successively called according to the BuildrunLevel of registration Call back function.
During constructing basis Buildrun, when calling the case-based system call back function of template registration, mould is generated Plate instance objects node;When calling the call back function of normal commands, common configuration Object node is generated.
Wherein, after template instances, recurrence repeats above-mentioned process, and schematic diagram can be as shown in FIGURE 3 E.
In this embodiment, for common configuration Object node, initialization logic schematic diagram can be right as illustrated in Figure 3 F In normal commands, DBM4B can call the call back function of the normal commands, and detect whether to match confidence there are the normal commands Breath is output to designated memory space.Since configuration information is usually output to designated memory space in the form of text information, Whether can detecte has text information to be output to designated memory space.
If there is text information to be output to designated memory space, common configuration Object node is generated, the common configuration object Node is Key with the call back function of the normal commands, is with the content of text for calling the call back function of the normal commands to export Buildrun data, and using the Buildrun Level of the normal commands as Buildrun Level.
If being output to designated memory space without text information, common configuration Object node is not generated, that is, is returned empty (NULL)。
In this embodiment, for template instances Object node, initialization logic schematic diagram can be right as shown in Figure 3 G In template, DBM4B can create the Virtual Node of the corresponding template, and be registered in the template according to priority recursive call Under subtemplate initialization function.
If the initialization function returns template instances Object node, which is added to Virtual In the child list of Node;
If the initialization function does not return to template instances Object node, next subtemplate initialization function is called.
When whole subtemplate initialization functions are called, DBM4B can detecte whether deposit under the Virtual Node In child node.
If it exists, then the Virtual Node is returned;
Otherwise, the Virtual Node is deleted, NULL is returned.
In this embodiment, based on the basic Buildrun of above-mentioned tree structure, incremental update may be implemented, that is, work as data It in library when data variation, is updated for the node influenced by the data variation, without influencing other nodes.
Illustratively, the template instances Object node in basic Buildrun and common configuration Object node can be registered The data change event of DB, such as data addition/deletion/modification.
When detecting the data change event of DB, DB change process call back function can be used and navigate to impacted section Point, and by calling the call back function of the node to carry out node updates.
Template instances update
For template instances, basic Buildrun provides following operation:
1, example (AddNewInstance) is created:
AddNewInstance (IN Char*pcMode, IN char*pcBdr).
Wherein, pcBdr is Buildrun data, and pcMode is the data for being actually subjected to be transmitted to other Buildrun under template.
Basic Buildrun converts the data into newly-generated example by context.
2, example (RemoveInstance) is deleted:
RemoveInstance(IN char*pcPath)。
In this embodiment, the data for marking needs to delete using the mode in path.
For the output of the Buildrun shown in Fig. 2, if ip vpn-instance module is responsive to ip vpn-instance 2 delete, then at least there is two ways as parameter and call RemoveInstance (), and notice basis Buildrun deletes real Example.
A), the fullpath using absolute path " | Root | ip vpn-instance 2 ", i.e., since root node;
B), the opposite road using relative path " | ip vpn-instance 2 ", i.e., since current template position Diameter.
For normal commands, basic Buildrun provides following operation:
1, label variation node (MarkUpdate):
MarkUpdate(CHAR*pcPath)。
The interface can be used for modification/deletion/addition data.
Plug-in unit calls creation related object without paying close attention to affiliated template instances, frame automatically.
For the output of the Buildrun shown in Fig. 2, if txn policy module detects DB change events, frame is notified " | Root | ip vpn-instance 2 | address family ipv4 " it needs to update, indicate Buildrun's without display Call back function.It can determine that needs updated is the call back function of txn policy by context DBM4B, frame is responsible for positioning To " txn policy tx1 " and update.
In this embodiment, the incremental update logic based on above-mentioned basis Buildrun can work as detection as shown in figure 3h When DB data change event, impacted node can be positioned by DB change process call back function, and call the node corresponding Call back function.
For normal commands, the common configuration Object node of variation is positioned.If the common configuration Object node exists, adjust With the call back function of the common configuration Object node, knot removal or modification are carried out;If the common configuration Object node is not present, The call back function for then calling the normal commands generates corresponding common configuration Object node.
For template, the template instances Object node of variation is positioned;If drawing template establishment example, then in the manner described above just The new template instances of beginningization;If template instances are deleted, then the template instances Object node and its child node are deleted.
In this embodiment, in order to which the efficiency for further increasing Buildrun generation can receive template instances in advance Collect the Buildrun data of the child node of the template instances, and add it in the Buildrun data of the template instances, Schematic diagram can as shown in fig. 31, in turn, when generating Buildrun based on basis Buildrun, for template instances object section Point can be exported directly using the Buildrun data that the template instances Object node records, without further time Go through the child node of the template instances object.
Through above description as can be seen that in technical solution provided in an embodiment of the present invention, when main DBM is received When Buildrun is requested, it is determined whether there is the target DBM for generating Buildrun;If it exists, then main DBM by Buildrun Request is sent to target DBM, when being requested to generate Buildrun according to Buildrun by target DBM, and refreshing the survival of target DBM Between;If it does not exist, then main DBM generates target DBM, the time-to-live of target DBM is arranged, and Buildrun request is sent to mesh DBM is marked, is requested to generate Buildrun according to Buildrun by target DBM, using obtaining the demand of Buildrun in time Consecutive hours, the target DBM for being used to generate Buildrun that main DBM is generated can't complete just to exit after Buildrun is generated, and It is to avoid frequently generating and exit for target DBM there are a time-to-live, improve the efficiency of Buildrun generation.
Fig. 4 is referred to, provides a kind of structural schematic diagram of device for generating the reverse textual of configuration for the embodiment of the present invention, Wherein, the device which configures reverse textual can be applied to above method embodiment, as shown in figure 4, the generation configures The device of reverse textual may include: main DBM410 and target DBM420;Wherein:
The main DBM410, for when receiving Buildrun request, it is determined whether exist for generating Buildrun Target DBM;
The main DBM410, is also used to if it exists, then Buildrun request is sent to the target DBM, by institute It states target DBM to be requested to generate Buildrun according to the Buildrun, and refreshes the time-to-live of the target DBM;
The main DBM410, is also used to if it does not exist, then generates the target DBM, when the survival of the target DBM is arranged Between, and Buildrun request is sent to the target DBM, it please be seek survival by the target DBM according to the Buildrun At Buildrun.
In an alternative embodiment, the target DBM420 is also used to the target DBM according to the data in own database Construct basis Buildrun;Wherein, the basis Buildrun is tree structure;
The target DBM420 is specifically used for generating Buildrun according to the basis Buildrun.
In an alternative embodiment, the target DBM420, specifically for successively being called according to the Buildrun grade of registration Each call back function;When calling the case-based system call back function of template registration, template instances Object node is generated, the template is real Example Object node includes the Instance Name and the template instances Object node for identifying the template instances Object node Buildrun data;When calling the call back function of normal commands, common configuration Object node, the common configuration object are generated Node includes the Buildrun for identifying the call back function of the common configuration Object node, the common configuration Object node The Buildrun grade of data and the common configuration Object node.
In an alternative embodiment, the target DBM420 is specifically used for creating dummy node, and will be described for template Child node of the template instances Object node that template instances obtain as the dummy node;
Wherein, the multiple template instance objects node same template instances obtained, using predetermined order function into Row sequence.
In an alternative embodiment, the target DBM420, specifically for creating the dummy node of the corresponding template;According to Buildrun grade recycle calls the subtemplate initialization function being registered under the template;If the subtemplate initialization function returns Template instances Object node has been returned, then the template instances Object node is added to the child list of the dummy node;Work as registration It is out-of-date that subtemplate initialization function under the template is called, if the dummy node there are child node, returns to this virtually Node;Otherwise, the dummy node is deleted.
In an alternative embodiment, for any template instances Object node, the Buildrun of the template instances Object node Data include the Buildrun data of whole child nodes of the template instances Object node.
In an alternative embodiment, the target DBM420, specifically for calling the call back function of the normal commands;When depositing When the corresponding configuration information of the normal commands is output to designated memory space, the corresponding common configuration pair of the normal commands is generated As node.
In an alternative embodiment, the main DBM410 is also used to when data change event occurs for database, Xiang Suoshu mesh It marks DBM and sends change notification;
The target DBM420, is also used to determine changed data according to the change notification, and according to becoming The data of change update the database of itself;And it is determined in the basis Buildrun and is needed more according to changed data New destination node, and the destination node is updated.
In an alternative embodiment, the target DBM420, specifically for determining corresponding number according to changed data According to library change process call back function, and call the database change process call back function;If the database change process The corresponding normal commands of call back function then position the common configuration Object node of variation;If the common configuration Object node exists, The call back function of the common configuration Object node is then called, knot removal or modification are carried out;If the common configuration Object node is not In the presence of then calling the call back function of the normal commands, generate corresponding common configuration Object node;If at the database variation It is template that it is corresponding, which to manage call back function, then positions the template instances Object node of variation;If drawing template establishment example, then generate new Template instances Object node;If template instances are deleted, then the template instances Object node and its child node are deleted.
Fig. 5 is referred to, for a kind of hardware configuration for the device for generating the reverse textual of configuration provided in an embodiment of the present invention Schematic diagram.The device that the generation configures reverse textual may include processor 501, the machine for being stored with machine-executable instruction Readable storage medium storing program for executing 502.Processor 501 can be communicated with machine readable storage medium 502 via system bus 503.Also, pass through It reads and executes the executable finger of machine corresponding with the logic for generating the reverse textual of configuration in machine readable storage medium 502 It enables, the above-described method for generating and configuring reverse textual can be performed in processor 501.
Machine readable storage medium 502 referred to herein can be any electronics, magnetism, optics or other physical stores Device may include or store information, such as executable instruction, data, etc..For example, machine readable storage medium can be easily Lose memory, nonvolatile memory or similar storage medium.Specifically, machine readable storage medium 502 can be RAM (Radom Access Memory, random access memory), flash memory, memory driver (such as hard disk drive), solid state hard disk, Any kind of storage dish (such as CD, DVD) perhaps similar storage medium or their combination.
The embodiment of the invention also provides a kind of machine readable storage mediums including machine-executable instruction, such as Fig. 5 In machine readable storage medium 502, the machine-executable instruction can be by generating in the device for configuring reverse textual Reason device 501 is executed to realize the method described above for generating the reverse textual of configuration.
The function of each unit and the realization process of effect are specifically detailed in the above method and correspond to step in above-mentioned apparatus Realization process, details are not described herein.
For device embodiment, since it corresponds essentially to embodiment of the method, so related place is referring to method reality Apply the part explanation of example.The apparatus embodiments described above are merely exemplary, wherein described be used as separation unit The unit of explanation may or may not be physically separated, and component shown as a unit can be or can also be with It is not physical unit, it can it is in one place, or may be distributed over multiple network units.It can be according to actual The purpose for needing to select some or all of the modules therein to realize the present invention program.Those of ordinary skill in the art are not paying Out in the case where creative work, it can understand and implement.
As seen from the above-described embodiment, when main DBM receives Buildrun request, it is determined whether exist for generating The target DBM of Buildrun;If it exists, then main DBM by Buildrun request be sent to target DBM, by target DBM according to Buildrun request generates Buildrun, and refreshes the time-to-live of target DBM;If it does not exist, then main DBM generates target DBM, The time-to-live of target DBM is set, and Buildrun request is sent to target DBM, is requested by target DBM according to Buildrun Buildrun is generated, using the consecutive hours of the demand of Buildrun in time is obtained, what main DBM was generated is used to generate The target DBM of Buildrun can't complete just to exit after Buildrun is generated, but there are a time-to-live, it avoids Target DBM's frequently generates and exits, and improves the efficiency of Buildrun generation.
Those skilled in the art after considering the specification and implementing the invention disclosed here, will readily occur to of the invention its Its embodiment.This application is intended to cover any variations, uses, or adaptations of the invention, these modifications, purposes or Person's adaptive change follows general principle of the invention and including the undocumented common knowledge in the art of the present invention Or conventional techniques.The description and examples are only to be considered as illustrative, and true scope and spirit of the invention are by following Claim is pointed out.
It should be understood that the present invention is not limited to the precise structure already described above and shown in the accompanying drawings, and And various modifications and changes may be made without departing from the scope thereof.The scope of the present invention is limited only by the attached claims.

Claims (18)

1. a kind of generate the method for configuring reverse textual characterized by comprising
When main memory database D BM, which is received, configures reverse textual Buildrun request, it is determined whether exist for generating The target DBM of Buildrun;
If it exists, then the main DBM requests the Buildrun to be sent to the target DBM, by the target DBM according to institute It states Buildrun request and generates Buildrun, and refresh the time-to-live of the target DBM;
If it does not exist, then the main DBM generates the target DBM, the time-to-live of the target DBM is arranged, and will be described Buildrun request is sent to the target DBM, is requested to generate Buildrun according to the Buildrun by the target DBM.
2. the method according to claim 1, wherein after the main DBM generation target DBM, further includes:
The target DBM constructs basis Buildrun according to the data in own database;Wherein, the basis Buildrun is Tree structure;
The target DBM requests to generate Buildrun according to the Buildrun, comprising:
The target DBM generates Buildrun according to the basis Buildrun.
3. according to the method described in claim 2, it is characterized in that, the target DBM is according to the data structure in own database Build basic Buildrun, comprising:
The target DBM successively calls each call back function according to the Buildrun grade of registration;
When calling the case-based system call back function of template registration, template instances Object node, the template instances object are generated Node includes the Instance Name and the template instances Object node for identifying the template instances Object node Buildrun data;
When calling the call back function of normal commands, common configuration Object node is generated, the common configuration Object node includes For identifying the call back function of the common configuration Object node, the Buildrun data of the common configuration Object node, with And the Buildrun grade of the common configuration Object node.
4. according to the method described in claim 3, it is characterized in that, the generation template instances Object node, comprising:
For template, dummy node is created, and the template instances Object node that the template instances are obtained is as the void The child node of quasi- node;
Wherein, the multiple template instance objects node obtained for same template instances, is arranged using predetermined order function Sequence.
5. according to the method described in claim 4, it is characterized in that, the creation dummy node, the template instances are obtained Child node of the template instances Object node arrived as the dummy node, comprising:
Create the dummy node of the corresponding template;
The subtemplate initialization function being registered under the template is called according to Buildrun grade recycle;
If the subtemplate initialization function returns template instances Object node, which is added should The child list of dummy node;
When the subtemplate initialization function being registered under the template be called it is out-of-date, if the dummy node there are child node, Return to the dummy node;
Otherwise, the dummy node is deleted.
6. according to the described in any item methods of claim 3-5, which is characterized in that, should for any template instances Object node The Buildrun data of template instances Object node include the Buildrun number of whole child nodes of the template instances Object node According to.
7. according to the method described in claim 3, it is characterized in that, the generation common configuration Object node, comprising:
Call the call back function of the normal commands;
When being output to designated memory space there are the corresponding configuration information of the normal commands, it is corresponding general to generate the normal commands Wildcard sets Object node.
8. according to the method described in claim 2, it is characterized in that, the target DBM is according to the data structure in own database It builds after basic Buildrun, further includes:
When data change event occurs for the database of the main DBM, Xiang Suoshu target DBM sends change notification;
The target DBM determines changed data according to the change notification, and is updated certainly according to changed data The database of body;
And the destination node for needing to update in the basis Buildrun is determined according to changed data, and to described Destination node is updated.
9. according to the method described in claim 8, it is characterized in that, described determine the basis according to changed data The destination node for needing to update in Buildrun, and the destination node is updated, comprising:
Corresponding database change process call back function is determined according to changed data, and is called at the database variation Manage call back function;
If the corresponding database change process call back function is normal commands, the common configuration object section of variation is positioned Point;If the common configuration Object node exists, call the call back function of the common configuration Object node, carry out knot removal or Modification;If the common configuration Object node is not present, the call back function of the normal commands is called, generates corresponding common configuration Object node;
If the corresponding database variation call back function is template, the template instances Object node of variation is positioned;If wound Template instances are built, then generate new template instances Object node;If template instances are deleted, then the template instances object section is deleted Point and its child node.
10. a kind of generate the device for configuring reverse textual characterized by comprising main DBM and target DBM;Wherein:
The main DBM, for when receiving Buildrun request, it is determined whether there is the target for generating Buildrun DBM;
The main DBM, is also used to if it exists, then Buildrun request is sent to the target DBM, by the target DBM requests to generate Buildrun according to the Buildrun, and refreshes the time-to-live of the target DBM;
The main DBM, is also used to if it does not exist, then generates the target DBM, the time-to-live of the target DBM is arranged, and will The Buildrun request is sent to the target DBM, requests to generate according to the Buildrun by the target DBM Buildrun。
11. device according to claim 10, which is characterized in that
The target DBM is also used to the target DBM according to the data in own database and constructs basis Buildrun;Wherein, The basis Buildrun is tree structure;
The target DBM is specifically used for generating Buildrun according to the basis Buildrun.
12. device according to claim 11, which is characterized in that
The target DBM, specifically for successively calling each call back function according to the Buildrun grade of registration;When calling template note When the case-based system call back function of volume, template instances Object node is generated, the template instances Object node includes for identifying The Buildrun data of the Instance Name of the template instances Object node and the template instances Object node;It is general when calling When the call back function of logical order, common configuration Object node is generated, the common configuration Object node includes described for identifying The call back function of common configuration Object node, the common configuration Object node Buildrun data and described commonly match Set the Buildrun grade of Object node.
13. device according to claim 12, which is characterized in that
The target DBM is specifically used for creating dummy node for template, and the template that the template instances are obtained is real Child node of the example Object node as the dummy node;
Wherein, the multiple template instance objects node obtained for same template instances, is arranged using predetermined order function Sequence.
14. device according to claim 13, which is characterized in that
The target DBM, specifically for creating the dummy node of the corresponding template;It calls and registers according to Buildrun grade recycle Subtemplate initialization function under the template;If the subtemplate initialization function returns template instances Object node, The template instances Object node is added to the child list of the dummy node;When the subtemplate initialization being registered under the template It is out-of-date that function is called, if the dummy node there are child node, returns to the dummy node;Otherwise, the dummy node is deleted.
15. the described in any item devices of 2-14 according to claim 1, which is characterized in that for any template instances Object node, The Buildrun data of the template instances Object node include the Buildrun of whole child nodes of the template instances Object node Data.
16. device according to claim 12, which is characterized in that
The target DBM, specifically for calling the call back function of the normal commands;When having, there are the corresponding configurations of the normal commands When information is output to designated memory space, the corresponding common configuration Object node of the normal commands is generated.
17. device according to claim 11, which is characterized in that
The main DBM is also used to when data change event occurs for database, and Xiang Suoshu target DBM sends change notification;
The target DBM is also used to determine changed data according to the change notification, and according to changed data Update the database of itself;And the target for needing to update in the basis Buildrun is determined according to changed data Node, and the destination node is updated.
18. device according to claim 17, which is characterized in that
The target DBM, specifically for determining corresponding database change process call back function according to changed data, and Call the database change process call back function;If the corresponding database change process call back function is normal commands, Then position the common configuration Object node of variation;If the common configuration Object node exists, the common configuration object section is called The call back function of point carries out knot removal or modification;If the common configuration Object node is not present, the normal commands are called Call back function generates corresponding common configuration Object node;If the corresponding database change process call back function is template, Then position the template instances Object node of variation;If drawing template establishment example, then new template instances Object node is generated;If Template instances are deleted, then delete the template instances Object node and its child node.
CN201910673000.0A 2019-07-24 2019-07-24 Method and device for generating configuration reverse textualization Active CN110287220B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910673000.0A CN110287220B (en) 2019-07-24 2019-07-24 Method and device for generating configuration reverse textualization

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910673000.0A CN110287220B (en) 2019-07-24 2019-07-24 Method and device for generating configuration reverse textualization

Publications (2)

Publication Number Publication Date
CN110287220A true CN110287220A (en) 2019-09-27
CN110287220B CN110287220B (en) 2021-08-24

Family

ID=68023941

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910673000.0A Active CN110287220B (en) 2019-07-24 2019-07-24 Method and device for generating configuration reverse textualization

Country Status (1)

Country Link
CN (1) CN110287220B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1412995A (en) * 2002-10-16 2003-04-23 华为技术有限公司 Information management method in data communication equipment
CN101827078A (en) * 2009-12-30 2010-09-08 华为技术有限公司 Inquiry method, server and communication system for configured data difference
CN103186639A (en) * 2011-12-31 2013-07-03 腾讯科技(北京)有限公司 Data generation method and system
CN107329782A (en) * 2017-06-23 2017-11-07 武汉长光科技有限公司 A kind of method for lifting embedded device configuration file read-write efficiency
CN108363545A (en) * 2017-01-26 2018-08-03 华为技术有限公司 A kind of data configuration method and data configuration device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1412995A (en) * 2002-10-16 2003-04-23 华为技术有限公司 Information management method in data communication equipment
CN101827078A (en) * 2009-12-30 2010-09-08 华为技术有限公司 Inquiry method, server and communication system for configured data difference
CN103186639A (en) * 2011-12-31 2013-07-03 腾讯科技(北京)有限公司 Data generation method and system
CN108363545A (en) * 2017-01-26 2018-08-03 华为技术有限公司 A kind of data configuration method and data configuration device
CN107329782A (en) * 2017-06-23 2017-11-07 武汉长光科技有限公司 A kind of method for lifting embedded device configuration file read-write efficiency

Also Published As

Publication number Publication date
CN110287220B (en) 2021-08-24

Similar Documents

Publication Publication Date Title
CN105938448B (en) Method and apparatus for data duplication
US20180367365A1 (en) State control method and apparatus
JP2553307B2 (en) Process monitoring method
US20140310278A1 (en) Creating global aggregated namespaces for storage management
CN108920116A (en) Throw control method, device, equipment and the storage medium of screen equipment
US7447709B1 (en) Methods and apparatus for synchronizing content
US10726042B2 (en) Replication control using eventually consistent meta-data
JP2011516994A (en) Data placement according to instructions to redundant data storage system
US8984332B2 (en) Active/passive database management across clusters
US9281992B2 (en) Method and system for identifying storage device
CN105550288A (en) Database system updating method and management system
JP2009505256A (en) Method, system, and program for maintaining an aggregate containing active files in a storage pool (maintaining an aggregate containing active files in a storage pool)
US10423529B2 (en) Systems and methods for reconstructing cache loss
US20140359461A1 (en) Apparatus And Method Providing Unified Network Management
CN104731943A (en) Server and data processing method
US10033812B2 (en) Framework for distributed key-value store in a wide area network
US11789745B2 (en) Systems and methods for automated and distributed configuration of computing devices
CN105357042A (en) High-availability cluster system, master node and slave node
US7805503B2 (en) Capability requirements for group membership
CN109407975B (en) Data writing method, computing node and distributed storage system
US9454316B2 (en) Cluster consistent logical storage object naming
CN107222575B (en) The method that OPC is communicated between realization industrial control equipment
CN108306780B (en) Cloud environment-based virtual machine communication quality self-optimization system and method
CN107193563B (en) Method for managing server stateless firmware version
WO2021082868A1 (en) Data managmenet method for distributed storage system, apparatus, and electronic 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
GR01 Patent grant
GR01 Patent grant