[go: up one dir, main page]

CN107562743B - Data storage method and device, and data search request processing method and device - Google Patents

Data storage method and device, and data search request processing method and device Download PDF

Info

Publication number
CN107562743B
CN107562743B CN201610505350.2A CN201610505350A CN107562743B CN 107562743 B CN107562743 B CN 107562743B CN 201610505350 A CN201610505350 A CN 201610505350A CN 107562743 B CN107562743 B CN 107562743B
Authority
CN
China
Prior art keywords
data
index
integer number
value
register
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610505350.2A
Other languages
Chinese (zh)
Other versions
CN107562743A (en
Inventor
郝允冉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CN201610505350.2A priority Critical patent/CN107562743B/en
Priority to PCT/CN2017/088071 priority patent/WO2018001085A1/en
Publication of CN107562743A publication Critical patent/CN107562743A/en
Application granted granted Critical
Publication of CN107562743B publication Critical patent/CN107562743B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a data storage method and device and a data search request processing method and device. The storage method comprises the following steps: acquiring a serial number configured for the current service data when the current service data is saved; decomposing the serial number into a first integer number and a second integer number; reading first data which takes the first integer number as an index and second data which takes the second integer number as an index in a first mapping bitmap, wherein the first data and the second data are used for positioning business data stored at the previous time; the first data and the second data are saved. The invention solves the technical problem of low efficiency of searching data by using a polling mode in the related technology.

Description

Data storage method and device, and data search request processing method and device
Technical Field
The invention relates to the field of data processing, in particular to a data storage method and device and a data search request processing method and device.
Background
In a router, data storage and lookup are often required. For example, when a service that is newly created is searched in a case where a plurality of services need to be created, if a polling method is used to search data, since polling requires traversal of all data, a lot of time is consumed, the efficiency of data search is low, and the performance of the router is reduced.
In order to improve the efficiency of searching data by the router and reduce the consumed time, the following two methods can be adopted to improve the searching efficiency.
(1) The conventional search method cannot avoid polling data, for example, methods such as establishing a row index, dynamically allocating a memory, binary search and the like are used to increase the query speed, and the query efficiency caused by polling cannot be effectively improved by using the polling data method.
(2) The search method using the keywords and the commonly used polling, for example, the algorithms of direct positioning search and binary search are respectively used, so that the data polling cannot be avoided, and the method is slower than the table lookup method in principle and has lower efficiency.
Aiming at the technical problem of low efficiency of searching data by using a polling mode in the related art, no effective solution is provided at present.
Disclosure of Invention
The embodiment of the invention provides a data storage method and device and a data searching request processing method and device, which at least solve the technical problem of low efficiency of searching data in a polling mode in the related art.
According to an aspect of an embodiment of the present invention, there is provided a data storage method, including: acquiring a serial number configured for the current service data when the current service data is saved; decomposing the serial number into a first integer number and a second integer number; reading first data which takes a first integer number as an index and second data which takes a second integer number as an index in a first mapping bitmap, wherein the first data and the second data are used for positioning business data stored at the previous time; the first data and the second data are saved.
Further, decomposing the number into a first reshaped number and a second reshaped number includes: performing a remainder operation on the number by using a preset parameter, wherein the result of the remainder operation is a first integer number X; and performing a modular operation on the serial number by using the preset parameters, wherein the result of the modular operation is a second integer number Y.
Further, saving the first data and the second data includes: obtaining the value of an element Y in the array, and storing first data into the element Y, wherein the value of the element Y after storage is (DataRdyTblX [ Y ] | FDMapTbl [ X ]), the DataRdyTblX [ Y ] is the value of the element Y in the obtained array DataRdyTblX, and the FDMapTbl [ X ] is the first data; and acquiring the value of the register, and storing second data into the register, wherein the value of the register after storage is (DataRdyGrpY | FDMapTbl [ Y ]), the DataRdyGrpY is the acquired value of the register, and the FDMapTbl [ Y ] is the second data.
According to another aspect of the embodiments of the present invention, there is provided a method for processing a data search request, the method including: when a data search request is received, acquiring a register value of a register; reading a second integer number from the second mapping bitmap table by using the register value as an index; reading a first integer number which takes the second integer number as an index in the array; and determining the index of the service data searched by the data searching request based on the first shaping number and the second shaping number.
Further, determining an index of the traffic data looked up by the data look-up request based on the first shaping number and the second shaping number comprises: the index S = X | with traffic data (Y "B") is determined by a first and a second shaping number X and Y, where B is the number of bits to which Y is right-shifted.
Further, after determining the index of the service data looked up by the data look-up request based on the first shaping number and the second shaping number, the method further comprises: and searching the service data in the database for storing the service data through the index of the service data.
According to another aspect of an embodiment of the present invention, there is provided a data storage apparatus including: the first obtaining unit is used for obtaining a serial number configured for the current service data when the current service data is stored; the processing unit is used for decomposing the serial number into a first integer number and a second integer number; the first reading unit is used for reading first data which takes the first integer number as an index and second data which takes the second integer number as an index in the first mapping bitmap, wherein the first data and the second data are used for positioning business data stored at the previous time; and the storage unit is used for storing the first data and the second data.
The processing unit further comprises a first processing module, a second processing module and a third processing module, wherein the first processing module is used for performing a remainder operation on the serial number by using a preset parameter, and the result of the remainder operation is a first integer number X; and the second processing module is used for executing modular operation on the serial number by using the preset parameters, and the result of the modular operation is a second integer number Y.
Further, the saving unit comprises a first saving module, configured to obtain a value of an element Y in the array, and save the first data in the element Y, where the value of the element Y after saving is: (DataRdyTblX [ Y ] | FDMapTbl [ X ]), wherein the DataRdyTblX [ Y ] is the value of the element Y in the obtained array DataRdyTblX, and the FDMapTbl [ X ] is first data; and a second saving module, configured to obtain the value of the register and save the second data in the register, where the value of the register after saving is (datardygpy | FDMapTbl [ Y ]), datardygpy is the obtained value of the register, and FDMapTbl [ Y ] is the second data.
According to another aspect of the embodiments of the present invention, there is provided an apparatus for processing a data search request, the apparatus including: the second acquisition unit is used for acquiring the register value of the register when receiving the data search request; a second reading unit for reading a second integer number from the second mapping bit map table with the register value as an index; the third reading unit is used for reading the first integer number which takes the second integer number as an index in the array; and the determining unit is used for determining the index of the service data searched by the data searching request based on the first shaping number and the second shaping number.
Further, the determination unit includes: and the determining module is used for determining an index S = X | of the business data (Y & ltB & gt) according to the first integer number X and the second integer number Y, wherein the B is the digit of right shift of Y.
Further, the apparatus further comprises: and the searching unit is used for searching the service data in the database storing the service data through the index of the service data after determining the index of the service data searched by the data searching request based on the first shaping number and the second shaping number.
According to another embodiment of the present invention, there is provided a storage medium that may be configured to store program code for performing the steps of: acquiring a serial number configured for the current service data when the current service data is saved; decomposing the serial number into a first integer number and a second integer number; reading first data which takes the first integer number as an index and second data which takes the second integer number as an index in a first mapping bitmap, wherein the first data and the second data are used for positioning business data stored at the previous time; the first data and the second data are saved.
Further, the storage medium may be further configured to store program code for performing the steps of: when a data search request is received, acquiring a register value of a register; reading a second integer number from the second mapping bitmap table by using the register value as an index; reading a first integer number which takes the second integer number as an index in the array; and determining the index of the service data searched by the data searching request based on the first shaping number and the second shaping number.
In the embodiment of the invention, when the current service data is saved, the serial number configured for the current service data is obtained; decomposing the serial number into a first integer number and a second integer number; reading first data which takes the first integer number as an index and second data which takes the second integer number as an index in a first mapping bitmap, wherein the first data and the second data are used for positioning business data stored at the previous time; the first data and the second data are saved. Therefore, the technical problem that the efficiency of searching data by using a polling mode in the related technology is low is solved, and the technical effect of improving the efficiency of searching data is realized.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a schematic diagram of an alternative terminal according to an embodiment of the present invention;
FIG. 2 is a flow chart of a data storage method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an alternative bitmap table according to an embodiment of the present invention;
FIG. 4 is a flow diagram of a method of processing a data lookup request according to an embodiment of the invention;
FIG. 5 is a schematic diagram of an alternative bit map table according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a data storage device according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a data lookup request processing apparatus according to an embodiment of the present invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
Example 1
The method provided by the first embodiment of the present application may be executed in a mobile terminal (such as a router, etc.), a computer terminal, or a similar computing device. Taking the example of the mobile terminal, as shown in fig. 1, the mobile terminal may include one or more (only one shown in the figure) processors 101 (the processors 101 may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 103 for storing data, and a transmission device 105 for communication function. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the electronic device.
The memory 103 may be used to store software programs and modules of application software, such as program instructions/modules corresponding to the control method of the device in the embodiment of the present invention, and the processor 101 executes various functional applications and data processing by running the software programs and modules stored in the memory 103, so as to implement the above-mentioned method. The memory may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include memory located remotely from the processor, and these remote memories may be connected to the computer terminal through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal. In one example, the transmission device includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
Where a method embodiment of a data storage method is provided, according to an embodiment of the present invention, it is noted that the steps illustrated in the flowchart of the figure may be performed in a computer system such as a set of computer-executable instructions, and that while a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
Fig. 2 is a flowchart of a data storage method according to an embodiment of the present invention, as shown in fig. 2, the method includes the steps of:
step S201, when saving the current service data, acquiring a serial number configured for the current service data.
In step S202, the number is divided into a first integer number and a second integer number.
Step S203, reading first data indexed by the first integer number and second data indexed by the second integer number in the first mapping bitmap, where the first data and the second data are used to locate the service data saved last time.
The first mapping bitmap is prepared in advance and is used for storing processed data with mapping relations, namely the corresponding relation between the integer numbers and the numbers.
And step S204, saving the first data and the second data.
By the embodiment, when the current service data is saved, the serial number configured for the current service data is obtained; decomposing the serial number into a first integer number and a second integer number; reading first data which takes the first integer number as an index and second data which takes the second integer number as an index in a first mapping bitmap, wherein the first data and the second data are used for positioning business data stored at the previous time; the first data and the second data are stored, data can be inquired through the first data and the second data when the data are searched, polling is not needed, the technical problem that the efficiency of searching the data by using a polling mode in the related technology is low is solved, and the technical effect of improving the efficiency of searching the data is achieved.
Optionally, the executing body of the above steps may be an embedded device, such as a router, a mobile terminal, etc., but is not limited thereto.
In the above embodiment, decomposing the number into the first shaping number and the second shaping number includes: performing a residue taking operation on the number by using a preset parameter, wherein the residue taking operation result is a first integer number X; and performing a modular operation on the serial number by using the preset parameters, wherein the result of the modular operation is a second integer number Y.
Optionally, saving the first data and the second data comprises: obtaining the value of an element Y in the array, and storing first data into the element Y, wherein the stored value of the element Y is as follows: (DataRdyTblX [ Y ] | FDMapTbl [ X ]), dataRdyTblX [ Y ] being the value of element Y in the array DataRdyTblX, FDMapTbl [ X ] being the first data; and acquiring the value of the register, and storing second data into the register, wherein the value of the register after storage is (DataRdyGrpY | FDMapTbl [ Y ]), the DataRdyGrpY is the acquired value of the register, and the FDMapTbl [ Y ] is the second data.
Compared with the prior art, the embodiment makes great progress in the aspect of reducing data searching time, achieves the aim of improving data searching efficiency, and can improve the efficiency of a system in the aspects of software development, data forwarding and the like.
In the above embodiment, for a set of service data, it is generally stored by using an array during management, and when the data is stored in the array, each service data is given a number, and the number is unique. The serial number is decomposed into X and Y shaping values, then X and Y are mapped through a bitmap table, X is mapped to a group number to be stored, Y is mapped to a shaping value, and therefore data storage is completed. When searching the stored data with the top sequence, the value mapped by X and Y is restored by another bit chart, then X and Y are combined to obtain the number of the data, and further obtain the data value. Specifically, the method can be realized by the following steps:
and step S11, when the data are stored in the array, each data is given a number, and the number is unique.
And S12, decomposing the serial number into X and Y shaping numerical values.
The data number is divided by 64 to obtain the modulus value and the remainder, and the modulus value is recorded by the variable DataM. The remainder is decomposed to convert it to binary, and the lower 3 bits of the remainder are taken and recorded in variable X. And taking the upper 3 bits of the remainder, recording the upper 3 bits in a variable Y, searching a bit diagram FDMapTbl [ Y ] through Y to obtain a bitmap value DataRdyGrpY, wherein the method for searching is that DataRdyGrpY | = FDMapTbl [ Y ], searching the bit diagram FDMapTbl [ X ] through X to obtain a bitmap value DataRdyTblX [ Y ], and the method for searching is that DataRdyTblX [ Y ] | = FDMapTbl [ X ].
Step S13, designing 2 bit charts, FDMapTbl [ ] and FDUnMapTbl [ ].
In step S14, the values of X and Y are stored in the DataRdyTblX [ Y ] array by mapping the bitmap table fdmapbl [ ], and Y is stored in the DataRdyGrpY, thereby completing data storage.
And step S15, if new data need to be stored, repeating the first step.
For example, a router needs to create 64 services, each of which needs to store one data. The data is numbered from 0 to 63, corresponding to 64 services. If the 18 th service is created, the number 17 needs to be stored. When searching, the service with the minimum number needs to be taken out. Assuming no data is stored, the 18 th service, the 28 th service, and the 18 th service need to be retrieved. The specific process execution process is as follows:
firstly, storing the 18 th service, that is, the number 17 needs to be stored, decomposing 17, wherein Y =17> >3 (corresponding to the upper three bits of the binary number of 17), X =17&0 × 7 (corresponding to the lower three bits of the binary number of 17), and the value of Y is 17 right-shifted by 3 bits and is equal to 2; the lower 3 bits of X, with a value of 17, equals 1.
Secondly, after the above decomposition, the X value of the 18 th service is 1,Y and 2. According to fig. 3, mapping is performed by a bitmap table fdmapbl [ ], dataRdyTblX [ Y ] = DataRdyTblX [ Y ] | fdmapbl [ X ], dataRdyGrpY = DataRdyGrpY | fdmapbl [ Y ], i.e., dataRdyTblX [2] = DataRdyTblX [2] | fdmapbl [1], dataRdyGrpY = DataRdyGrpY | fdmapbl [2], and the following results can be obtained: the value 1 of X is mapped to the value 0X02 stored in DataRdyTblX [2 ]. The value of Y2 is mapped to the value of 0x04 stored in datardygry. Thus, the 18 th transaction is completed.
Next, the 28 th service is stored, and as in the 18 th service, X =3 and y =3 after the number 27 is divided. By mapping DataRdyTblX [ Y ] = DataRdyTblX [ Y ] | fdmapbl [ X ], dataRdyGrpY = DataRdyGrpY | fdmapbl [ Y ], i.e. DataRdyTblX [3] | = DataRdyTblX [3] | fdmapbl [3], dataRdyGrpY | = DataRdyGrpY | fdmapbl [3], the following results can be obtained: the value 3 of X is mapped and stored in DataRdyTblX [3] with a value of 0X08. The value 3 of Y is mapped to a value (0x04 as 90 × 08) stored in datardygpy, and thus the value is 0x0C. This completes the storage of the 28 th service.
By adopting the data storage mode, the data can be conveniently searched.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example 2
According to an embodiment of the present invention, an embodiment of a method for processing a data search request is provided, and fig. 4 is a flowchart of a method for processing a data search request according to an embodiment of the present invention, as shown in fig. 4, the method includes the following steps:
step S401, when a data search request is received, a register value of a register is obtained;
step S402, reading a second integer number from a second mapping bit chart by taking the register value as an index;
step S403, reading a first integer number indexed by a second integer number in the array;
and step S404, determining the index of the service data searched by the data search request based on the first shaping number and the second shaping number.
Through the embodiment, when a data search request is received, the register value of the register is obtained; reading a second integer number from the second mapping bitmap table by taking the register value as an index; reading a first integer number which takes the second integer number as an index in the array; the index of the service data searched by the data searching request is determined based on the first integer number and the second integer number, so that the data to be searched is determined through the index, the technical problem that the efficiency of searching the data in a polling mode in the related technology is low is solved, and the technical effect of improving the efficiency of searching the data is realized.
In step S404, determining an index of the service data looked up by the data look-up request based on the first shaping number and the second shaping number includes: the index S = X | of the traffic data (Y "B") is determined by the first and second shaping numbers X and Y, where B is the number of bits Y is right-shifted, e.g. 3 bits in the previous embodiment, and the value of B is 3.
Optionally, after determining the index of the service data searched by the data search request based on the first shaping number and the second shaping number, the service data in the database storing the service data may be searched by the index of the service data.
It should be noted that the data searched by the above method is a number which is smaller than the current number and stores data, if a next number which stores data and has a smaller number needs to be searched, it is determined whether a bit of the DataRdyTblX [ Y ] is set to 1, if so, the bit corresponding to the previous number in the DataRdyTblX [ Y ] is cleared (if the current minimum number is 16, the bit corresponding to 16 is cleared), and then the method continues to search for a smaller number according to the processed DataRdyTblX [ Y ] and DataRdyGrpY; if no other bit in DataRdyTblX [ Y ] is set to 1, the bit corresponding to the previous number in DataRdyTblX [ Y ] and DataRdyGrpY is cleared and the smaller number is found again.
In the above embodiment, when data search is performed, dataRdyTblX [ ] and DataRdyGrpY are restored by mapping bitmap table fdumapptbl [ ]tox and Y, and data numbers are obtained by combining X and Y to obtain stored data, so that the data with the smallest number can be obtained.
For example, a router needs to create 64 services, each of which needs to store one data. The data is numbered from 0 to 63, corresponding to 64 services. If the 18 th service is created, the number 17 needs to be stored. When searching, the service with the minimum number needs to be taken out. Assuming no data is stored, the 18 th service, the 28 th service, and the 18 th service need to be retrieved. The storage of the 18 th service and the 28 th service is described in detail in embodiment 1, and this embodiment is not described again.
When the 18 th service needs to be read:
first, all data is stored in DataRdyGrpY and DataRdyTblX [ ]. According to fig. 5, Y =2 can be obtained by first taking the Y value via the bitmap fdunmapptbl [ ], Y = fdunmapptbl [ datardygry ], i.e. Y = fdunmapptbl [0x0C ].
For "0x0C", which ranges from "0x00-0x0F", the 13 th bit (i.e., bit 12), i.e., 2, is selected from the row corresponding to "0x00-0x 0F". If the data is "0x3C", the 13 th bit, i.e. 2, is selected from the row corresponding to "0x30-0x 3F".
Then, the X value is taken out by the bitmap FDUnMaptbl [ ].
X = fdumapptbl [ DataRdyTblX [ Y ] ], i.e., X = fdumapptbl [ DataRdyTblX [2] ], X = fdumapptbl [0X02], may result in Y =1.
Finally, the X and Y values are combined through an algorithm, (Y < < 3) | X, and [ (2 < < 3) |1] is equal to 17, namely the number of the 18 th service is taken out, and the service with the minimum number is found.
The following description is made with reference to fig. 2 and 5:
the values shown in fig. 2 may be changed according to the type of the integer, and the present application does not limit this, and for convenience of processing, the present application uses binary data to process, and the first to eighth elements in FDMapTbl [ ] correspond to the first to eighth bits of the binary data. If the number range is large, i.e., exceeds the 8 th power of 2, the elements in FDMapTbl [ ] can be expanded.
With respect to FIG. 5, in fabrication, Y in FDUnMaptTbl [ Y ] may be decomposed into binary numbers, as shown in Table 1:
TABLE 1
Y (decimal) Y (binary)
0 0000 0000
1 0000 0001
2 0000 0010
3 0000 0011
4 0000 0100
5 0000 0101
6 0000 0110
7 0000 0111
8 0000 1000
9 0000 1001
…… ……
255 1111 1111
The principle of FDUnMapTbl [ Y ] is to decompose the subscript of the array FDUnMapTbl [ Y ] into binary numbers, find the lowest bit set as '1', then the corresponding value of FDUnMapTbl [ Y ] is the bit number of the lowest bit position '1' of the subscript, and the bit numbers begin numbering from 0. In addition, if the subscript is "0", the value corresponding to fdunnmaptbl [ Y ] is 0.
For example, when Y =1 (binary number: 0000 0001), FDUnMapTbl [1] =0;
when Y =2 (binary number: 0000 0010), FDUnMapTbl [2] =1;
when Y =4 (binary number: 0000 0100), FDUnMapTl [4] =2;
when Y =8 (binary number: 0000 1000), FDUnMapTbl [8] =3;
y =9 (binary number: 0000 1001), fdunnmaptbl [9] =0.
When Y =9, the binary number can be decomposed into 0000 1001, and the 0 th bit thereof is "1", so fdumapptbl [9] =0. The values of other data are the same and are not described in detail.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example 3
The embodiment of the invention also provides a data storage device. The device is used for implementing the above embodiments and preferred embodiments, and the description of the device is omitted. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
FIG. 6 is a schematic diagram of a data storage device according to an embodiment of the present invention. As shown in fig. 6, the apparatus may include: a first acquisition unit 61, a processing unit 62, a first reading unit 63, and a holding unit 64.
The first obtaining unit 61 is configured to obtain a number configured for the current service data when the current service data is saved.
The processing unit 62 is configured to decompose the number into a first integer number and a second integer number.
The first reading unit 63 is configured to read first data indexed by a first integer number and second data indexed by a second integer number in the first mapping bitmap table, where the first data and the second data are used to locate service data saved last time.
The holding unit 64 is configured to hold the first data and the second data.
Through the embodiment, the first obtaining unit obtains the serial number configured for the current service data when the current service data is stored; the processing unit decomposes the serial number into a first integer number and a second integer number; the first reading unit reads first data which takes the first integer number as an index and second data which takes the second integer number as an index in the first mapping bitmap, wherein the first data and the second data are used for positioning service data stored at the previous time; the storage unit stores the first data and the second data, so that the technical problem that the efficiency of searching data by using a polling mode in the related technology is low is solved, and the technical effect of improving the efficiency of searching data is realized.
In the embodiment, the processing unit comprises a first processing module, a second processing module and a third processing module, wherein the first processing module is used for performing a remainder operation on the serial number by using a preset parameter, and the result of the remainder operation is a first integer number X; and the second processing module is used for executing modular operation on the serial number by using the preset parameters, and the result of the modular operation is a second integer number Y.
Optionally, the saving unit includes a first saving module, configured to obtain a value of an element Y in the array, and save the first data in the element Y, where the value of the element Y after saving is: (DataRdyTblX [ Y ] | FDMapTbl [ X ]), wherein the DataRdyTblX [ Y ] is the value of the element Y in the obtained array DataRdyTblX, and the FDMapTbl [ X ] is first data; and a second saving module, configured to obtain a value of the register and save second data to the register, where the value of the saved register is (datardygry | FDMapTbl [ Y ]), the datardygry is the obtained value of the register, and the FDMapTbl [ Y ] is the second data.
In the above embodiment, for a set of service data, it is generally stored by using an array during management, and when the data is stored in the array, each service data is given a number, and the number is unique. The serial number is decomposed into X and Y shaping values, then X and Y are mapped through a bitmap table, X is mapped to a group number to be stored, Y is mapped to a shaping value, and therefore data storage is completed. When searching the stored data with the top sequence, the values mapped by X and Y are restored by another bit chart, and then X and Y are combined to obtain the number of the data, thereby obtaining the data value.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
Example 4
The embodiment of the invention also provides a device for processing the data searching request. The device is used for implementing the above embodiments and preferred embodiments, and the description of the device is omitted. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 7 is a schematic diagram of a processing device of a data lookup request according to an embodiment of the invention. As shown in fig. 7, the apparatus may include: a second acquisition unit 71, a second reading unit 72, a third reading unit 73, and a determination unit 74.
The second obtaining unit 71 is configured to obtain a register value of the register when receiving the data lookup request.
The second reading unit 72 is configured to read the second integer number from the second mapping bitmap table by using the register value as an index.
The third reading unit 73 is configured to read the first integer number indexed by the second integer number in the array.
A determining unit 74, configured to determine an index of the service data looked up by the data look-up request based on the first shaping number and the second shaping number.
Through the embodiment, the second obtaining unit obtains the register value of the register when receiving the data searching request; the second reading unit reads the second integer number from the second mapping bitmap by taking the register value as an index; the third reading unit reads the first integer number which takes the second integer number as an index in the array; the determining unit determines the index of the service data searched by the data searching request based on the first integer number and the second integer number so as to determine the data to be searched through the index, thereby solving the technical problem of low efficiency of searching the data by using a polling mode in the related technology and realizing the technical effect of improving the efficiency of searching the data.
The above-mentioned determination unit includes: and the determining module is used for determining an index S = X | of the business data (Y & ltB & gt) according to the first integer number X and the second integer number Y, wherein the B is the digit of right shift of Y.
Optionally, the apparatus further comprises: and the searching unit is used for searching the service data in the database storing the service data through the index of the service data after determining the index of the service data searched by the data searching request based on the first shaping number and the second shaping number.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are located in different processors in any combination.
Example 5
The embodiment of the invention also provides a storage medium. Alternatively, in the present embodiment, the storage medium may be configured to store program codes for performing the following steps:
s21, acquiring a serial number configured for the current service data when the current service data is stored;
s22, decomposing the serial number into a first integer number and a second integer number;
s23, reading first data which takes the first integer number as an index and second data which takes the second integer number as an index in the first mapping bitmap, wherein the first data and the second data are used for positioning service data stored at the previous time;
and S24, storing the first data and the second data.
Optionally, the storage medium is further arranged to store program code for performing the steps of:
s31, when a data searching request is received, a register value of a register is obtained;
s32, reading a second integer number from the second mapping bit chart by taking the register value as an index;
s33, reading a first integer number which takes the second integer number as an index in the array;
and S34, determining the index of the service data searched by the data search request based on the first shaping number and the second shaping number.
Optionally, in this embodiment, the storage medium may include but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
Optionally, in this embodiment, the processor executes, according to a program code stored in the storage medium, that is, when saving the current service data, acquiring a serial number configured for the current service data; decomposing the serial number into a first integer number and a second integer number; reading first data which takes the first integer number as an index and second data which takes the second integer number as an index in a first mapping bitmap, wherein the first data and the second data are used for positioning business data stored at the previous time; the first data and the second data are saved.
Optionally, in this embodiment, the processor executes, according to the program code stored in the storage medium: when a data searching request is received, acquiring a register value of a register; reading a second integer number from the second mapping bitmap table by taking the register value as an index; reading a first integer number which takes the second integer number as an index in the array; and determining the index of the service data searched by the data searching request based on the first shaping number and the second shaping number.
Optionally, for a specific example in this embodiment, reference may be made to the examples described in the above embodiment and optional implementation, and this embodiment is not described herein again.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized in a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a memory device and executed by a computing device, and in some cases, the steps shown or described may be executed out of order, or separately as individual integrated circuit modules, or multiple modules or steps thereof may be implemented as a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A method of storing data, comprising:
when current service data is saved, acquiring a serial number configured for the current service data;
decomposing the number into a first integer number and a second integer number;
reading first data which takes the first integer number as an index and second data which takes the second integer number as an index in a first mapping bitmap, wherein the first data and the second data are used for positioning service data stored at the previous time;
and saving the first data and the second data.
2. The method of claim 1, wherein decomposing the number into a first reshaped number and a second reshaped number comprises:
performing a remainder operation on the number by using a preset parameter, wherein the result of the remainder operation is the first integer number X;
and performing a modular operation on the number by using the preset parameters, wherein the result of the modular operation is the second integer number Y.
3. The method of claim 2, wherein saving the first data and the second data comprises:
acquiring a value of an element Y in an array, and storing the first data into the element Y, wherein the value of the element Y after storage is (DataRdyTblX [ Y ] | FDMapTbl [ X ]), the DataRdyTblX [ Y ] is the acquired value of the element Y in the array DataRdyTblX, and the FDMapT [ X ] is the first data;
and acquiring a value of a register, and storing the second data to the register, wherein the value of the register after storage is (DataRdyGrpY | FDMapTbl [ Y ]), the DataRdyGrpY is the acquired value of the register, and the FDMapTbl [ Y ] is the second data.
4. A method for processing a data search request, comprising:
when a data search request is received, acquiring a register value of a register;
reading a second integer number from a second mapping bitmap table by taking the register value as an index;
reading a first integer number which takes the second integer number as an index in the array;
determining an index of the traffic data looked up by the data look-up request based on the first shaping number and the second shaping number.
5. The method of claim 4, wherein determining an index for traffic data sought by the data-lookup request based on the first shaping number and the second shaping number comprises:
determining an index S = X | of the traffic data (Y B) from the first and second shaping numbers X and Y, wherein B is the number of bits to right shift Y.
6. The method of claim 4 or 5, wherein after determining the index of the traffic data looked up by the data look-up request based on the first number of shapers and the second number of shapers, the method further comprises:
and searching the service data in a database for storing the service data through the index of the service data.
7. A data storage device, comprising:
the first acquisition unit is used for acquiring a serial number configured for the current service data when the current service data is stored;
the processing unit is used for decomposing the number into a first integer number and a second integer number;
the first reading unit is used for reading first data which takes the first integer number as an index and second data which takes the second integer number as an index in a first mapping bitmap, wherein the first data and the second data are used for positioning business data stored at the previous time;
a saving unit configured to save the first data and the second data.
8. The apparatus of claim 7, wherein the processing unit comprises:
the first processing module is used for executing a remainder operation on the number by using preset parameters, and the result of the remainder operation is the first integer number X;
and the second processing module is used for executing modular operation on the serial number by using the preset parameters, and the result of the modular operation is the second integer number Y.
9. The apparatus of claim 8, wherein the saving unit comprises:
the first saving module is used for acquiring a value of an element Y in an array and saving the first data to the element Y, wherein the value of the element Y after saving is (DataRdyTblX [ Y ] | FDMapTbl [ X ]), the DataRdyTblX [ Y ] is the acquired value of the element Y in the array DataRdyTblX, and the FDMapTbl [ X ] is the first data;
and a second saving module, configured to obtain a value of a register, and save the second data to the register, where the value of the saved register is (DataRdyGrpY | FDMapTbl [ Y ]), the DataRdyGrpY is the obtained value of the register, and the FDMapTbl [ Y ] is the second data.
10. A device for processing a data search request, comprising:
the second acquisition unit is used for acquiring the register value of the register when receiving the data search request;
the second reading unit is used for reading a second integer number from a second mapping bit chart by taking the register value as an index;
the third reading unit is used for reading the first integer number which takes the second integer number as an index in the array;
a determining unit, configured to determine an index of the service data searched by the data search request based on the first shaping number and the second shaping number.
11. The apparatus of claim 10, wherein the determining unit comprises:
and a determining module, configured to determine, from the first integer number X and the second integer number Y, an index S = X | (Y "B") associated with the service data, where B is a number of bits to which Y is right-shifted.
12. The apparatus of claim 10 or 11, further comprising:
and the searching unit is used for searching the service data in the database storing the service data through the index of the service data after determining the index of the service data searched by the data searching request based on the first shaping number and the second shaping number.
CN201610505350.2A 2016-06-30 2016-06-30 Data storage method and device, and data search request processing method and device Active CN107562743B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201610505350.2A CN107562743B (en) 2016-06-30 2016-06-30 Data storage method and device, and data search request processing method and device
PCT/CN2017/088071 WO2018001085A1 (en) 2016-06-30 2017-06-13 Data storage method and device, data lookup request processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610505350.2A CN107562743B (en) 2016-06-30 2016-06-30 Data storage method and device, and data search request processing method and device

Publications (2)

Publication Number Publication Date
CN107562743A CN107562743A (en) 2018-01-09
CN107562743B true CN107562743B (en) 2022-12-02

Family

ID=60785918

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610505350.2A Active CN107562743B (en) 2016-06-30 2016-06-30 Data storage method and device, and data search request processing method and device

Country Status (2)

Country Link
CN (1) CN107562743B (en)
WO (1) WO2018001085A1 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110825521B (en) * 2019-10-21 2022-11-25 新华三信息安全技术有限公司 Memory use management method and device and storage medium
CN110765133A (en) * 2019-10-24 2020-02-07 上海二三四五网络科技有限公司 Control method and device for distributing data table based on data remainder
CN111723113B (en) * 2020-06-19 2025-06-10 深圳前海微众银行股份有限公司 Distributed caching method and device for service data, terminal equipment and storage medium
CN111783378B (en) * 2020-06-30 2022-05-17 迈普通信技术股份有限公司 Data processing method and FPGA
CN112118262B (en) * 2020-09-21 2022-07-29 武汉中元华电科技股份有限公司 System and method for realizing data sorting and merging based on dynamic memory allocation
CN112506440A (en) * 2020-12-17 2021-03-16 杭州迪普信息技术有限公司 Data searching method and equipment based on dichotomy
CN113407577B (en) * 2021-06-29 2023-06-23 成都新潮传媒集团有限公司 Query method and device for kafka data and computer readable storage medium
CN115454354B (en) * 2022-10-19 2023-09-12 上海吉贝克信息技术有限公司 Data processing method, system, electronic device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1866218A (en) * 2005-12-22 2006-11-22 华为技术有限公司 Source management method for software system
CN101639851A (en) * 2009-08-03 2010-02-03 北京高森明晨信息科技有限公司 Method for storing and querying data and devices therefor
CN104298680A (en) * 2013-07-18 2015-01-21 腾讯科技(深圳)有限公司 Data statistic method and device
CN104794196A (en) * 2015-04-21 2015-07-22 浙江大学 Tree structure data collecting and updating method

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140297651A1 (en) * 2013-04-01 2014-10-02 Ori Software Development Ltd. Using hash table to retrieve leaf index blocks
CN104462141B (en) * 2013-09-24 2018-05-22 中国移动通信集团重庆有限公司 Method, system and the storage engines device of a kind of data storage and inquiry
KR102106538B1 (en) * 2013-10-08 2020-05-04 삼성전자주식회사 Apparatus and method for processing numeric calculation
US9390115B2 (en) * 2013-10-11 2016-07-12 Oracle International Corporation Tables with unlimited number of sparse columns and techniques for an efficient implementation
CN105426519B (en) * 2015-12-04 2018-12-14 河海大学 A kind of small-scale index datastore method for off-line search

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1866218A (en) * 2005-12-22 2006-11-22 华为技术有限公司 Source management method for software system
CN101639851A (en) * 2009-08-03 2010-02-03 北京高森明晨信息科技有限公司 Method for storing and querying data and devices therefor
CN104298680A (en) * 2013-07-18 2015-01-21 腾讯科技(深圳)有限公司 Data statistic method and device
CN104794196A (en) * 2015-04-21 2015-07-22 浙江大学 Tree structure data collecting and updating method

Also Published As

Publication number Publication date
WO2018001085A1 (en) 2018-01-04
CN107562743A (en) 2018-01-09

Similar Documents

Publication Publication Date Title
CN107562743B (en) Data storage method and device, and data search request processing method and device
CN107682466B (en) Method and device for searching regional information of IP address
CN108769111A (en) A kind of server connection method, computer readable storage medium and terminal device
CN109639579B (en) Multicast message processing method and device, storage medium and processor
CN105515997B (en) The higher efficiency range matching process of zero scope expansion is realized based on BF_TCAM
CN101594319A (en) Table item lookup method and device
CN112667640B (en) Routing address storage method and device
CN108108436B (en) Data storage method and device, storage medium and electronic equipment
CN108769967B (en) Service equipment discovery method based on Bluetooth GAP layer
CN104994185A (en) Method and apparatus for processing IP address database
CN111131049B (en) Method and device for processing routing table entry
CN107807976B (en) IP home location query method and device
CN106802927A (en) A kind of date storage method and querying method
CN112866011B (en) Method, device, equipment and medium for determining network topology structure
CN112182021B (en) User data query method, device and system
CN107943981A (en) HBase rows paging method, server and computer-readable recording medium
CN112822112B (en) Routing address storage method and device
CN112269784A (en) Hash table structure based on hardware realization and inserting, inquiring and deleting method
CN113986931B (en) Report paging method and device, storage medium and computing equipment
CN110751204A (en) Data fusion method and device, storage medium and electronic device
Boldt et al. SPARQL for networks of embedded systems
CN105634999A (en) Aging method and device for medium access control address
CN107592207B (en) Network management service data management method and network management service data management device
CN111385110B (en) Network management method and device
CN113420238A (en) Short link generation method, device, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant