WO2017084410A1 - 一种网管数据同步方法及装置 - Google Patents
一种网管数据同步方法及装置 Download PDFInfo
- Publication number
- WO2017084410A1 WO2017084410A1 PCT/CN2016/097821 CN2016097821W WO2017084410A1 WO 2017084410 A1 WO2017084410 A1 WO 2017084410A1 CN 2016097821 W CN2016097821 W CN 2016097821W WO 2017084410 A1 WO2017084410 A1 WO 2017084410A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- record
- field
- data
- data model
- field list
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
Definitions
- the present invention relates to the field of network management data synchronization, and in particular, to a network management data synchronization method and apparatus.
- the configuration data in the network management system needs to be synchronized to the network element.
- the synchronization types include full table synchronization and incremental synchronization. Synchronization of the entire table means that all the data in the network management is sent to the network element. Incremental synchronization is to first obtain the entire data of the network management system and the network element data, and then compare the two types of data, and send the comparison data to the network element.
- the current related network synchronization technology is about the overall synchronization process method and its improvement, that is, how to improve the data synchronization process after obtaining the synchronization data, but the model of the synchronous data processing is not involved.
- the main technical problem to be solved by the embodiments of the present invention is to provide a network management data synchronization method and device, which solves the dependency relationship between the service logic and the field format in the prior art when data synchronization is performed, resulting in system scalability and maintainability. Sexuality is affected, increasing technical issues of maintenance costs and development difficulty.
- an embodiment of the present invention provides a network management data synchronization method, including:
- the data model storing at least one record, the record including a table name indicating a data source, a field of a data, and a field list identifier corresponding to the data;
- the record to be synchronized is restored to synchronous data and delivered.
- the data model includes at least one field library, the field library includes at least one field list, the field list includes at least one field of the data, and the field library has a one-to-one correspondence with the table name.
- the field list has a one-to-one correspondence with the field list identifier.
- the saving in the data model includes:
- the record further includes a table number of the data, where the table number is in one-to-one correspondence with the table name; and the corresponding field library is searched in the data model according to the table number.
- the field list is sorted according to the field list identifier in the record. If the field list identifier is the same, the field is sorted according to the order in which the recorded fields are added and saved in the data model. in.
- the data model includes a source data model and a target data model, and determining the record to be synchronized from the data model includes any one of the following manners:
- the flag information includes any one of a delete flag, a first delete flag, an insert flag, and an update flag.
- restoring the to-be-synchronized record to the synchronization data and delivering the method includes:
- the to-be-synchronized record is restored to the synchronization data and delivered according to the field format.
- the method before determining the record to be synchronized from the data model, the method further includes: deleting or modifying the record of the specified table name or the specified field list identifier in the specified table name.
- the embodiment of the invention further provides a network management data synchronization device, including:
- a storage module configured to create a data model, the data model storing at least one record, the record including a table name indicating a data source, a field of a data, and a field list identifier corresponding to the data;
- a determining module configured to generate the record by the acquired data, and save the data in the data model
- Selecting a module configured to determine a record to be synchronized from the data model
- the restoration module is configured to restore the to-be-synchronized record to synchronous data and deliver the data.
- the data model includes at least one field library, the field library includes at least one field list, the field list includes at least one field of the data, and the field library has a one-to-one correspondence with the table name.
- the field list has a one-to-one correspondence with the field list identifier.
- the determining module includes:
- a determining sub-module configured to determine whether the table name of the record exists in the data model, and if the table name of the record exists, determining whether the record exists in the field library corresponding to the table name a field list identifier; if there is a field list identifier of the record, searching for a field list corresponding to the field list identifier, and storing the field of the record in the field list; if the field list of the record does not exist Identifying, according to the field list, identifying a new field list and storing the field of the record in the field list; if the table name of the record does not exist, creating another field library according to the table name, where A new field list is identified in the field library according to the field list, and the field of the record is stored in the field list.
- the record further includes a table number of the data, where the table number is in one-to-one correspondence with the table name; and the corresponding field library is searched in the data model according to the table number.
- the field list is sorted according to the field list identifier in the record. If the field list identifier is the same, the field is sorted according to the order in which the recorded fields are added and saved in the data model. in.
- the data model includes a source data model and a target data model
- the selection module includes:
- a first selection submodule configured to determine a record in the source data model as a record to be synchronized
- a second selection submodule configured to compare the record in the source data model with the record in the target data model to obtain an incremental comparison record, and determine the incremental comparison record as a record to be synchronized, the incremental comparison record
- the operation flag information is further included, and the operation flag information includes any one of a deletion flag, a first deletion flag, an insertion flag, and an update flag.
- the restoration module includes:
- a third determining submodule configured to determine a field format of the record to be synchronized
- an atomic module configured to restore the to-be-synchronized record to the synchronous data according to the field format and deliver the same.
- the method further includes a processing module, where the processing module is configured to delete or modify the record of the specified table name or the specified field list identifier in the specified table name before the selecting module.
- a storage medium is also provided.
- the storage medium Set to store the program code used to perform the following steps:
- the data model storing at least one record, the record including a table name indicating a data source, a field of data, and a field list identifier corresponding to the data; generating the record from the acquired data, and saving
- the record to be synchronized is determined from the data model; the record to be synchronized is restored to the synchronous data and delivered.
- the invention provides a network management data synchronization method and device, in the process of data synchronization, creating a data model, wherein the data model stores at least one record, wherein the record includes a table name indicating a data source, a field of a data, and A field list identifier corresponding to a data; the generated data is generated and stored in the data model, and the data in different field formats can be uniformly adapted into a common data model for representation, and then the record to be synchronized is determined from the data model. The record to be synchronized is restored to the synchronized data and delivered. There is no need to process different data in different field formats with different business logic, just to represent complex data formats through simple data structures.
- the data is synchronized by the common data model, and the business logic does not have a dependency on the field format. Only when the data is recorded and stored in the data model or the records in the data model are restored to synchronous data and delivered.
- the specific field format is determined, and the field format is easily extended to other field formats, thereby improving the scalability, maintainability, and stability of the system, and correspondingly reducing development difficulty and maintenance cost.
- FIG. 1 is a flowchart of a method for synchronizing network management data according to Embodiment 1 of the present invention
- FIG. 3 is a flowchart of sorting when saving records according to Embodiment 1 of the present invention.
- FIG. 5 is a flowchart of writing a file to be synchronized to a file according to Embodiment 1 of the present invention
- FIG. 6 is a flowchart of writing a field to a file according to Embodiment 1 of the present invention.
- FIG. 7 is a flowchart of deleting or inserting records according to Embodiment 1 of the present invention.
- FIG. 8 is a schematic diagram of a network management data synchronization apparatus according to Embodiment 2 of the present invention.
- Embodiment 1 is a diagrammatic representation of Embodiment 1:
- FIG. 1 is a flowchart of a method for synchronizing network management data according to an embodiment.
- S101 Create a data model, where the data model stores at least one record, where the record includes a table name indicating a data source, a field of a data, and a field list identifier corresponding to the data;
- the data of different field formats are uniformly stored in the data model in the form of records, and then the records in the model are synchronized, so that the business logic and the field format of the data do not have a dependency relationship, thereby improving the system's Scalability, stability and maintainability also reduce maintenance costs and development difficulty.
- the created data model includes at least one field library including at least one field list, the field list including at least one field from the storage medium (including but not limited to databases and files)
- the field library has a one-to-one correspondence with the table name
- the field list has a one-to-one correspondence with the field list identifier.
- the field list identifier and the field do not have to have a one-to-one correspondence.
- the field list identifier here is similar to the field name, and there are multiple field formats between them: for a single format, one field list identifier corresponds to one field.
- one field list identifier corresponds to multiple fields;
- one field list identifier corresponds to one structure, the structure itself is also a list form field; and other subsequent field formats that need to be expanded.
- the data model defines a common interface, the model only interacts with the interface, through the interface, the data model does not need to deal with different types of fields. It is also possible to store data in different field formats in the data model through records. When data synchronization is performed, only the data model needs to be interacted.
- the record further includes a table serial number, the table serial number corresponding to the table name, and generated by the data model, for quickly and efficiently searching for the specified field library.
- the data structure of the data model is Hashmap ⁇ table name, Treemap ⁇ key, value>>, wherein the Treemap is equivalent to the field library, the key is equivalent to the field list identifier, the value is equivalent to the field list, and the key corresponds to the value one by one. And the value contains one or more fields.
- the hashmap is used for indexing, and the order between the table and the table need not be considered, and only the preset table number is sorted from small to large; after the table number index is used to the Treemap, that is, the field library, according to The one-to-one correspondence between key and value quickly finds the corresponding field.
- step S201 determining whether there is a table name of the record in the data model, if step S202 is performed, if not, executing step S202';
- a new field library is created, in which the new field list is identified according to the field list, and the field of the record is stored in the field list, and the table number and the table name are indexed into the index tree. in;
- step S203 determining whether there is a field list identifier of the record in the field library corresponding to the table name, if step S204 is performed, if not, executing step S204';
- step S401 determining whether the length of the field list identifier is consistent, if step S402 is performed, if not, executing step S402';
- the field list identifier is separated and each segment is compared, and if the value is small, the field list identifier is considered to be small, and the field list identifier is small and ranked first;
- the field list identification length is small in the front.
- the process of finding and sorting only the process of searching the field library by the table number can be performed; only the process of sorting the fields in the record by the field list identifier can be performed; or the process of searching the field library can be performed first, and then executing The process of sorting fields, the process can more accurately treat the added records for sorting.
- the way to specify a record includes any of the following:
- Obtain the record of the specified field list identifier in the specified table name in the data model first obtain the field library corresponding to the table name, and then obtain all the records in the corresponding field list identifier in the field library.
- Determining the record to be synchronized from the specified record includes any of the following methods:
- the obtained specified record is directly determined as the record to be synchronized
- the specified record in the network management data model is compared with the specified record in the network metadata model to obtain an incremental comparison record, and the incremental comparison record is determined as the record to be synchronized.
- the incremental comparison record includes any one of the following types of operation flag information: a deletion flag, an insertion flag, a first deletion, an addition flag, and an insertion flag, that is, a type of the incremental comparison record has a deletion record, and an insertion.
- a deletion flag it is for the record that exists in the network data model but exists in the network metadata model.
- the operation flag information in the record is the delete flag, indicating that the record existing in the network data model needs to be deleted; It is a record that exists in the network management data model and does not exist in the network metadata model.
- the operation flag information of the record is an insertion flag, indicating that the network management has added a new record and notifies the network element model to add the record;
- the post-increment record is a record that exists in the data model of the network management system and the network element, and if the key field in the record is modified or the parent record of the record in the network management data model is deleted first, then the record is referenced.
- the key field in the parent record but the parent record modifies the key field, causing the record to be modified accordingly, and the key fields in the corresponding network element are also modified, and the records existing in the network management data model are
- the operation flag information is deleted first and then increased, and the operation flag information of the record existing in the network metadata model is deleted, indicating that the network element and the network management Type in there the need to record It is deleted, and then the modified record is added to the network management model and notified to the network element model to be added.
- For the update flag it is for the records existing in the network management and the network metadata model, and there is no deletion first. After the increase, the two records are not equal, and the operation flag information of the record is an update flag, indicating that the network management model has modified the record, and the network element is notified to modify the record.
- step S501 determining whether the determined record to be synchronized is an incremental model, if step S502 is performed, if not, executing S502';
- S502 Obtain at least one of a deletion record, a first deletion, an increase record, an insertion record, and an update record existing in the incremental model;
- step S502' the specified record in the network management model is taken as the record to be synchronized, and then step S503 is performed;
- step S601 it is determined whether the field format of the record to be synchronized is a single format, if not step S602 is performed, if step S602' is performed;
- step S602 determining whether the field format of the record to be synchronized is a list format, and if not, executing step S603, if yes, executing step S603';
- S604 obtains the structure corresponding to the field list identifier, and then acquires all the fields in the structure body. And write the file in struct format.
- the programming language indicates that a field name SdrDeviceGroupId (similar to the field list identifier) corresponds to a field list value, and the field list includes only one field 1;
- the programming language indicates that a field name radioMode (similar to the field list identifier) corresponds to a field list value, and the field list includes two fields 8 and 16;
- the programming language indicates that a field name productData (similar to the field list identifier) corresponds to two structures productNumber and productName, and each field has a field list value.
- the field list includes a field 14337.
- the field list includes a field FAB.
- the manner in which the fields are obtained is similar, and is also within the scope of protection of this embodiment, and details are not described herein again.
- the record to be synchronized is written into a file or other carrier and then delivered.
- the records in the data model may also be deleted or modified before the records to be synchronized are determined.
- the added operations are covered in the added record to the model, and therefore will not be described here.
- This embodiment describes the deletion operation. The specific process is as follows:
- step S701 determining whether there is a record of the specified table name in the data model, if the step S702 is performed;
- step S702 determining whether there is a record in the data model that specifies the specified field list identifier in the table name, if the step S703 is performed;
- Embodiment 2 is a diagrammatic representation of Embodiment 1:
- FIG. 8 is a schematic diagram of a network management data synchronization apparatus according to an embodiment.
- the network management data synchronization device includes:
- the storage module 801 is configured to create a data model, where the data model stores at least one record, the record includes a table name indicating a data source, a field of a data, and a field list identifier corresponding to the data;
- the determining module 802 is configured to generate the recorded data and save the data in the data model
- a selection module 803, configured to determine a record to be synchronized from the data model
- the restoration module 804 is configured to restore the to-be-synchronized record to the synchronization data and deliver the data.
- the created data model includes at least one field library including at least one field list including at least one field from the storage medium (including but not limited to a database and an XML file)
- the field library corresponds to the table name one by one
- the field list has a one-to-one correspondence with the field list identifier.
- search and sort For example, when a row of data is fetched in the database, the row of data is a record that includes the table name, the field list identifier, and the field, and then stores the record in the data model.
- the field list identifier and the field do not have to have a one-to-one correspondence.
- the field list identifier here is similar to the field name, and there are multiple field formats between them: for a single format, one field list identifier corresponds to one field.
- a field list identifier corresponds to multiple fields; for a structure format, a field list identifier corresponds to a structure, and the structure itself is also a list form field; and other subsequent field formats that need to be expanded.
- the data model defines a common interface, the model only interacts with the interface, through the interface, the data model does not need to deal with different types of fields. It is also possible to store data in different field formats in the data model through records. When data synchronization is performed, only the data model needs to be interacted.
- the record further includes a table serial number, the table serial number corresponding to the table name, and generated by the data model, for quickly and efficiently searching for the specified field library.
- the data structure of the data model is a Hashmap ⁇ table name, Treemap ⁇ key, value>>, wherein the Treemap is equivalent to the field library, the key is equivalent to the field list identifier, the value is equivalent to the field list, and the key and value are A correspondence, and the value contains one or more fields.
- the hashmap is used for indexing, and the order between the table and the table need not be considered, and only the preset table number is sorted from small to large; after the table number index is used to the Treemap, that is, the field library, according to The one-to-one correspondence between key and value quickly finds the corresponding field.
- the determining module 802 includes: a determining submodule 8021;
- the determining sub-module 8021 is configured to determine whether the table name of the record exists in the data model, and if the table name of the record exists, determine whether the field of the record exists in the field library corresponding to the table name. a list identifier; if there is a field list identifier of the record, searching for a field list corresponding to the field list identifier, and storing the recorded field in the field list; if the field list identifier of the record does not exist, And identifying a new field list according to the field list and storing the field of the record in the field list; if the table name of the record does not exist, another field library is created according to the table name, where the field library is created. Identifying a new field list according to the field list, and storing the field of the record in the field list.
- the record further includes a table number of the data, and the table number corresponds to the table name one by one; and the corresponding field library is searched in the data model according to the table number.
- the short field list identifiers are ranked first; if they are consistent, the field list identifiers are separated by commas, and the size of each part is compared, and the small part considers the The field list identifier is short and side by side.
- the data model includes a source data model and a target data model
- the selection module 803 includes a first selection submodule 8031 and a second selection submodule 8032;
- the first selection submodule 8031 is configured to determine the record in the source data model as the record to be synchronized
- the second selection sub-module 8032 is configured to compare the record in the source data model with the record in the target data model to obtain an incremental comparison record, and determine the incremental comparison record as a record to be synchronized, the incremental comparison record
- the operation flag information is further included, and the operation flag information includes any one of a deletion flag, a first deletion flag, an insertion flag, and an update flag.
- the specified record is first acquired, and the record to be synchronized is determined after the specified data is obtained.
- the specified record includes any of the following methods:
- Obtain the record of the specified field list identifier in the specified table name in the data model first obtain the field library corresponding to the table name, and then obtain all the records in the corresponding field list identifier in the field library.
- the incremental comparison record includes any one of the following types of operation flag information: a deletion flag, an insertion flag, a first deletion, an addition flag, and an insertion flag, that is, a type of the incremental comparison record has a deletion record, and an insertion.
- Record, delete first, add or insert records, and all incremental comparison records form an incremental model.
- the operation flag information in the record is the delete flag, indicating that the record existing in the network data model needs to be deleted; It is a record that exists in the network management data model and does not exist in the network metadata model.
- the operation flag information of the record is an insertion flag, indicating that the network management has added a new record and notifies the network element model to add the record;
- the post-increment record is a record that exists in the data model of the network management system and the network element, and if the key field in the record is modified or the parent record of the record in the network management data model is deleted first, then the record is referenced. The key field in the parent record, but the parent record modifies the key field, causing the record to be modified accordingly.
- the key fields in the corresponding network element are also modified, and the records existing in the network management data model are The operation flag information is deleted first and then increased, and the operation flag information of the record existing in the network metadata model is deleted, indicating the network element and the network
- the records existing in the model need to be deleted first, and then the modified records are added to the network management model and notified to the network element model to be added.
- For the update flag it exists for both the network management and the network metadata model.
- the record does not exist first and then increase, and the two records are not equal.
- the operation flag information of the record is an update flag, indicating that the network management model has modified the record, and the network element is notified to modify the record. .
- the restoration module 804 includes a third determination submodule 8041 and an atomic module 8042; the third determination submodule 8041 is configured to determine a field format of the record to be synchronized; and the atomic module 8042 is configured to The synchronous record is restored to the synchronous data and delivered.
- the record to be synchronized When the record to be synchronized is sent to the network element, the record to be synchronized is usually written to the file and then sent, and the record to be synchronized is judged. If it is an incremental model, the deletion record existing in the incremental model is obtained. First delete and add at least one of the record, the insertion record, and the update record and write the file; if the record is specified in the network management model, the record is directly traversed and written to the file.
- the manner in which the fields are obtained is similar, and is also within the scope of protection of this embodiment, and details are not described herein again.
- the record to be synchronized is written to the file or other carrier and delivered to the network element.
- a processing module 802' is provided that is configured to delete or modify the record of the specified table name or the specified field list identifier in the specified table name.
- a processing module 802' is provided that is configured to delete or modify the record of the specified table name or the specified field list identifier in the specified table name.
- Embodiments of the present invention also provide a storage medium.
- the foregoing storage medium may be configured to store program code for performing the following steps:
- S1 creating a data model, the data model storing at least one record, the record comprising a table name indicating a data source, a field of a data, and a field list identifier corresponding to the data;
- modules or steps of the present invention described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein. Perform the steps shown or described, or separate them into individual integrated circuit modules, or multiple of them Blocks or steps are made in a single integrated circuit module. Thus, the invention is not limited to any specific combination of hardware and software.
- the invention provides a network management data synchronization method and device, in the process of data synchronization, creating a data model, wherein the data model stores at least one record, wherein the record includes a table name indicating a data source, a field of a data, and A field list identifier corresponding to a data; the generated data is generated and stored in the data model, and the data in different field formats can be uniformly adapted into a common data model for representation, and then the record to be synchronized is determined from the data model. The record to be synchronized is restored to the synchronized data and delivered. There is no need to process different data in different field formats with different business logic, just to represent complex data formats through simple data structures.
- the data is synchronized by the common data model, and the business logic does not have a dependency on the field format. Only when the data is recorded and stored in the data model or the records in the data model are restored to synchronous data and delivered.
- the specific field format is determined, and the field format is easily extended to other field formats, thereby improving the scalability, maintainability, and stability of the system, and correspondingly reducing development difficulty and maintenance cost.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种网管数据同步方法及装置,在进行数据同步的过程中,创建数据模型,该数据模型中存储至少一条记录,所述记录中包括一个表明数据来源的表名、一个数据的字段和一个数据对应的字段列表标识(S101);将获取的数据生成记录并存入数据模型中(S102),然后从数据模型中确定待同步记录(S103),将该待同步记录还原成同步数据并下发(S104)。无需对不同字段格式的数据采用不同业务逻辑进行处理,只需通过简单的数据结构表示复杂的数据格式。因此,通过通用的数据模型对数据进行同步,业务逻辑与字段格式不具备依赖关系,该字段格式易于扩展为其他字段格式,从而提高了***的可扩展性、可维护性及稳定性,相应的降低了开发的难度和维护成本。
Description
本本发明涉及一种网管数据同步领域,尤其涉及一种网管数据同步方法及装置。
卫星移动***中,需要将网管中配置数据同步到网元,同步类型包括整表同步和增量同步。整表同步表示将网管中的全部数据下发到网元,增量同步是首先获取网管整表数据和网元数据,接着对这两种数据进行比较,并把比较数据下发到网元。当前相关的网络同步技术都是关于整体同步流程方法及其改进,即获取到同步数据后如何对数据的同步流程进行改进,对于同步数据处理的模型却并未涉及。而在网管数据同步的过程中,会有多种来源(指存放存储介质,包括但不限于数据库和文件等)的数据参与同步。由于他们的存储方式不同,使得字段格式也很复杂,如:单一格式、列表格式和结构体格式等,不同字段格式的数据会存在不同的处理方式,程序语言对其定义方式也不同(即交互的接口不同),导致针对不同字段格式的数据都需要定义一个接口,在进行同步操作时也就需要调用各种不同的接口,不同字段格式的数据相应的也需要采用不同的业务逻辑进行处理,这种处理方式导致业务逻辑与字段格式出现依赖关系,使得***的稳定性、可扩展性及可维护性相应的受到影响,从而提高维护成本和开发难度。
发明内容
本发明实施例要解决的主要技术问题是,提供一种网管数据同步方法及装置,在进行数据同步时解决了现有技术中业务逻辑与字段格式存在依赖关系,导致***可扩展性以及可维护性受到影响,提高了维护成本和开发难度的技术问题。
为解决上述技术问题,本发明实施例提供了一种网管数据同步方法,包括:
创建数据模型,所述数据模型存储至少一条记录,所述记录包括一个表明数据来源的表名、一个数据的字段和一个与数据对应的字段列表标识;
将获取的数据生成所述记录,并保存在所述数据模型中;
从所述数据模型中确定待同步记录;
将所述待同步记录还原成同步数据并下发。
可选地,所述数据模型包括至少一个字段库,所述字段库包括至少一个字段列表,所述字段列表包括至少一个所述数据的字段;所述字段库与所述表名一一对应,所述字段列表与所述字段列表标识一一对应。
可选地,所述保存在所述数据模型中包括:
判断所述数据模型中是否存在所述记录的表名,若存在所述记录的表名,则判断该表名对应的字段库中是否存在所述记录的字段列表标识;若存在所述记录的字段列表标识,则查找所述字段列表标识对应的字段列表,并将所述记录的字段存入所述字段列表;若不存在所述记录的字段列表标识,则根据该字段列表标识新建字段列表并将所述记录的字段存入所述字段列表;
若不存在所述记录的表名,则根据所述表名新建另一字段库,在该字段库中根据所述字段列表标识新建字段列表,并将所述记录的字段存入该字段列表。
可选地,所述记录还包括数据的表序号,所述表序号与所述表名一一对应;根据所述表序号在所述数据模型中查找对应的字段库。
可选地,根据所述记录中的字段列表标识对所述字段列表进行排序,若所述字段列表标识一样,则按照所述记录的字段添加的先后顺序对该字段进行排序并保存在数据模型中。
可选地,所述数据模型包括源头数据模型和目标数据模型,从所述数据模型中确定待同步记录包括以下方式中的任意一种:
将源头数据模型中的记录确定为待同步记录;
将源头数据模型中的记录与目标数据模型中的记录进行比较,得到增量比较记录,将所述增量比较记录确定为待同步记录,所述增量比较记录包括操作标志信息,所述操作标志信息包括删除标志、先删后增标志、***标志和更新标志中的任意一种。
可选地,将所述待同步记录还原成同步数据并下发包括:
判断所述待同步记录的字段格式;
根据所述字段格式将所述待同步记录还原成所述同步数据并下发。
可选地,所述从所述数据模型中确定待同步记录之前还包括:删除或修改指定表名或指定表名中指定字段列表标识的记录。
本发明实施例还提供了一种网管数据同步装置,包括:
存储模块,设置为创建数据模型,所述数据模型存储至少一条记录,所述记录包括一个表明数据来源的表名、一个数据的字段和一个与数据对应的字段列表标识;
判断模块,设置为将获取的数据生成所述记录,并保存在所述数据模型中;
选择模块,设置为从所述数据模型中确定待同步记录;
还原模块,设置为将所述待同步记录还原成同步数据并下发。
可选地,所述数据模型包括至少一个字段库,所述字段库包括至少一个字段列表,所述字段列表包括至少一个所述数据的字段;所述字段库与所述表名一一对应,所述字段列表与所述字段列表标识一一对应。
可选地,所述判断模块包括:
判断子模块,设置为判断所述数据模型中是否存在所述记录的表名,若存在所述记录的表名,则判断该表名对应的字段库中是否存在所述记录
的字段列表标识;若存在所述记录的字段列表标识,则查找所述字段列表标识对应的字段列表,并将所述记录的字段存入所述字段列表;若不存在所述记录的字段列表标识,则根据该字段列表标识新建字段列表并将所述记录的字段存入所述字段列表中;若不存在所述记录的表名,则根据所述表名新建另一字段库,在该字段库中根据所述字段列表标识新建字段列表,并将所述记录的字段存入该字段列表中。
可选地,所述记录还包括数据的表序号,所述表序号与所述表名一一对应;根据所述表序号在所述数据模型中查找对应的字段库。
可选地,根据所述记录中的字段列表标识对所述字段列表进行排序,若所述字段列表标识一样,则按照所述记录的字段添加的先后顺序对该字段进行排序并保存在数据模型中。
可选地,所述数据模型包括源头数据模型和目标数据模型,所述选择模块包括:
第一选择子模块,设置为将源头数据模型中的记录确定为待同步记录;
第二选择子模块,设置为将源头数据模型中的记录与目标数据模型中的记录进行比较,得到增量比较记录,将所述增量比较记录确定为待同步记录,所述增量比较记录还包括操作标志信息,所述操作标志信息包括删除标志、先删后增标志、***标志和更新标志中的任意一种。
可选地,所述还原模块包括:
第三判断子模块,设置为判断所述待同步记录的字段格式;
还原子模块,设置为根据所述字段格式将所述待同步记录还原成所述同步数据并下发。
可选地,还包括处理模块,所述处理模块设置于所述选择模块之前,设置为删除或修改指定表名或指定表名中指定字段列表标识的记录。
根据本发明的又一个实施例,还提供了一种存储介质。该存储介质设
置为存储用于执行以下步骤的程序代码:
创建数据模型,所述数据模型存储至少一条记录,所述记录包括一个表明数据来源的表名、一个数据的字段和一个与数据对应的字段列表标识;将获取的数据生成所述记录,并保存在所述数据模型中;从所述数据模型中确定待同步记录;将所述待同步记录还原成同步数据并下发。
本发明的有益效果是:
本发明提供了网管数据同步方法及装置,在进行数据同步的过程中,创建数据模型,该数据模型中存储至少一条记录,所述记录中包括一个表明数据来源的表名、一个数据的字段和一个数据对应的字段列表标识;将获取的数据生成记录并存入数据模型中,就可将不同字段格式的数据统一适配为通用的数据模型进行表示,然后从数据模型中确定待同步记录,将该待同步记录还原成同步数据并下发。无需对不同字段格式的数据采用不同业务逻辑进行处理,只需通过简单的数据结构表示复杂的数据格式。因此,通过通用的数据模型对数据进行同步,业务逻辑与字段格式不具备依赖关系,只有将数据生成记录并存入数据模型中或者将数据模型中的记录还原成同步数据并下发时才会确定具体的字段格式,且该字段格式易于扩展为其他字段格式,从而提高了***的可扩展性、可维护性及稳定性,相应的降低了开发的难度和维护成本。
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:
图1为本发明实施例一提供的网管数据同步方法流程图;
图2为本发明实施例一提供的保存记录到数据模型流程图;
图3为本发明实施例一提供的保存记录时排序流程图;
图4为本发明实施例一提供的字段列表标识排序流程图;
图5为本发明实施例一提供的将待同步记录写入文件流程图;
图6为本发明实施例一提供的将字段写入文件流程图;
图7为本发明实施例一提供的删除或***记录流程图;
图8为本发明实施例二提供的网管数据同步装置示意图。
下面通过具体实施方式结合附图对本发明作进一步详细说明。
实施例一:
请参见图1,图1为本实施例提供的网管数据同步方法流程图。
在本实施例中,网管数据同步方法具体步骤如下:
S101,创建数据模型,该数据模型存储至少一条记录,该记录包括一个表明数据来源的表名、一个数据的字段和一个与数据对应的字段列表标识;
S102,将获取的同步数据生成所述记录,并保存在所述数据模型中;
S103,从所述数据模型中确定待同步记录;
S104,将所述待同步记录还原成同步数据并下发。
通过上述步骤,将不同字段格式的数据统一采用记录的形式存放在数据模型中,然后对模型中的记录进行同步操作,使得业务逻辑与数据的字段格式不会产生依赖关系,从而提高了***的可扩展性、稳定性和可维护性,也降低了维护成本和开发难度。
应该注意的是,创建的数据模型中包括至少一个字段库,该字段库中包括至少一个字段列表,该字段列表中包括至少一个字段,该字段是从存储介质(包括但不限于数据库和文件)中获取的;同时,字段库与表名一一对应,字段列表与字段列表标识一一对应,在对记录进行存储的时候,方便进行查找和排序。以数据库为例,从数据库中获取一行数据时,一行数据为一条记录,该记录包括表名、字段列表标识和字段,然后将记录存
放在数据模型中。应该注意的是,这里字段列表标识与字段并非必须是一一对应的关系,这里的字段列表标识类似于字段名,他们之间存在多种字段格式:对于单一格式,一个字段列表标识对应一个字段;对于列表格式,一个字段列表标识对应多个字段;对于结构体格式,一个字段列表标识对应一个结构体,该结构体本身也是一个列表形式的字段;以及后续其他需要扩展的字段格式。此外,数据模型定义了一个通用的接口,模型只与该接口进行交互,通过接口,数据模型就不需要处理不同类型的字段。也即将不同字段格式的数据通过记录统一存放在数据模型中,在进行数据同步时,只需与数据模型进行交互。进一步的,所述记录中还包括表序号,该表序号与表名一一对应,且由所述数据模型生成,用于快速有效的查找指定的字段库。
进一步的,数据模型的数据结构是Hashmap<表名,Treemap<key,value>>,其中,Treemap等同于字段库,key等同于字段列表标识,value等同于字段列表,key与value一一对应,且value中包含一个或多个字段。本实施例通过hashmap进行索引,不需考虑表与表之间的顺序,只需按照预先设定好的表序号从小到大排序即可;通过表序号索引到Treemap后,也即字段库,根据key与value一一对应的关系,很快找到对应的字段。
请参见图2,在将生成的记录保存到数据模型中时,具体索引过程如下:
S201,判断数据模型中是否存在该记录的表名,若是执行步骤S202,若否执行步骤S202’;
S202,获取该表名对应的字段库;
S202’,根据该表名新建一个字段库,在该字段库中根据字段列表标识新建字段列表,并将该记录的字段存入该字段列表,同时将表序号和表名作为索引放入索引树中;
S203,判断该表名对应的字段库中是否存在该记录的字段列表标识,若是执行步骤S204,若否执行步骤S204’;
S204,查找该字段列表标识对应的字段列表,并将该记录的字段存入字段列表中;
S204’,根据该字段列表标识新建字段列表,并将该字段列表标识对应的字段存入所述字段列表中。
此外,请参见图3,在添加记录的过程中,在找到记录添加的位置后,需要通过表序号查找到指定的字段库,在该字段库中通过字段列表标识对记录进行排序,具体规则如下:
S301,根据表序号在数据模型中查找对应的字段库;
S302,在该字段库中判断所述记录的字段列表标识是否相同,若是执行S303,若否执行S303’;
S303,按照该记录添加的先后顺序进行排序;
S303’,将所述字段列表标识小的记录排在前面。
对于不相同的字段列表标识的排序,请参见图4,其具体排序过程如下:
S401,判断字段列表标识的长度是否一致,若是执行步骤S402,若否执行步骤S402’;
S402,将该字段列表标识拆开分别对每段进行比较,数值小的则认为字段列表标识小,并将字段列表标识小的排在前面;
S402’,将字段列表标识长度小的排在前面。
对于查找和排序两个过程,可以只执行通过表序号查找字段库的过程;也可以只执行通过字段列表标识对记录中的字段进行排序的过程;也可以先执行查找字段库的过程,再执行对字段排序的过程,该过程能更精准的对待添加记录进行排序。
将生成的记录添加到数据模型中后,需要从数据模型中确定待同步记录,从数据模型中确定待同步记录的具体方式如下:
从数据模型中获取指定的记录,从指定的记录中确定待同步记录。获
取指定记录的方式包括以下任意一种:
获取数据模型中的所有记录:首先根据表序号索引到对应的表名以保证记录按表序号排序,接着遍历所有表名依次找出对应字段列表标识中的上所有记录;
获取数据模型中指定表名中的记录:首先获取对应表名下的字段库,接着遍历该字段库获取所有字段列表标识中的记录;
获取数据模型中指定表名中的指定字段列表标识的记录:首先获取对应表名的字段库,接着在字段库中获取对应字段列表标识中的所有记录。
从指定记录中确定待同步记录包括以下方式中的任意一种:
将获取的指定记录直接确定为待同步记录;
将网管数据模型中的指定记录与网元数据模型中的指定记录进行比较,得到增量比较记录,将该增量比较记录确定为待同步记录。
此外,所述增量比较记录中包括以下几种操作标志信息中的任意一种:删除标志、***标志、先删后增标志、***标志,也即增量比较记录的类型有删除记录、***记录、先删后增记录或***记录,所有的增量比较记录形成增量模型;通过该操作标志信息可以准确告知网元对同步数据执行什么操作。对于删除标志,是针对网管数据模型中不存在但网元数据模型中存在的记录,该记录中的操作标志信息为删除标志,说明网元数据模型中存在的记录需要被删除;对于***标志,是针对网管数据模型中存在而网元数据模型中不存在的记录,该记录的操作标志信息为***标志,说明网管新增了一条记录并通知网元模型中也添加该条记录;对于先删后增记录,是针对网管和网元的数据模型中均存在的记录,且若该记录中的关键字段有修改或者网管数据模型中的记录的父记录先删后增,也即由于记录引用了父记录中的关键字段,但是父记录对该关键字段进行修改,导致该记录也相应有修改,相应的网元中的关键字段也进行修改,则网管数据模型中存在的记录的操作标志信息为先删后增,网元数据模型中存在的记录的操作标志信息为删除,说明网元和网管模型中都存在的记录需要先
被删掉,然后再将修改的记录添加到网管模型中并通知网元模型中也要添加该记录;对于更新标志,是针对网管与网元数据模型中均存在的记录,且不存在先删后增的情况,同时两个记录不相等,该记录的操作标志信息为更新标志,说明网管模型对该记录做了修改,通知网元也要对该记录进行修改。
进一步的,请参见图5,将待同步记录下发到网元时,通常会将待同步记录写入文件然后下发,具体写入流程如下:
S501,判断确定的待同步记录是否为增量模型,若是执行步骤S502,若否执行S502’;
S502,获取该增量模型中存在的删除记录、先删后增记录、***记录和更新记录中的至少一种;
S502’,获取网管模型中指定记录作为待同步记录,然后执行步骤S503;
S503,依次遍历上述记录并写入文件中。
进一步的,请参见图6,在S503中,将上述记录写入文件时,需要判断字段格式才能正确的获取到字段并写入文件,具体步骤如下:
S601,判断所述待同步记录的字段格式是否为单一格式,若否执行步骤S602,若是执行步骤S602’;
S602,判断所述待同步记录的字段格式是否为列表格式,若否执行步骤S603,若是执行步骤S603’;
S602’,获取字段列表标识对应的唯一的字段,并按单一格式写入文件;
S603,判断所述待同步记录的字段格式是否为结构体格式,若是执行步骤S604;
S603’,获取字段列表标识对应的多个字段,并按列表格式写入文件;
S604获取字段列表标识对应的结构体,再获取结构体中所有的字段,
并按结构体格式写入文件。
具体格式举例如下:
1.单一格式:
<Field name="SdrDeviceGroupId"value="1"/>;
该程序语言表明,一个字段名SdrDeviceGroupId(类似于字段列表标识)对应一个字段列表value,该字段列表中只包括一个字段1;
2.列表格式:
<Field name="radioMode">
<value>8</value>
<value>16</value>
</Field>
该程序语言表明,一个字段名radioMode(类似于字段列表标识)对应一个字段列表value,该字段列表中包括两个字段8和16;
3.结构体格式:
<Field name="productData">
<StructMember name="productNumber"value="14337"/>
<StructMember name="productName"value="FAB"/>
</Field>
该程序语言表明,一个字段名productData(类似于字段列表标识)对应两个结构体productNumber和productName,每个结构体中对应一个字段列表value,对于结构体productNumber中,该字段列表中包括一个字段14337;对于结构体productName中,该字段列表中包括一个字段FAB。
对于其他类型的字段格式,字段的获取方式类似,同样属于本实施例保护的范围,这里不再赘述。确定待同步记录的字段格式并获取对应的字段后,将待同步记录写入文件或其他载体中再然后下发。
此外,请参见图7,在确定待同步记录之前,也可以对数据模型中的记录进行删除或修改,对于增加的操作在添加记录到模型中已涵盖,故这里不再说明。本实施例对删除的操作进行说明,具体流程如下:
S701,判断数据模型中是否存在指定表名的记录,若是执行步骤S702;
S702,判断数据模型中是否存在指定表名中的指定字段列表标识的记录,若是执行步骤S703;
S703,删除指定表名中的指定字段列表标识的记录。
实施例二:
请参见图8,图8为本实施例提供的网管数据同步装置示意图。
在本实施例中,网管数据同步装置包括:
存储模块801,设置为创建数据模型,所述数据模型存储至少一条记录,所述记录包括一个表明数据来源的表名、一个数据的字段和一个与数据对应的字段列表标识;
判断模块802,设置为将获取的数据生成所述记录,并保存在所述数据模型中;
选择模块803,设置为从所述数据模型中确定待同步记录;
还原模块804,设置为将所述待同步记录还原成同步数据并下发。
应该注意的是,创建的数据模型中包括至少一个字段库,该字段库中包括至少一个字段列表,该字段列表中包括至少一个字段,该字段是从存储介质(包括但不限于数据库和XML文件)中获取的;同时,字段库与表名一一对应,字段列表与字段列表标识一一对应,在对记录进行存储的时候,方便进行查找和排序。例如,在数据库中获取到一行数据时,一行数据为一条记录,该记录包括表名、字段列表标识和字段,然后将记录存放在数据模型中。应该注意的是,这里字段列表标识与字段并非必须是一一对应的关系,这里的字段列表标识类似于字段名,他们之间存在多种字段格式:对于单一格式,一个字段列表标识对应一个字段;对于列表格式,
一个字段列表标识对应多个字段;对于结构体格式,一个字段列表标识对应一个结构体,该结构体本身也是一个列表形式的字段;以及后续其他需要扩展的字段格式。此外,数据模型定义了一个通用的接口,模型只与该接口进行交互,通过接口,数据模型就不需要处理不同类型的字段。也即将不同字段格式的数据通过记录统一存放在数据模型中,在进行数据同步时,只需与数据模型进行交互。进一步的,所述记录中还包括表序号,该表序号与表名一一对应,且由所述数据模型生成,用于快速有效的查找指定的字段库。
进一步的,进一步的,数据模型的数据结构是Hashmap<表名,Treemap<key,value>>,其中,Treemap等同于字段库,key等同于字段列表标识,value等同于字段列表,key与value一一对应,且value中包含一个或多个字段。本实施例通过hashmap进行索引,不需考虑表与表之间的顺序,只需按照预先设定好的表序号从小到大排序即可;通过表序号索引到Treemap后,也即字段库,根据key与value一一对应的关系,很快找到对应的字段。
具体的,判断模块802中包括:判断子模块8021;
其中,判断子模块8021,设置为判断所述数据模型中是否存在所述记录的表名,若存在所述记录的表名,则判断该表名对应的字段库中是否存在所述记录的字段列表标识;若存在所述记录的字段列表标识,则查找所述字段列表标识对应的字段列表,并将所述记录的字段存入所述字段列表;若不存在所述记录的字段列表标识,则根据该字段列表标识新建字段列表并将所述记录的字段存入所述字段列表中;若不存在所述记录的表名,则根据所述表名新建另一字段库,在该字段库中根据所述字段列表标识新建字段列表,并将所述记录的字段存入该字段列表中。
进一步的,所述记录还包括数据的表序号,所述表序号与所述表名一一对应;根据所述表序号在所述数据模型中查找对应的字段库。
根据所述记录中的字段列表标识对所述字段列表进行排序,若所述字
段列表标识相同,则按照所述记录的字段添加的先后顺序对该字段进行排序并保存在数据模型中。对于查找和排序两个过程,可以只执行通过表序号查找字段库的过程;也可以只执行通过字段列表标识对记录中的字进行排序的过程;也可以先执行查找字段库的过程,再执行对字段排序的过程,该过程能更精准的对待添加记录进行排序。
值得注意的是,对于不相同的字段列表标识,其排序规则如下:
首先判断两者字段列表标识长度是否一致,若不一致,则将长度短的字段列表标识排在前面;若一致,则将字段列表标识按逗号分开,分别比较每部分的大小,小的部分认为该字段列表标识短并排在前面。
进一步的,数据模型中包括源头数据模型和目标数据模型;选择模块803中包括第一选择子模块8031和第二选择子模块8032;
第一选择子模块8031设置为将源头数据模型中的记录确定为待同步记录;
第二选择子模块8032设置为将源头数据模型中的记录与目标数据模型中的记录进行比较,得到增量比较记录,将所述增量比较记录确定为待同步记录,所述增量比较记录还包括操作标志信息,所述操作标志信息包括删除标志、先删后增标志、***标志和更新标志中的任意一种。
此外,在确定待同步记录时,首先要获取指定记录,获取到指定数据后才确定待同步记录。该指定记录包括以下方式中的任意一种:
获取数据模型中的所有记录:首先根据表序号索引到对应的表名以保证记录按表序号排序,接着遍历所有表名依次找出对应字段列表标识中的上所有记录;
获取数据模型中指定表名中的记录:首先获取对应表名下的字段库,接着遍历该字段库获取所有字段列表标识中的记录;
获取数据模型中指定表名中的指定字段列表标识的记录:首先获取对应表名的字段库,接着在字段库中获取对应字段列表标识中的所有记录。
此外,所述增量比较记录中包括以下几种操作标志信息中的任意一种:删除标志、***标志、先删后增标志、***标志,也即增量比较记录的类型有删除记录、***记录、先删后增记录或***记录,所有的增量比较记录形成增量模型。对于删除标志,是针对网管数据模型中不存在但网元数据模型中存在的记录,该记录中的操作标志信息为删除标志,说明网元数据模型中存在的记录需要被删除;对于***标志,是针对网管数据模型中存在而网元数据模型中不存在的记录,该记录的操作标志信息为***标志,说明网管新增了一条记录并通知网元模型中也添加该条记录;对于先删后增记录,是针对网管和网元的数据模型中均存在的记录,且若该记录中的关键字段有修改或者网管数据模型中的记录的父记录先删后增,也即由于记录引用了父记录中的关键字段,但是父记录对该该关键字段进行修改,导致该记录也相应有修改,相应的网元中的关键字段也进行修改,则网管数据模型中存在的记录的操作标志信息为先删后增,网元数据模型中存在的记录的操作标志信息为删除,说明网元和网管模型中都存在的记录需要先被删掉,然后再将修改的记录添加到网管模型中并通知网元模型中也要添加该记录;对于更新标志,是针对网管与网元数据模型中均存在的记录,且不存在先删后增的情况,同时两个记录不相等,该记录的操作标志信息为更新标志,说明网管模型对该记录做了修改,通知网元也要对该记录进行修改。
进一步的,还原模块804包括第三判断子模块8041和还原子模块8042;第三判断子模块8041设置为判断所述待同步记录的字段格式;还原子模块8042设置为根据所述字段格式将所述待同步记录还原成所述同步数据并下发。
将待同步记录下发到网元时,通常会将待同步记录写入文件然后下发,对该待同步记录进行判断,若为增量模型,则获取该增量模型中存在的删除记录、先删后增记录、***记录和更新记录中的至少一种并写入文件;若为网管模型中指定记录,则直接遍历该记录并写入文件。但是在写入前首先判断待同步记录的字段格式,若字段格式为单一格式,则按照单
一格式将待同步记录写入文件;若字段格式为列表格式,则按照列表格式将待同步记录写入文件;若字段格式为结构格式,则按照结构体格式将待同步记录写入文件。具体字段格式请参见实施例一,这里不再赘述。
对于其他类型的字段格式,字段的获取方式类似,同样属于本实施例保护的范围,这里不再赘述。确定待同步记录的字段格式并获取对应的字段后,将待同步记录写入文件或其他载体并下发至网元。
此外,在选择模块803之前还包括处理模块802’,设置为删除或修改指定表名或指定表名中指定字段列表标识的记录。对于删除的操作流程,请参见实施例一,这里不再赘述。
本发明的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以被设置为存储用于执行以下步骤的程序代码:
S1,创建数据模型,所述数据模型存储至少一条记录,所述记录包括一个表明数据来源的表名、一个数据的字段和一个与数据对应的字段列表标识;
S2,将获取的数据生成所述记录,并保存在所述数据模型中;
S3,从所述数据模型中确定待同步记录;
S4,将所述待同步记录还原成同步数据并下发。
可选地,本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。
显然,本领域的技术人员应该明白,上述的本发明的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模
块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。
本发明提供了网管数据同步方法及装置,在进行数据同步的过程中,创建数据模型,该数据模型中存储至少一条记录,所述记录中包括一个表明数据来源的表名、一个数据的字段和一个数据对应的字段列表标识;将获取的数据生成记录并存入数据模型中,就可将不同字段格式的数据统一适配为通用的数据模型进行表示,然后从数据模型中确定待同步记录,将该待同步记录还原成同步数据并下发。无需对不同字段格式的数据采用不同业务逻辑进行处理,只需通过简单的数据结构表示复杂的数据格式。因此,通过通用的数据模型对数据进行同步,业务逻辑与字段格式不具备依赖关系,只有将数据生成记录并存入数据模型中或者将数据模型中的记录还原成同步数据并下发时才会确定具体的字段格式,且该字段格式易于扩展为其他字段格式,从而提高了***的可扩展性、可维护性及稳定性,相应的降低了开发的难度和维护成本。
Claims (16)
- 一种网管数据同步方法,包括:创建数据模型,所述数据模型存储至少一条记录,所述记录包括一个表明数据来源的表名、一个数据的字段和一个与数据对应的字段列表标识;将获取的数据生成所述记录,并保存在所述数据模型中;从所述数据模型中确定待同步记录;将所述待同步记录还原成同步数据并下发。
- 如权利要求1所述的网管数据同步方法,其中,所述数据模型包括至少一个字段库,所述字段库包括至少一个字段列表,所述字段列表包括至少一个所述数据的字段;所述字段库与所述表名一一对应,所述字段列表与所述字段列表标识一一对应。
- 如权利要求2所述的网络数据同步方法,其中,所述保存在所述数据模型中包括:判断所述数据模型中是否存在所述记录的表名,若存在所述记录的表名,则判断该表名对应的字段库中是否存在所述记录的字段列表标识;若存在所述记录的字段列表标识,则查找所述字段列表标识对应的字段列表,并将所述记录的字段存入所述字段列表;若不存在所述记录的字段列表标识,则根据该字段列表标识新建字段列表并将所述记录的字段存入所述字段列表;若不存在所述记录的表名,则根据所述表名新建另一字段库,在该字段库中根据所述字段列表标识新建字段列表,并将所述记录的字段存入该字段列表。
- 如权利要求3所述的网管数据同步方法,其中,所述记录还包括数据的表序号,所述表序号与所述表名一一对应;根据所述表序号在所述数据模型中查找对应的字段库。
- 如权利要求3所述的网管数据同步方法,其中,根据所述记录中的字段列表标识对所述字段列表进行排序,若所述字段列表标识一样,则按照所述记录的字段添加的先后顺序对该字段进行排序并保存在数据模型中。
- 如权利要求1-5任一项所述的网管数据同步方法,其中,所述数据模型包括源头数据模型和目标数据模型,从所述数据模型中确定待同步记录包括以下方式中的任意一种:将源头数据模型中的记录确定为待同步记录;将源头数据模型中的记录与目标数据模型中的记录进行比较,得到增量比较记录,将所述增量比较记录确定为待同步记录,所述增量比较记录包括操作标志信息,所述操作标志信息包括删除标志、先删后增标志、***标志和更新标志中的任意一种。
- 如权利要求1-5任一项所述的网管数据同步方法,其中,将所述待同步记录还原成同步数据并下发包括:判断所述待同步记录的字段格式;根据所述字段格式将所述待同步记录还原成所述同步数据并下发。
- 如权利要求1-5任一项所述的网管数据同步方法,其中,所述从所述数据模型中确定待同步记录之前还包括:删除或修改指定表名或指定表名中指定字段列表标识的记录。
- 一种网管数据同步装置,包括:存储模块,设置为创建数据模型,所述数据模型存储至少一条记录,所述记录包括一个表明数据来源的表名、一个数据的字段和一个与数据对应的字段列表标识;判断模块,设置为将获取的数据生成所述记录,并保存在所述数 据模型中;选择模块,设置为从所述数据模型中确定待同步记录;还原模块,设置为将所述待同步记录还原成同步数据并下发。
- 如权利要求9所述的网管数据同步装置,其中,所述数据模型包括至少一个字段库,所述字段库包括至少一个字段列表,所述字段列表包括至少一个所述数据的字段;所述字段库与所述表名一一对应,所述字段列表与所述字段列表标识一一对应。
- 如权利要求10所述的网管数据同步装置,其中,所述判断模块包括:判断子模块,设置为判断所述数据模型中是否存在所述记录的表名,若存在所述记录的表名,则判断该表名对应的字段库中是否存在所述记录的字段列表标识;若存在所述记录的字段列表标识,则查找所述字段列表标识对应的字段列表,并将所述记录的字段存入所述字段列表;若不存在所述记录的字段列表标识,则根据该字段列表标识新建字段列表并将所述记录的字段存入所述字段列表中;若不存在所述记录的表名,则根据所述表名新建另一字段库,在该字段库中根据所述字段列表标识新建字段列表,并将所述记录的字段存入该字段列表中。
- 如权利要求11所述的网管数据同步装置,其中,所述记录还包括数据的表序号,所述表序号与所述表名一一对应;根据所述表序号在所述数据模型中查找对应的字段库。
- 如权利要求11所述的网管数据同步装置,其中,根据所述记录中的字段列表标识对所述字段列表进行排序,若所述字段列表标识一样,则按照所述记录的字段添加的先后顺序对该字段进行排序并保存在数据模型中。
- 如权利要求9-13任一项所述的网管数据同步装置,其中,所述数据模型包括源头数据模型和目标数据模型,所述选择模块包括:第一选择子模块,设置为将源头数据模型中的记录确定为待同步记录;第二选择子模块,设置为将源头数据模型中的记录与目标数据模型中的记录进行比较,得到增量比较记录,将所述增量比较记录确定为待同步记录,所述增量比较记录还包括操作标志信息,所述操作标志信息包括删除标志、先删后增标志、***标志和更新标志中的任意一种。
- 如权利要求9-13任一项所述的网管数据同步装置,其中,所述还原模块包括:第三判断子模块,设置为判断所述待同步记录的字段格式;还原子模块,设置为根据所述字段格式将所述待同步记录还原成所述同步数据并下发。
- 如权利要求9-13任一项所述的网管数据同步装置,其中,还包括处理模块,所述处理模块设置于所述选择模块之前,设置为删除或修改指定表名或指定表名中指定字段列表标识的记录。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510790802.1A CN106708891A (zh) | 2015-11-17 | 2015-11-17 | 一种网管数据同步方法及装置 |
CN201510790802.1 | 2015-11-17 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2017084410A1 true WO2017084410A1 (zh) | 2017-05-26 |
Family
ID=58718041
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2016/097821 WO2017084410A1 (zh) | 2015-11-17 | 2016-09-01 | 一种网管数据同步方法及装置 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN106708891A (zh) |
WO (1) | WO2017084410A1 (zh) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110263050A (zh) * | 2019-05-06 | 2019-09-20 | 阿里巴巴集团控股有限公司 | 数据处理方法、装置、设备及存储介质 |
CN110688302A (zh) * | 2019-08-27 | 2020-01-14 | 天津开心生活科技有限公司 | 一种字段库自动化测试方法及装置 |
CN111143450A (zh) * | 2019-12-13 | 2020-05-12 | 远光软件股份有限公司 | 导入数据的方法和装置 |
CN111241845A (zh) * | 2019-12-31 | 2020-06-05 | 上海犀语科技有限公司 | 一种基于语义匹配方法的财务科目自动识别方法及装置 |
CN111400407A (zh) * | 2020-04-10 | 2020-07-10 | 浙江大华技术股份有限公司 | 数据的同步方法及装置、存储介质及电子装置 |
CN111400408A (zh) * | 2020-04-13 | 2020-07-10 | 上海东普信息科技有限公司 | 数据同步方法、装置、设备及存储介质 |
CN111611248A (zh) * | 2020-05-25 | 2020-09-01 | 山东浪潮商用***有限公司 | 一种自动分析指标口径的方法、***和装置 |
CN113507497A (zh) * | 2021-06-01 | 2021-10-15 | 常州皓鸣信息科技有限公司 | 一种多类型数据多节点异步下发与延迟集成的方法 |
CN113986909A (zh) * | 2021-12-24 | 2022-01-28 | 畅捷通信息技术股份有限公司 | 一种反向记录同步状态的实时数据同步方法、***及介质 |
CN117421308A (zh) * | 2023-12-18 | 2024-01-19 | 国能(北京)商务网络有限公司 | 一种数据中台的数据重构方法 |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107656970A (zh) * | 2017-08-31 | 2018-02-02 | 郑州云海信息技术有限公司 | 一种数据同步方法、装置及服务器 |
CN108959381B (zh) * | 2018-05-29 | 2021-05-28 | 创新先进技术有限公司 | 数据的管理方法及装置和电子设备 |
CN110069561A (zh) * | 2019-04-29 | 2019-07-30 | 金瓜子科技发展(北京)有限公司 | 账务获取方法、***、电子设备及计算机可读介质 |
CN111190898B (zh) * | 2019-11-25 | 2023-07-14 | 泰康保险集团股份有限公司 | 一种数据处理的方法及装置、电子设备、存储介质 |
CN114398379B (zh) * | 2021-11-29 | 2024-03-01 | 平安科技(深圳)有限公司 | 一种数据更新方法、装置、设备及介质 |
CN115544006B (zh) * | 2022-09-23 | 2023-07-04 | 北京上里科技文化有限公司 | 一种通用数据库数据操作模型构建方法 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103761318A (zh) * | 2014-01-27 | 2014-04-30 | 中国工商银行股份有限公司 | 一种关系型异构数据库数据同步的方法及*** |
CN103823797A (zh) * | 2012-11-16 | 2014-05-28 | 镇江诺尼基智能技术有限公司 | 基于ftp协议的行业数据库数据实时同步*** |
CN103873517A (zh) * | 2012-12-14 | 2014-06-18 | 中兴通讯股份有限公司 | 一种数据同步的方法、装置和*** |
CN104778175A (zh) * | 2014-01-13 | 2015-07-15 | 世纪禾光科技发展(北京)有限公司 | 一种实现异构数据库数据同步的方法及*** |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100458793C (zh) * | 2007-05-10 | 2009-02-04 | 浪潮集团山东通用软件有限公司 | 数据访问层Xml格式数据与关系数据间的映射转换方法 |
CN101697169A (zh) * | 2009-10-23 | 2010-04-21 | 中兴通讯股份有限公司 | 源数据库和目的数据库之间数据同步的方法、装置及*** |
CN102202073B (zh) * | 2010-03-24 | 2014-05-07 | 杭州华三通信技术有限公司 | 一种分布式***及其数据同步方法 |
-
2015
- 2015-11-17 CN CN201510790802.1A patent/CN106708891A/zh active Pending
-
2016
- 2016-09-01 WO PCT/CN2016/097821 patent/WO2017084410A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103823797A (zh) * | 2012-11-16 | 2014-05-28 | 镇江诺尼基智能技术有限公司 | 基于ftp协议的行业数据库数据实时同步*** |
CN103873517A (zh) * | 2012-12-14 | 2014-06-18 | 中兴通讯股份有限公司 | 一种数据同步的方法、装置和*** |
CN104778175A (zh) * | 2014-01-13 | 2015-07-15 | 世纪禾光科技发展(北京)有限公司 | 一种实现异构数据库数据同步的方法及*** |
CN103761318A (zh) * | 2014-01-27 | 2014-04-30 | 中国工商银行股份有限公司 | 一种关系型异构数据库数据同步的方法及*** |
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110263050A (zh) * | 2019-05-06 | 2019-09-20 | 阿里巴巴集团控股有限公司 | 数据处理方法、装置、设备及存储介质 |
CN110263050B (zh) * | 2019-05-06 | 2023-10-27 | 创新先进技术有限公司 | 数据处理方法、装置、设备及存储介质 |
CN110688302A (zh) * | 2019-08-27 | 2020-01-14 | 天津开心生活科技有限公司 | 一种字段库自动化测试方法及装置 |
CN111143450A (zh) * | 2019-12-13 | 2020-05-12 | 远光软件股份有限公司 | 导入数据的方法和装置 |
CN111241845A (zh) * | 2019-12-31 | 2020-06-05 | 上海犀语科技有限公司 | 一种基于语义匹配方法的财务科目自动识别方法及装置 |
CN111241845B (zh) * | 2019-12-31 | 2024-01-16 | 上海犀语科技有限公司 | 一种基于语义匹配方法的财务科目自动识别方法及装置 |
CN111400407B (zh) * | 2020-04-10 | 2023-09-26 | 浙江大华技术股份有限公司 | 数据的同步方法及装置、存储介质及电子装置 |
CN111400407A (zh) * | 2020-04-10 | 2020-07-10 | 浙江大华技术股份有限公司 | 数据的同步方法及装置、存储介质及电子装置 |
CN111400408B (zh) * | 2020-04-13 | 2023-06-09 | 上海东普信息科技有限公司 | 数据同步方法、装置、设备及存储介质 |
CN111400408A (zh) * | 2020-04-13 | 2020-07-10 | 上海东普信息科技有限公司 | 数据同步方法、装置、设备及存储介质 |
CN111611248B (zh) * | 2020-05-25 | 2023-07-25 | 浪潮软件科技有限公司 | 一种自动分析指标口径的方法、***和装置 |
CN111611248A (zh) * | 2020-05-25 | 2020-09-01 | 山东浪潮商用***有限公司 | 一种自动分析指标口径的方法、***和装置 |
CN113507497A (zh) * | 2021-06-01 | 2021-10-15 | 常州皓鸣信息科技有限公司 | 一种多类型数据多节点异步下发与延迟集成的方法 |
CN113986909A (zh) * | 2021-12-24 | 2022-01-28 | 畅捷通信息技术股份有限公司 | 一种反向记录同步状态的实时数据同步方法、***及介质 |
CN113986909B (zh) * | 2021-12-24 | 2022-04-22 | 畅捷通信息技术股份有限公司 | 一种反向记录同步状态的实时数据同步方法、***及介质 |
CN117421308A (zh) * | 2023-12-18 | 2024-01-19 | 国能(北京)商务网络有限公司 | 一种数据中台的数据重构方法 |
CN117421308B (zh) * | 2023-12-18 | 2024-04-02 | 国能(北京)商务网络有限公司 | 一种数据中台的数据重构方法 |
Also Published As
Publication number | Publication date |
---|---|
CN106708891A (zh) | 2017-05-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2017084410A1 (zh) | 一种网管数据同步方法及装置 | |
US9645787B1 (en) | Tag-based electronic media playlist processing | |
US9183268B2 (en) | Partition level backup and restore of a massively parallel processing database | |
US9454548B1 (en) | Pluggable storage system for distributed file systems | |
US10614127B2 (en) | Two-phase construction of data graphs from disparate inputs | |
US20140297592A1 (en) | Computer-readable medium storing program and version control method | |
US8938430B2 (en) | Intelligent data archiving | |
CN106547811B (zh) | 数据集的分布式合并 | |
US8805777B2 (en) | Data record collapse and split functionality | |
CN106991100B (zh) | 数据导入方法及装置 | |
CN104850565B (zh) | 一种基于k-v存储***的元数据管理方法 | |
CN106874281B (zh) | 实现数据库读写分离的方法和装置 | |
US20150006485A1 (en) | High Scalability Data Management Techniques for Representing, Editing, and Accessing Data | |
CN105740303A (zh) | 改进的对象存储的方法及装置 | |
CN107330024B (zh) | 标签***数据的存储方法和装置 | |
US20210303404A1 (en) | Systems and methods for database migration | |
TW200821863A (en) | Work item event procession | |
CN111680017A (zh) | 一种数据同步的方法及装置 | |
JP6293709B2 (ja) | ストレージシステムおよびストレージシステム用プログラム | |
CN107609011B (zh) | 一种数据库记录的维护方法和装置 | |
US11709862B2 (en) | Selective synchronization of database objects | |
CN111680030A (zh) | 数据融合方法及装置,基于元信息的数据处理方法和装置 | |
JP7106000B2 (ja) | 追跡識別子を用いたオブジェクト管理方法、装置、コンピュータプログラムおよびその記録媒体 | |
CN107168822B (zh) | Oracle streams的异常修复***及方法 | |
CN113641686B (zh) | 数据处理方法、装置、电子设备、存储介质及程序产品 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16865588 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 16865588 Country of ref document: EP Kind code of ref document: A1 |