Data storage method and device of freight rate search system, electronic equipment and storage medium

By using variable-length storage method to process freight data in the freight search system, the memory shortage caused by the increase in freight data is solved, and the system's search efficiency and response performance are improved.

CN119088309APending Publication Date: 2024-12-06TRAVELSKY TECHNOLOGY LIMITED
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411208842.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

Due to the continuous increase in freight data, the freight search system cannot load all data into memory, resulting in the extended response time of the search service and reducing the search efficiency.

Method used

By receiving the freight message data released by the front-end freight rate publishing system, the operation field and freight rate data are obtained, and the local storage space is updated according to the operation field. The freight rate data is stored using variable-length storage method, and the memory space is dynamically allocated. , save storage space, allowing the system to load all existing freight data into memory.

Benefits of technology

It improves the search efficiency of the freight search system, can effectively manage and load a large amount of freight data, and improves the system's response performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088309A_ABST
    Figure CN119088309A_ABST
Patent Text Reader

Abstract

The invention discloses a data storage method and device for a freight rate search system, electronic equipment and a storage medium, and the method and device are applied to the electronic equipment, and specifically comprise the steps: receiving freight rate message data issued by a front-end freight rate issuing system; the freight rate message data are analyzed to obtain operation fields and freight rate data, and the freight rate data comprise text data and structural body data; and updating the local storage space of the freight rate searching system according to the operation field and the freight rate data. According to the scheme, original fixed-length storage of each row of data is changed into variable-length storage, so that the storage space is saved, a system can load all existing freight rate data into a memory, and the search efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of search engines, and more specifically, to a data storage method, device, electronic device and storage medium of a freight rate search system. Background Art

[0002] In order to realize real-time search of flight tickets, the fare search system is designed as a highly cohesive fare calculation system. It implements a memory data storage based on MMAP. During the search process, all fare data are stored in the local memory of the server, so as to realize fast data acquisition and calculation. Therefore, the actual memory size on the server should be larger than the sum of all fare data.

[0003] Airlines publish freight rate message data through the front-end freight rate publishing system, and push the freight rate message data to the domestic freight rate search system at regular intervals. The data preprocessing node in the domestic freight rate search system receives and parses the freight rate message data, and then writes, modifies, deletes and other preprocessing operations on the parsed freight rate data, and finally pushes the freight rate data to each search node in the system. With the increasing number of fare data released by airlines, the fare search system is unable to load all the existing fare data into the memory, which seriously affects the response time of the search service and reduces the search efficiency. Summary of the invention

[0004] In view of this, the present application provides a data storage method, device, electronic device and storage medium of a freight rate search system, which are used to improve the search efficiency of the freight rate search system.

[0005] In order to achieve the above objectives, the proposed solution is as follows:

[0006] A data storage method for a freight rate search system is applied to an electronic device, and the data storage method comprises the following steps:

[0007] Receive freight rate message data published by the front-end freight rate publishing system;

[0008] Parsing the freight rate message data to obtain operation fields and freight rate data, wherein the freight rate data includes text data and structure data;

[0009] The local storage space of the freight rate search system is updated according to the operation field and the freight rate data.

[0010] Optionally, the updating process of the local storage space of the freight rate search system according to the operation field and the freight rate data comprises the steps of:

[0011] When the operation field is write, the freight rate data is written into the local storage space;

[0012] When the operation field is Delete, the pointed freight rate data is queried and deleted.

[0013] Optionally, when the operation field is write, writing the freight rate data into the local storage space comprises the steps of:

[0014] Calculating the sum of the total space occupied by the text data and the space occupied by the structure data to obtain the actual occupied space;

[0015] Dynamically allocating memory space according to the actual occupied space, the memory space being used to store the text data and the structure data;

[0016] The text data and the structure are written into the memory space.

[0017] Optionally, the structure data includes an address and a length, the address points to the first address of the text data, and the length is the actual length of the text data.

[0018] Optionally, writing the text data and the structure into the memory space comprises the steps of:

[0019] Storing the freight rate data in a regular freight rate detailed table of a database in the local storage space;

[0020] A data index is constructed for each piece of the freight rate data in the regular freight rate detailed table.

[0021] Optionally, the following steps are also included:

[0022] When a query instruction is received, a query is performed based on the query field specified by the query instruction and the query result is fed back.

[0023] A data storage device of a freight rate search system, applied to an electronic device, the data storage device comprising:

[0024] The message receiving module is configured to receive the freight rate message data issued by the front-end freight rate issuing system;

[0025] A message parsing module is configured to parse the freight rate message data to obtain operation fields and freight rate data, wherein the freight rate data includes text data and structure data;

[0026] The data updating module is configured to update the local storage space of the freight rate search system according to the operation field and the freight rate data.

[0027] Optionally, the data updating module includes:

[0028] A write processing unit, configured to write the freight rate data into the local storage space when the operation field is write;

[0029] The deletion processing unit is configured to query and delete the pointed freight rate data when the operation field is deletion.

[0030] Optionally, also include:

[0031] The data query module is configured to, when receiving a query instruction, perform a query based on the query field specified by the query instruction and feed back a query result.

[0032] An electronic device, comprising at least one processor and a memory connected to the processor, wherein:

[0033] The memory is used to store computer programs or instructions;

[0034] The processor is used to execute the computer program or instruction so that the electronic device can implement the data storage method of the freight rate system as described above.

[0035] A storage medium is applied to an electronic device, wherein the storage medium carries one or more computer programs, and the one or more computer programs can be executed by the electronic device, so that the electronic device implements the data storage method of the freight rate system as described above.

[0036] It can be seen from the above technical scheme that the present application discloses a data storage method, device, electronic device and storage medium for a freight rate search system. The method and device are applied to electronic devices, specifically receiving freight rate message data issued by a front-end freight rate publishing system; parsing the freight rate message data to obtain operation fields and freight rate data, the freight rate data including text data and structure data; updating the local storage space of the freight rate search system according to the operation fields and freight rate data. Through this scheme, the original fixed-length storage of each row of data is changed to variable-length storage, which saves storage space, so that the system can load all existing freight rate data into the memory, thereby improving the search efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0038] Figure 1This is a flow chart of a data storage method of a freight rate search system according to an embodiment of the present application;

[0039] Figure 2 A schematic diagram of data storage in an embodiment of the present application;

[0040] Figure 3 This is a flowchart of another data storage method of a freight rate search system according to an embodiment of the present application;

[0041] Figure 4 A block diagram of a data storage device of a freight rate search system according to an embodiment of the present application;

[0042] Figure 5 A block diagram of another data storage device of a freight rate search system according to an embodiment of the present application;

[0043] Figure 6 A block diagram of a data storage device of another freight rate search system according to an embodiment of the present application;

[0044] Figure 7 A block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0045] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0046] Figure 1 This is a flowchart of a data storage method for a freight rate search system according to an embodiment of the present application.

[0047] like Figure 1 As shown, the data storage method provided in this embodiment is applied to an electronic device to provide data storage services for a freight rate search system. The electronic device can be understood as a computer, server or cloud platform with data computing and information processing capabilities. The data storage method includes the following steps:

[0048] S1. Receive freight rate message data issued by the front-end freight rate publishing system.

[0049] These data are stored in message format and transmitted in the form of compressed files. Decompress and parse each line of data in the original message, and identify whether it is information in the regular freight rate detailed table based on the data identifier at the beginning of the line.

[0050] Taking the compressed package DFF.NFSTA.C.D20230818.T0830.zip at 8:30 on August 18, 2023 as an example, the data identifier at the beginning of the row of the regular freight rate details table is '150', and one of the messages is shown in the following table:

[0051]

[0052] The 'I' indicates writing data.

[0053] S2. Analyze and process the freight rate message data.

[0054] By parsing the freight rate message data, the operation field and freight rate data are obtained. The operation field is write or delete. Write means that the freight rate data needs to be written into the local storage space of the freight rate search system, and delete means that the outdated freight rate data needs to be deleted. The freight rate data here includes text data and structure data.

[0055] S3. Update the local storage space according to the operation fields and freight rate data.

[0056] That is, after obtaining the operation field and the freight rate data, the local storage space of the freight rate search system, that is, the database storing the freight rate data, is updated based on the operation mode of the operation field and the freight rate data.

[0057] Considering that the operation field is write or delete, when the operation field is write, the text data and structure data of the freight rate data are written into the local storage space by the following means. The specific process is as follows:

[0058] First, the total space occupied by the text data and the structure data in the freight rate data is calculated, that is, the actual occupied space of the freight rate data. The actual occupied space is the sum of the total space occupied by the text data and the space occupied by the structure data.

[0059] Then, the memory space is dynamically allocated according to the actual occupied space, with the structure data stored in the front of the memory space and the text data stored in the back.

[0060] Finally, the above text data and structure data are written into the memory space.

[0061] After obtaining the above freight rate data and its actual occupied space, the freight rate data is stored in the local storage space of the freight rate search system based on the above storage rules. Specifically, the processed freight rate data is first placed into the regular freight rate detailed table of the memory database one by one; at the same time, a data index is constructed, and the freight rate data is stored in the local file through MMAP address space mapping.

[0062] The detailed table of regular freight rates is opened in the memory through MMAP address space mapping, and then the processed data is put into the memory one by one. Finally, the carrCode, locationCode, fareByRuleId, and fareByRuleDtlId in the structure data are spelled into the KEY "HU HDQ Domestic Key Customer Policy (2009-1032) 127175483296" and put into the index Map. The Value is the first address pointing to the memory data. After all storage is completed, the data in the memory is mapped to the local file.

[0063] In addition, a new data type is used to replace the location where text data was originally stored in the structure data. This data type contains an address and a length, where the address points to the first address where the text data is stored after the structure data, and the length is the actual size of the text after removing spaces. In this way, the freight rate data is still stored in a continuous address space, and can still be directly accessed by accessing members in the structure data. In this way, the original fixed-length storage of each row of data is changed to variable-length storage.

[0064] For example, the text data of the freight rate above is parsed. The fields of the text data include accountCode (key customer code), rstfDisplayEndorsment (endorsement information), etermRstfDisplayEndorsment (ETERM endorsement information), remark (remarks), and formula (custom calculation formula). They are all of SizedStringDynamic type. The SizedStringDynamic type encapsulates the pointer and length. The contents of the fields after parsing are shown in the following table.

[0065]

[0066]

[0067] From the above table, we can see that the actual size of each text data is 10+32+32+0+0=74, the size of the structure data is 718, and the total is 74+718=792 bytes. Based on this, a space size of 792 bytes is dynamically allocated, and the address is placed in pAddr. Figure 2 shown.

[0068] The structure data is stored in the front, and the actual data of each long text is stored in sequence after the structure. The place where the long text was originally stored in the structure is replaced by SizedStringDynamic, which points to the long text data corresponding to the end and stores the size of the long text data. The m_pValue of accountCode points to the first address after the structure, which is pAddr+718, and m_size is the size of the actual data 10. The m_pValue of rstfDisplayEndorsment points to the first address after the structure plus the size of accountCode, which is pAddr+718+10, and m_size is the size of the actual data 32. The m_pValue of etermRstfDisplayEndorsment points to the first address after the structure plus the size of accountCode and the size of rstfDisplayEndorsment, which is pAddr+718+10+32, and m_size The size of the actual data is 32. The m_pValue of remark points to the first address after the structure plus the size of accountCode, the size of rstfDisplayEndorsment, and the size of etermRstfDisplayEndorsment, which is pAddr+718+10+32+32. m_size is the size of the actual data, which is 0. The m_pValue of formula points to the first address after the structure plus the size of accountCode, the size of rstfDisplayEndorsment, the size of etermRstfDisplayEndorsment, and the size of remark, which is pAddr+718+10+32+32+0. m_size is the size of the actual data, which is 0. In this way, the parsing of this line is completed. The data can still be directly accessed through the member access in the structure. In this way, the fixed-length storage of each row of data is changed to variable-length storage.

[0069] When the operation field is Delete, the deletion operation is performed on the freight rate data originally stored in the local storage space.

[0070] That is, when the operation field in the structure data obtained by parsing the freight message data is deleted, the freight data pointed to is queried and deleted. When executing the deletion process, the primary key is constructed, the index of the freight detailed table of the memory database is read and queried, and the address space where the data is stored is found and deleted. The following data is moved forward to cover the data to be deleted, and the address pointing to the long text data in the structure is corrected, and then the node in the index is deleted.

[0071] After the deletion process is completed, the data and index in the memory are stored in the local file through the MMAP address space mapping. Through the operation here, useless or invalid data can be deleted, thereby saving storage space.

[0072] For example, assuming that the actionCode of the structure data is 'X', which means deleting this data, first read and parse its original message, then put all the parsed fields into the structure, and put the text data into the continuous space after the structure data. The SizedStringDynamic field in the structure points to the actual storage space after the structure data. This part is the same as the above operation, that is, the original freight message data is parsed, and after processing, the freight data is put into a continuous space containing the structure.

[0073] Here we need to find this data and delete it. First, we need to get the field values ​​of carrCode, locationCode, fareByRuleId, and fareByRuleDtlId in the primary key KEY, and then spell them into KEY "HU HDQ Domestic Key Customer Policy (2009-1032) 127175483296", open the detailed table of freight rates in the memory database, read the index Map for search, and read the structure NfstaFareByRuleDtl pointed to by Value after finding it. The size field in NfstaFareByRuleDtl stores the storage space occupied by this data. Use Value+size to get the first address of the next data, and copy the following data one by one to overwrite the storage space pointed to by Value. The pseudo code is as follows:

[0074] memCpy(value,value+size,(value+size)->size);

[0075] During the overwriting process, pay attention to whether it has reached the end of the table. The header of the regular freight rate detailed table will store the start and end addresses of the storage space. During the copying process, this is used to determine whether it has reached the end of the table. At the same time, correct the address pointing to the long text data in the structure. Because the pointer stores a fixed address, it points to the long text data before moving. Therefore, it needs to be modified after each data is moved. The first address of the accountCode after the structure is obtained by adding the value to the length of the structure, and then the size of the first accountCode is added to obtain the first address of rstfDisplayEndorsment. And so on. The pseudo code is as follows:

[0076] value->accountCode.setAddress(value+sizeof(NfstaFareByRuleDtl));

[0077] Then delete the Key node in the index Map. Finally, store the data in the memory into a local file.

[0078] It can be seen from the above technical scheme that this embodiment provides a data storage method for a freight rate search system, which is applied to electronic devices, specifically receiving freight rate message data published by a front-end freight rate publishing system; parsing the freight rate message data to obtain operation fields and freight rate data, the freight rate data including text data and structure data; and updating the local storage space of the freight rate search system according to the operation fields and freight rate data. Through this scheme, the original fixed-length storage of each row of data is changed to variable-length storage, which saves storage space, so that the system can load all existing freight rate data into the memory, thereby improving the search efficiency.

[0079] In addition, in another specific embodiment of the present application, the following steps may be included only or in addition to the above embodiment: Figure 3 As shown, this technical feature is applied to the search node of the freight rate search system.

[0080] S4. Perform a query according to the query instruction and feedback the query result.

[0081] When a query request is received, the local regular freight rate details table is first mapped to the memory through the MMAP address space, and then an index key is built according to the field to be queried, and the query is performed through the table index. Finally, after obtaining the queried data, the fields are randomly read through the structure, and the query results are then fed back.

[0082] Still taking the above data as an example, suppose you want to query this data, first map the local regular freight rate details table to the memory through the MMAP address space, then build the index KEY "HU HDQ Domestic Key Customer Policy (2009-1032) 127175483296" you want to query based on the values ​​of carrCode, locationCode, fareByRuleId, and fareByRuleDtlId, read the index Map for search, and after finding it, randomly read the fields through the structure. Here, the SizedStringDynamic type encapsulates all the original type SizedString methods, so that the operations on SizedStringDynamic can be directly replaced. Through the above operations, the user's query needs can be met.

[0083] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0084] Although operations are depicted in a particular order, this should not be understood as requiring that the operations be performed in the particular order shown or in a sequential order.Multitasking and parallel processing may be advantageous under certain circumstances.

[0085] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0086] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as C or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer.

[0087] Figure 4 This is a block diagram of a data storage device of a fare search system according to an embodiment of the present application.

[0088] like Figure 4As shown, the data storage device provided in this embodiment is applied to an electronic device, and is used to provide data storage services for a freight rate search system. The electronic device can be understood as a computer, server or cloud platform with data computing and information processing capabilities. The data storage device includes a message receiving module 10, a message parsing module 20 and a data updating module 30.

[0089] The message receiving module is used to receive the freight rate message data published by the front-end freight rate publishing system.

[0090] These data are stored in message format and transmitted in the form of compressed files. Decompress and parse each line of data in the original message, and identify whether it is information in the regular freight rate detailed table based on the data identifier at the beginning of the line.

[0091] Taking the compressed package DFF.NFSTA.C.D20230818.T0830.zip at 8:30 on August 18, 2023 as an example, the data identifier at the beginning of the row of the regular freight rate details table is '150', and one of the messages is shown in the following table:

[0092]

[0093] The 'I' indicates writing data.

[0094] The message parsing module is used to parse and process freight rate message data.

[0095] By parsing the freight rate message data, the operation field and freight rate data are obtained. The operation field is write or delete. Write means that the freight rate data needs to be written into the local storage space of the freight rate search system, and delete means that the outdated freight rate data needs to be deleted. The freight rate data here includes text data and structure data.

[0096] The data update module is used to update the local storage space according to the operation fields and freight rate data.

[0097] That is, after obtaining the operation field and the freight rate data, the local storage space of the freight rate search system, that is, the database storing the freight rate data, is updated based on the operation mode of the operation field and the freight rate data. The module includes a write processing unit 31 and a delete processing unit 32, such as Figure 5 shown.

[0098] The write processing unit is used to write the text data and structure data of the freight rate data into the local storage space by the following means when the operation field is write. The specific process is as follows:

[0099] First, the total space occupied by the text data and the structure data in the freight rate data is calculated, that is, the actual occupied space of the freight rate data. The actual occupied space is the sum of the total space occupied by the text data and the space occupied by the structure data.

[0100] Then, the memory space is dynamically allocated according to the actual occupied space, with the structure data stored in the front of the memory space and the text data stored in the back.

[0101] Finally, the above text data and structure data are written into the memory space.

[0102] After obtaining the above freight rate data and its actual occupied space, the freight rate data is stored in the local storage space of the freight rate search system based on the above storage rules. Specifically, the processed freight rate data is first placed into the regular freight rate detailed table of the memory database one by one; at the same time, a data index is constructed, and the freight rate data is stored in the local file through MMAP address space mapping.

[0103] The detailed table of regular freight rates is opened in the memory through MMAP address space mapping, and then the processed data is put into the memory one by one. Finally, the carrCode, locationCode, fareByRuleId, and fareByRuleDtlId in the structure data are spelled into the KEY "HU HDQ Domestic Key Customer Policy (2009-1032) 127175483296" and put into the index Map. The Value is the first address pointing to the memory data. After all storage is completed, the data in the memory is mapped to the local file.

[0104] In addition, a new data type is used to replace the location where text data was originally stored in the structure data. This data type contains an address and a length, where the address points to the first address where the text data is stored after the structure data, and the length is the actual size of the text after removing spaces. In this way, the freight rate data is still stored in a continuous address space, and can still be directly accessed by accessing members in the structure data. In this way, the original fixed-length storage of each row of data is changed to variable-length storage.

[0105] For example, the text data of the freight rate above is parsed. The fields of the text data include accountCode (key customer code), rstfDisplayEndorsment (endorsement information), etermRstfDisplayEndorsment (ETERM endorsement information), remark (remarks), and formula (custom calculation formula). They are all of SizedStringDynamic type. The SizedStringDynamic type encapsulates the pointer and length. The contents of the fields after parsing are shown in the following table.

[0106]

[0107]

[0108] From the above table, we can see that the actual size of each text data is 10+32+32+0+0=74, the size of the structure data is 718, and the total is 74+718=792 bytes. Based on this, a space size of 792 bytes is dynamically allocated, and the address is placed in pAddr. Figure 2 shown.

[0109] The structure data is stored in the front, and the actual data of each long text is stored in sequence after the structure. The place where the long text was originally stored in the structure is replaced by SizedStringDynamic, which points to the long text data corresponding to the end and stores the size of the long text data. The m_pValue of accountCode points to the first address after the structure, which is pAddr+718, and m_size is the size of the actual data 10. The m_pValue of rstfDisplayEndorsment points to the first address after the structure plus the size of accountCode, which is pAddr+718+10, and m_size is the size of the actual data 32. The m_pValue of etermRstfDisplayEndorsment points to the first address after the structure plus the size of accountCode and the size of rstfDisplayEndorsment, which is pAddr+718+10+32, and m_size The size of the actual data is 32. The m_pValue of remark points to the first address after the structure plus the size of accountCode, the size of rstfDisplayEndorsment, and the size of etermRstfDisplayEndorsment, which is pAddr+718+10+32+32. m_size is the size of the actual data, which is 0. The m_pValue of formula points to the first address after the structure plus the size of accountCode, the size of rstfDisplayEndorsment, the size of etermRstfDisplayEndorsment, and the size of remark, which is pAddr+718+10+32+32+0. m_size is the size of the actual data, which is 0. In this way, the parsing of this line is completed. The data can still be directly accessed through the member access in the structure. In this way, the fixed-length storage of each row of data is changed to variable-length storage.

[0110] The deletion processing unit is used to perform a deletion operation on the freight rate data originally stored in the local storage space when the operation field is deletion.

[0111] That is, when the operation field in the structure data obtained by parsing the freight message data is deleted, the freight data pointed to is queried and deleted. When executing the deletion process, the primary key is constructed, the index of the freight detailed table of the memory database is read and queried, and the address space where the data is stored is found and deleted. The following data is moved forward to cover the data to be deleted, and the address pointing to the long text data in the structure is corrected, and then the node in the index is deleted.

[0112] After the deletion process is completed, the data and index in the memory are stored in the local file through the MMAP address space mapping. Through the operation here, useless or invalid data can be deleted, thereby saving storage space.

[0113] For example, assuming that the actionCode of the structure data is 'X', which means deleting this data, first read and parse its original message, then put all the parsed fields into the structure, and put the text data into the continuous space after the structure data. The SizedStringDynamic field in the structure points to the actual storage space after the structure data. This part is the same as the above operation, that is, the original freight message data is parsed, and after processing, the freight data is put into a continuous space containing the structure.

[0114] Here we need to find this data and delete it. First, we need to get the field values ​​of carrCode, locationCode, fareByRuleId, and fareByRuleDtlId in the primary key KEY, and then spell them into KEY "HU HDQ Domestic Key Customer Policy (2009-1032) 127175483296", open the detailed table of freight rates in the memory database, read the index Map for search, and read the structure NfstaFareByRuleDtl pointed to by Value after finding it. The size field in NfstaFareByRuleDtl stores the storage space occupied by this data. Use Value+size to get the first address of the next data, and copy the following data one by one to overwrite the storage space pointed to by Value. The pseudo code is as follows:

[0115] memCpy(value,value+size,(value+size)->size);

[0116] During the overwriting process, pay attention to whether it has reached the end of the table. The header of the regular freight rate detailed table will store the start and end addresses of the storage space. During the copying process, this is used to determine whether it has reached the end of the table. At the same time, correct the address pointing to the long text data in the structure. Because the pointer stores a fixed address, it points to the long text data before moving. Therefore, it needs to be modified after each data is moved. The first address of the accountCode after the structure is obtained by adding the value to the length of the structure, and then the size of the first accountCode is added to obtain the first address of rstfDisplayEndorsment. And so on. The pseudo code is as follows:

[0117] value->accountCode.setAddress(value+sizeof(NfstaFareByRuleDtl));

[0118] Then delete the Key node in the index Map. Finally, store the data in the memory into a local file.

[0119] It can be seen from the above technical scheme that this embodiment provides a data storage device for a freight rate search system, which is applied to electronic devices, specifically receiving freight rate message data issued by a front-end freight rate publishing system; parsing the freight rate message data to obtain operation fields and freight rate data, the freight rate data including text data and structure data; and updating the local storage space of the freight rate search system according to the operation fields and freight rate data. Through this scheme, the original fixed-length storage of each row of data is changed to variable-length storage, which saves storage space, so that the system can load all existing freight rate data into the memory, thereby improving the search efficiency.

[0120] In addition, in another specific embodiment of the present application, the data query module 40 may be included only or may be included on the basis of the previous embodiment, such as Figure 6 shown.

[0121] The data query module is used to perform queries according to query instructions and feedback query results.

[0122] When a query request is received, the local regular freight rate details table is first mapped to the memory through the MMAP address space, and then an index key is built according to the field to be queried, and the query is performed through the table index. Finally, after obtaining the queried data, the fields are randomly read through the structure, and the query results are then fed back.

[0123] Still taking the above data as an example, suppose you want to query this data, first map the local regular freight rate details table to the memory through the MMAP address space, then build the index KEY "HU HDQ Domestic Key Customer Policy (2009-1032) 127175483296" you want to query based on the values ​​of carrCode, locationCode, fareByRuleId, and fareByRuleDtlId, read the index Map for search, and after finding it, randomly read the fields through the structure. Here, the SizedStringDynamic type encapsulates all the original type SizedString methods, so that the operations on SizedStringDynamic can be directly replaced. Through the above operations, the user's query needs can be met.

[0124] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".

[0125] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0126] Figure 7 A block diagram of an electronic device according to an embodiment of the present application.

[0127] Reference below Figure 7 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. The electronic device is only an example and should not bring any limitations to the functions and scope of use of the embodiments of the present disclosure.

[0128] The electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory ROM 802 or a program loaded from an input device 806 into a random access memory RAM 803. In the RAM, various programs and data required for the operation of the electronic device are also stored. The processing device, ROM, and RAM are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0129] Typically, the following devices may be connected to the I / O interface: input devices including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 808 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 809. The communication device 809 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various devices, it should be understood that it is not required to implement or have all the devices shown. More or fewer devices may be implemented or have alternatively.

[0130] This embodiment also provides a computer-readable storage medium embodiment.

[0131] The storage medium is applied to an electronic device and carries one or more computer programs. When the one or more computer programs are executed by the electronic device, the electronic device receives the freight rate message data issued by the front-end freight rate publishing system; parses and processes the freight rate message data to obtain the freight rate data and the actual occupied space of the freight rate data, the freight rate data includes text data and structure data; stores the freight rate data in the local storage space of the freight rate search system according to the actual occupied space. Through this solution, the original fixed-length storage of each row of data is changed to variable-length storage, which saves storage space, so that the system can load all the existing freight rate data into the memory, thereby improving the search efficiency.

[0132] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0133] In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0134] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0135] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0136] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0137] The technical solution provided by the present invention is introduced in detail above. Specific examples are used in this article to illustrate the principle and implementation mode of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A data storage method for a freight rate search system, applied to electronic equipment, characterized in that: The data storage method comprises the steps of: Receive freight rate message data published by the front-end freight rate publishing system; Parsing the freight rate message data to obtain operation fields and freight rate data, wherein the freight rate data includes text data and structure data; The local storage space of the freight rate search system is updated according to the operation field and the freight rate data.

2. The data storage method according to claim 1, characterized in that: The updating process of the local storage space of the freight rate search system according to the operation field and the freight rate data comprises the steps of: When the operation field is write, the freight rate data is written into the local storage space; When the operation field is Delete, the pointed freight rate data is queried and deleted.

3. The data storage method according to claim 2, characterized in that: When the operation field is writing, writing the freight rate data into the local storage space comprises the steps of: Calculating the sum of the total space occupied by the text data and the space occupied by the structure data to obtain the actual occupied space; Dynamically allocating memory space according to the actual occupied space, the memory space being used to store the text data and the structure data; The text data and the structure are written into the memory space.

4. The data storage method according to claim 3, characterized in that: The structure data includes an address and a length, the address points to the first address of the text data, and the length is the actual length of the text data.

5. The data storage method according to claim 3, characterized in that: The step of writing the text data and the structure into the memory space comprises the following steps: Storing the freight rate data in a regular freight rate detailed table of a database in the local storage space; A data index is constructed for each piece of the freight rate data in the regular freight rate detailed table.

6. The data storage method according to any one of claims 1 to 5, characterized in that: Also includes the steps: When a query instruction is received, a query is performed based on the query field specified by the query instruction and the query result is fed back.

7. A data storage device for a freight rate search system, applied to an electronic device, characterized in that: The data storage device comprises: The message receiving module is configured to receive the freight rate message data issued by the front-end freight rate issuing system; A message parsing module is configured to parse the freight rate message data to obtain operation fields and freight rate data, wherein the freight rate data includes text data and structure data; The data updating module is configured to update the local storage space of the freight rate search system according to the operation field and the freight rate data.

8. The data storage device according to claim 7, characterized in that The data updating module comprises: A write processing unit, configured to write the freight rate data into the local storage space when the operation field is write; The deletion processing unit is configured to query and delete the pointed freight rate data when the operation field is deletion.

9. The data storage device according to claim 7 or 8, characterized in that: Also includes: The data query module is configured to, when receiving a query instruction, perform a query based on the query field specified by the query instruction and feed back a query result.

10. An electronic device, characterized in that: The electronic device comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs or instructions; The processor is used to execute the computer program or instruction so that the electronic device implements the data storage method of the freight rate system according to any one of claims 1 to 6.

11. A storage medium, applied to an electronic device, characterized in that: The storage medium carries one or more computer programs, and the one or more computer programs can be executed by the electronic device, so that the electronic device implements the data storage method of the freight rate system according to any one of claims 1 to 6.

Citation Information

Cited By

  • Tree data storage-based freight rate verification method and system, medium and equipment

    CN121116975A