WO2018161751A1 - Method and device for storing physical data table - Google Patents

Method and device for storing physical data table Download PDF

Info

Publication number
WO2018161751A1
WO2018161751A1 PCT/CN2018/075284 CN2018075284W WO2018161751A1 WO 2018161751 A1 WO2018161751 A1 WO 2018161751A1 CN 2018075284 W CN2018075284 W CN 2018075284W WO 2018161751 A1 WO2018161751 A1 WO 2018161751A1
Authority
WO
WIPO (PCT)
Prior art keywords
data table
entry
physical
logical
location
Prior art date
Application number
PCT/CN2018/075284
Other languages
French (fr)
Chinese (zh)
Inventor
袁赛
王小忠
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2018161751A1 publication Critical patent/WO2018161751A1/en

Links

Images

Classifications

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

Definitions

  • the present application relates to the field of storage technologies, and in particular, to a method and an apparatus for storing a physical data table.
  • processors are increasingly demanding physical storage space for data tables when storing data tables (such as hash tables or linear tables).
  • the processor can logically divide a hash table with a large physical storage space into a plurality of logical sub-tables (such as A1, A2, and A3 in FIG. 1).
  • A4) Perform storage and allocate physical storage space for each non-empty logical sub-table (for example, A1, A2, and A3 in FIG. 1) for storage.
  • the non-empty logical sub-table refers to the presence of at least one data item in the logical sub-table.
  • the distribution of data items in the hash table may be scattered. Even if a logical sub-table, such as A2 or A3 shown in Figure 1, has only one data item, it needs to be the entire logical sub-item.
  • the table allocates physical storage space. This wastes physical storage space.
  • the present application provides a method and apparatus for storing a physical data table, which can save physical storage space of a device storing a physical data table, thereby improving the usage rate of the physical storage space of the device.
  • a first aspect provides a method for storing a physical data table, the method comprising: acquiring a first data item of a first entry in a first logical data table, and using a first entry in the first logical data table The first data item is stored to the first location of the physical data table; and the first data item of the first entry in the second logical data table is obtained, and the first entry in the second logical data table is A data item is stored to a second location of the physical data table that is different from the first location.
  • the method for storing a physical data table may be a data item of an entry in a plurality of logical data tables (for example, the first logical data table and the second logical data table) (for example, in the first logical data table described above)
  • the first data item of the first entry and the first data entry of the first entry in the second logical data table are stored in one physical data table, so that only the entries in the multiple logical data tables may be
  • the data items existing in the data items that is, the data items stored in the physical data table described above
  • the method for storing a physical data table may further include: acquiring a first data item of a first entry in the third logical data table, and The first data item of the first entry in the third logical data table is stored to the third location of the physical data table.
  • the third location is located in a first entry in the physical data table, and the third location is different from the first location.
  • data items of entries in different logical data tables can be stored to the same entry in the physical data table.
  • the method for storing a physical data table may further include: acquiring a second data item of the first entry in the first logical data table, and The second data item of the first entry in the first logical data table is stored to the fourth location of the physical data table.
  • the fourth location is located in the first entry in the physical data table, and the fourth location is different from the first location and the third location.
  • all data items of the same entry in each logical data table may be stored in an entry in the physical data table that is the same as the sequence number of the entry.
  • the data item may be queried according to the mechanism of the existing query data item. For example, the data item may be found in the physical data table according to the entry in the logical data table to which the data item belongs. The table entry in which it is located, and then look up the data item in the table entry. That is to say, the method for storing the physical data table provided by the embodiment of the present invention does not need to modify the existing mechanism for querying the data item in the data table.
  • the method for storing the physical data table provided by the present application can save the physical storage space of the device storing the physical data table and improve the usage rate of the physical storage space of the device on the basis of the mechanism compatible with the existing query data item.
  • an apparatus for storing a physical data table comprising an acquisition unit and a storage unit.
  • the obtaining unit is configured to acquire a first data item of the first entry in the first logical data table, where the storage unit is configured to use the first data item of the first entry in the first logical data table acquired by the obtaining unit Store to the first location of the physical data table.
  • the obtaining unit is further configured to acquire a first data item of the first entry in the second logical data table, where the storage unit is further configured to use the first data item of the first entry in the second logical data table acquired by the obtaining unit Stored to a second location of the physical data table that is different from the first location.
  • the acquiring unit is further configured to acquire a first data item of the first entry in the third logical data table, where the storage unit is further configured to acquire the obtained data by the acquiring unit.
  • the first data item of the first entry in the third logical data table is stored to a third location of the physical data table.
  • the third location is located in a first entry in the physical data table, the third location being different from the first location.
  • the acquiring unit is further configured to acquire a second data item of the first entry in the first logical data table, where the storage unit is further configured to obtain the acquiring unit.
  • the second data item of the first entry in the first logical data table is stored to the fourth location of the physical data table.
  • the fourth location is located in a first entry in the physical data table, the fourth location being different from the first location and the third location.
  • the first location is located in a first entry in the physical data table
  • the second location is located in a second entry in the physical data table. That is, the first location and the second location are located in different entries in the physical data table.
  • the first location further includes a first identifier for identifying the first logical data table
  • the second location further stores a second logical data table for identifying the second logical data table.
  • the second logo
  • the foregoing first identifier for identifying the first logical data table and the second identifier for identifying the second logical data table are further stored in performing the storage provided by the present application.
  • a device of a method of physical data tables ie, a device that stores a physical data table.
  • the first identifier and the second identifier are stored in a memory, a central processing unit (CPU), or a network processor (NP) of the device.
  • the identifier of the first logical data table and the identifier of the second logical data table by storing the identifier of the first logical data table and the identifier of the second logical data table, different data items stored in the physical data table can be distinguished (the data items can be the same entry or different entries).
  • the logical data table to which it belongs by storing the identifier of the first logical data table and the identifier of the second logical data table, different data items stored in the physical data table can be distinguished (the data items can be the same entry or different entries).
  • the logical data table to which it belongs by storing the identifier of the first logical data table and the identifier of the second logical data table, different data items stored in the physical data table can be distinguished (the data items can be the same entry or different entries).
  • the third location may further include a third identifier for identifying the third logical data table, where the fourth location may further store a first identifier for identifying the first logical data table.
  • the present application if an entry in the physical data table is insufficient to store data items of the same number of entries in the plurality of logical data tables, the present application stores each data item in the plurality of logical data tables.
  • a plurality of physical data tables may be set or created, and each of the plurality of logical data tables is sequentially stored in a storage order to a corresponding one of the plurality of physical data tables.
  • an apparatus for storing a physical data table comprising a processor and a memory coupled to the processor.
  • the processor is configured to perform the method of storing a physical data table in the foregoing first aspect or any alternative implementation thereof, the memory being used to store the physical data table.
  • a computer readable storage medium comprising computer instructions that, when executed on a device storing a physical data table, cause the device to perform the first aspect or any one of the above A method of storing a physical data table in an alternative implementation.
  • any optional implementation manner of the second aspect, the technical effects of the third aspect and the fourth aspect, and other contents, refer to the foregoing technology for the first aspect and any of the alternative implementation manners.
  • the description of the effect and other content is not described here.
  • FIG. 1 is a schematic structural diagram of a data table provided by the prior art
  • FIG. 2 is a schematic structural diagram of a communication system according to an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of hardware of a router according to an embodiment of the present disclosure.
  • FIG. 4 is a first schematic diagram of a method for storing a physical data table according to an embodiment of the present invention
  • FIG. 5 is a schematic structural diagram of a first logical data table or a physical data table according to an embodiment of the present disclosure
  • FIG. 6 is a second schematic diagram of a method for storing a physical data table according to an embodiment of the present invention.
  • FIG. 7 is a third schematic diagram of a method for storing a physical data table according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic diagram of a data item in a storage logical data table according to an embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram 1 of an apparatus for storing a physical data table according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic structural diagram 2 of an apparatus for storing a physical data table according to an embodiment of the present invention.
  • first, second, and third are used to distinguish different objects, and are not intended to describe a particular order of the objects.
  • first data table, the second data table, the third data table, and the like are used to distinguish different data tables, rather than to describe a specific order of the data tables.
  • multiple logical data tables refer to two or more logical data tables
  • multiple local area networks refer to two or more local area networks.
  • the device for storing the physical data table may be a router, a switch, a workstation, or the like.
  • the router can be a wired router, a wireless router, or a distributed router.
  • the method for storing a physical data table can be applied to a router, a switch, or a workstation. It can be specifically applied to each processor in a router, switch or workstation. For example, a CPU in a router, switch, or workstation, a CPU in a main control board or interface board in a router, switch, or workstation, or an NP in a router, switch, or workstation.
  • FIG. 2 is a schematic structural diagram of a communication system applied to a method for storing a physical data table according to an embodiment of the present invention.
  • the communication system includes a core router 10 located in a core network, an edge router located in a plurality of local area networks (FIG. 2 with two edge routers, respectively, an edge router 20 and an edge router 21) and a plurality of The terminal device (FIG. 2 takes four terminal devices, which are the terminal device 30, the terminal device 31, the terminal device 32, and the terminal device 33 as examples).
  • the core router 10 is connected to the edge router 20 and the edge router 21, the edge router 20 is connected to the terminal device 30 and the terminal device 31, and the edge router 21 is connected to the terminal device 32 and the terminal device 33, respectively.
  • the terminal device 30 sends the data packet to the core router 10 via the edge router 20, and the core router 10 determines which port of the core router 10 is issued according to the data packet.
  • the data message is then forwarded by the core router 10 from the determined port to the terminal device 32 via the edge router 21.
  • the core router 10 In the process in which the terminal device 30 sends a data message to the terminal device 32, the core router 10, the edge router 20, and the edge router 21 can generate, receive, or transmit entries in the data table, the data table, or the data table.
  • the data items are forwarded to the respective next hop devices according to the entries in the data tables or the data items of the entries in the data table.
  • the devices shown in FIG. 2 can be connected by wireless.
  • the connection relationship between the devices in order to visually indicate the connection relationship between the devices, the connection relationship between the devices is indicated by a solid line.
  • the logical data table provided by the embodiment of the present invention may be a hash table, or may be a linear table, or may be any form of logical data table capable of using the method for storing a physical data table provided by the embodiment of the present invention.
  • the embodiment of the invention is not limited.
  • the device that stores the physical data table is a router, and the logical data table is a hash table.
  • the logical data table may be a media access control (MAC) table, a multicast routing table, or an address resolution protocol (address). Resolution protocol, ARP) table, etc.
  • the device that stores the physical data table is a router, and the logical data table is a linear table.
  • the logical data table can be a multi-protocol label switching (MPLS) table or a virtual local area network (VLAN) table. , sub-interface table or flow table.
  • MPLS multi-protocol label switching
  • VLAN virtual local area network
  • the above linear table generally needs to allocate a physical storage space for it in advance.
  • the port of the router or switch may not be used in the VLAN. Therefore, the VLAN table stored in the router or switch may not have an entry corresponding to the port. However, the physical storage space occupied by this entry usually needs to be allocated in advance.
  • the terminal device shown in FIG. 2 may be a mobile phone, a tablet computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA).
  • UMPC ultra-mobile personal computer
  • PDA personal digital assistant
  • the embodiment of the present invention is not limited according to the actual application scenario.
  • the configurations of the core router 10, the edge router 20, and the edge router 21 shown in FIG. 2 may be the same or different.
  • the following is an example of the structure of the core router 10, the edge router 20, and the edge router 21, and the hardware structure of the router provided by the embodiment of the present invention is introduced in conjunction with FIG.
  • the router provided by the embodiment of the present invention may include: a main control board 400, a switch fabric 401 connected to the main control board 400, and at least one interface board (FIG. 3 uses two interface boards, For example, the interface board 402a and the interface board 402b are respectively connected, and the switching network board 401 is connected to each interface board of at least one interface board.
  • the main control board 400 may include a CPU 400a.
  • the interface board 402a may include a CPU 403a, a memory 404a connected to the CPU 403a, an NP 405a, and a physical interface card 406a.
  • the interface board 402b may include a CPU 403b, a memory 404b connected to the CPU 403b, an NP 405b, and a physical interface card 406b.
  • the main control board 400 is used for overall control on the router.
  • the main control board 400 can control the interface board 402a (or the interface board 402b) to receive data packets from a device connected to the router, and control the data packets received by the switching network board 401 to the interface board 402a (or the interface board 402b).
  • the switching process is performed, and the control interface board 402b (or the interface board 402a) transmits the data message transmitted via the switching network board 401 to another device connected to the router.
  • the data packet can be sent from the interface board 402a after entering the switching network board 401 from the interface board 402a.
  • the switching network board 400 is configured to exchange data packets received by the interface board 402a or the interface board 402b.
  • the interface board 402a or the interface board 402b is configured to receive a data packet sent by a device connected to the router, and send the data packet to the switching network board 401, and send the data packet received from the switching network board 401 to the data packet.
  • the router described above is exemplified by the hardware structure of the router as shown in FIG.
  • the router may also include more or less components, and the function of the router may also include more or less functions, which are determined by actual use, and are not described in detail in the embodiments of the present invention.
  • the execution body of the method for storing the physical data table provided by the embodiment of the present invention may be the above-mentioned router, switch, workstation, or the like.
  • the execution entity may also be a CPU in the router, a CPU in the main control board or the interface board of the router, or an NP in the router, such as a CPU in the router shown in FIG. 3. 400a, CPU 403a, NP 405a, CPU 403b, or NP 405b.
  • the memory 404a or the memory 404b shown in FIG. 3 can be used to store the physical data table.
  • the memory 404a may also be integrated in the NP 405a, and the memory 404b may also be integrated in the NP 405b.
  • the memory 404a and the memory 404b may be static random access memory (SRAM).
  • the method for storing a physical data table provided by an embodiment of the present invention is described below by taking an execution host as a router.
  • an embodiment of the present invention provides a method for storing a physical data table, and the method may include S101-S104.
  • the router acquires a first data item of the first entry in the first logical data table.
  • the router in the communication process, since the router can implement the routing function, the router can automatically select and set the transmission path according to the condition of the transmission channel, and then send the communication data in order according to the optimal transmission path.
  • the router may need to store various data tables in the process of implementing routing. After the router stores the data table, the stored data table can be used directly in the subsequent communication process, such as a hash table or a linear table. Specifically, the router needs to store each data item in the hash table or the linear table.
  • FIG. 5 is a schematic structural diagram of a first logical data table according to an embodiment of the present invention.
  • 00-03 (labeled as entry 1 in FIG. 5)
  • 10-13 in FIG. 5 Marked as entry 2
  • 20-23 (labeled as entry 3 in Figure 5) are respectively an entry in the first logical data table.
  • entry 00-03 in the first logical data table Take the entry 00-03 in the first logical data table as an example.
  • 00, 01, 02, and 03 in the entry are the four data items of the entry.
  • the first data item of the first entry in the first logical data table may be generated by a router, or may be received by the router from another device, or may be received and calculated by the router from other devices. Generated. Specifically, it can be determined according to the actual use, and the embodiment of the present invention is not limited.
  • the first data item of the first entry in the first logical data table may include an identifier of the first entry to which the first data item belongs.
  • the identifier may be a key value of the first entry calculated by the router. Taking the first data item of the first entry in the first logical data table as a MAC address as an example, when the router obtains a new MAC address, the router can perform hash calculation on the MAC address to obtain a hash value.
  • a logical data table can be understood as some data items that are logically stored, and these data items have a certain logical relationship.
  • the logical data table can be some data items stored in the router's CPU or memory. It can be understood that the above first logical data table can be stored in the CPU or the memory of the router.
  • the router stores the first data item of the first entry in the first logical data table to the first location of the physical data table.
  • the physical data table can be understood as a data table physically stored.
  • the physical data table can be stored in a memory in the interface board of the router (which can be integrated in the NP in the interface board), such as an SRAM with higher performance and smaller capacity.
  • the first logical data table includes the entry 1, the entry 2, and the entry 3.
  • the physical data table includes the entry 1, the entry 2, and the entry 3.
  • the method for storing the physical data table may store each data item of the entry 1 in the first logical data table to each position of the entry 1 in the physical data table, and the entry 2 in the first logical data table
  • the respective data items are stored to respective locations of the entry 2 in the physical data table
  • the respective data items of the entry 3 in the first logical data table are stored to respective locations of the entry 3 in the physical data table.
  • the entry 1, the entry 2, and the entry 3 in the first logical data table are sequentially arranged, for example, the entry 1, the entry 2, and the entry in the first logical data table.
  • 3 is the first, second, and third entries in the first logical data table, respectively, and the entries 1, 2, and 3 in the physical data table are also sequentially arranged, for example, physical data.
  • Table 1, Table 2, and Table 3 in the table are the first, second, and third entries in the physical data table, respectively.
  • the entry 1 in the logical data table and the entry 1 in the physical data table refer to two entries with the same sequence number, and the entry 2 and the physical data table in the logical data table.
  • the entry 2 refers to two entries with the same sequence number.
  • the entry 3 in the logical data table and the entry 3 in the physical data table refer to two entries with the same sequence number.
  • the label of the entry (such as "1" in the entry 1 or “2” in the entry 2 or “3” in the entry 3) may be used to indicate the entry in the data table.
  • An entry with the same label in different data tables refers to an entry with the same sequence number in different data tables.
  • the entry in the first logical data table, the entry 1 in the second logical data table, and the entry 1 in the physical data table refer to the arrangement in the first logical data table, the second logical data table, and the physical data table. The same number of entries.
  • the description of the arrangement number of the entry in the logical data table and the entry in the physical data table also applies to the entries in the two logical data tables.
  • the entry 1 in the first logical data table and the entry 1 in the second logical data table refer to two entries having the same sequence number.
  • the entry 1 in the second logical data table and the entry 1 in the physical data table also refer to two entries with the same sequence number.
  • the data items of the items with the same sequence number in the plurality of logical data tables may be stored in the physical data table in the physical data table and the same as the arrangement number of the entries. in.
  • each data item of the entry 1 in the first logical data table and each data item of the entry 1 in the second logical data table may be stored to respective locations of the entry 1 in the physical data table.
  • the logical data table (including the first logical data table, the second logical data table and the third logical data table described below) and the physical data table have the same structure, and the logical data table The order of the items in the table and the order of the items in the physical data table are also the same.
  • the first logical data table, the second logical data table described below, the third logical data table and the physical data table described below may each have a structure as shown in FIG. 5.
  • the router acquires a first data item of the first entry in the second logical data table.
  • the identifier of the first entry in the first logical data table and the identifier of the first entry in the second logical data table may be the same or different.
  • the identifier of the first entry in the first logical data table is key1, and the identifier of the first entry in the second logical data table may also be key1; or the first entry in the first logical data table
  • the identifier is key1, and the identifier of the first entry in the second logical data table may be key2.
  • the router stores the first data item of the first entry in the second logical data table to the second location of the physical data table.
  • the second location is different from the first location. That is, the second location in the physical data table and the first location in the physical data table are two different locations in the physical data table.
  • the first location may be located in a first entry in the physical data table
  • the second location may be located in a second entry in the physical data table.
  • FIG. 5 is a schematic structural diagram of a physical data table according to an embodiment of the present invention.
  • the first location may be a location indicated by 00 in the physical data table as shown in FIG. 5, and the second location may be The position indicated by 10 in the physical data table shown in FIG.
  • the embodiment of the present invention if a certain item in the physical data table is insufficient to store the data items of the items having the same sequence number in the plurality of logical data tables, the embodiment of the present invention stores the plurality of logical data tables. For each data item, a plurality of physical data tables may be set or created, and each of the plurality of logical data tables is sequentially stored in a corresponding physical data table of the plurality of physical data tables in a storage order.
  • the entry 1 in the physical data table (for example, the entry 1 shown in FIG. 5) is insufficient to store all the data items of the entry 1 in the first logical data table and the table in the second logical data table.
  • the plurality of physical data tables may be set or created, and the first logical data is Each data item in the table and each data item in the second data table are sequentially stored in a storage order to a corresponding physical data table in the plurality of physical data tables.
  • the embodiment of the present invention may store each data item in the multiple logical data tables by using the following two possible implementation manners.
  • a possible implementation manner is that, in the embodiment of the present invention, after all the entries in one physical data table store the data item, and the other physical data table is the same as the sequence number of the entry. And storing, in the plurality of logical data tables, the data items that are not stored in the table with the same sequence number as the table item.
  • the router may store the data item after all the entries 1 in one physical data table, and then store the data that is not stored in the entry 1 of the first logical data table in the entry 1 of the other physical data table. The item and the data item not yet stored in the entry 1 in the second logical data table.
  • Another possible implementation manner is that, after the data item is stored in an item in a physical data table, the physical data table belongs to the same logical data table and is located in each table. All data items in the item are moved to respective items in another physical data table.
  • the data item in the physical data table is searched for, and the data item is searched in the plurality of physical data tables. In this way, the efficiency of finding data items in the physical data table can be improved.
  • the embodiment of the present invention may not limit the execution order between S102 and S103.
  • S103 may be executed first after S102, or S102 may be executed after S103, and S102 and S103 may be simultaneously executed.
  • the method for storing a physical data table may further include the following S105-S106:
  • the router acquires a first data item of the first entry in the third logical data table.
  • the router stores the first data item of the first entry in the third logical data table to a third location of the physical data table.
  • FIG. 5 is a schematic structural diagram of a physical data table according to an embodiment of the present invention.
  • the first location may be a location indicated by 00 in the physical data table as shown in FIG. 5, where The third position may be a position indicated by 01 in the physical data table as shown in FIG.
  • the execution order between the steps S101, S102, S103, S104, S105, S106 only defines S101 before S102, S103 before S104, S105 before S106, and does not perform the execution sequence between the remaining steps.
  • S105-S106 may be executed first and then S105-S106 may be executed, or S105-S106 may be executed first, then S103-S104 may be executed, and S103-S104 and S105-S106 may be simultaneously executed.
  • it may be determined according to the storage order of the first data item of the first entry in the second logical data table and the first data entry of the first entry in the third logical data table, which is not limited by the embodiment of the present invention.
  • S105 may be executed first after S104 is executed, or S104 may be executed after S105 is executed first, and S104 and S105 may be simultaneously executed.
  • FIG. 6 is exemplified by S105-S106 being executed after S103-S104 as an example.
  • the method for storing a physical data table may further include the following S107-S108:
  • the router acquires a second data item of the first entry in the first logical data table.
  • the router stores the second data item of the first entry in the first logical data table to a fourth location of the physical data table.
  • FIG. 5 is a schematic structural diagram of a physical data table according to an embodiment of the present invention.
  • the first location may be a location indicated by 00 in the physical data table as shown in FIG. 5, where
  • the third position may be a position indicated by 01 in the physical data table as shown in FIG.
  • the fourth position may be a position indicated by 02 in the physical data table as shown in FIG.
  • the execution order between the steps S101, S102, S103, S104, S105, S106, S107 and S108 only defines S101 before S102, S103 before S104, S105 before S106, S107 before S108,
  • the order of execution between the remaining steps is not limited.
  • the embodiment of the present invention may not limit the execution order between S103-S104, S105-S106, and S107-S108.
  • the first data item of the first entry in the second logical data table, the first data item of the first entry in the third logical data table, and the first entry in the first logical data table may be The storage order of the second data item is determined, which is not limited in the embodiment of the present invention.
  • the embodiment of the present invention may not limit the execution order between S106 and S107.
  • S107 may be executed first after S106, or S106 may be executed after S107, and S106 and S107 may be simultaneously executed.
  • FIG. 7 is exemplified by S105-S106 being executed after S103-S104 and S107-S108 being executed after S105-S106.
  • each data item in the plurality of logical data tables to be stored is a respective address (for example, may be a MAC address or an Internet Protocol (IP) address, or may be a key value obtained by hashing each address, and the like).
  • the table A in FIG. 8 represents a first logical data table provided by an embodiment of the present invention, and the first logical data table includes some addresses.
  • Table B in Figure 8 shows a second logical data table provided by an embodiment of the present invention, and the second logical data table includes other addresses.
  • Table C in Figure 8 shows a third logical data table provided by an embodiment of the present invention, and the third logical data table includes further addresses.
  • Table D in Fig. 8 shows a physical data table provided by an embodiment of the present invention.
  • each entry in Table A is represented by an abscissa 0-3 in FIG. 8 (for example, 0 indicates an entry 0 in Table A, and 1 indicates a table in Table A.
  • Item 1 represents the entry 2 in the table A
  • 3 represents the entry 3) in the table A
  • each of the entries in the table A is represented by each intersection of the abscissa 0-3 and the ordinate 0-3.
  • data item For Table B, each entry in Table B is represented by the abscissa 0-3 in FIG. 8 (for example, 0 represents the entry 0 in the table B, 1 represents the entry 1 in the table B, and 2 represents the table in the table B.
  • the item 2, 3 represents the entry 3) in the table B, and the respective data items of the respective entries in the table B are represented by respective intersections of the abscissas 0-3 and the ordinates 0-3.
  • each entry in Table C is represented by the abscissa 0-3 in FIG. 8 (for example, 0 indicates the entry 0 in the table C, 1 indicates the entry 1 in the table C, and 2 indicates the table in the table C.
  • the item 2, 3 represents the entry 3) in the table C, and the respective data items of the respective entries in the table C are represented by respective intersections of the abscissas 0-3 and the ordinates 0-3.
  • the individual entries in the table D are represented by the abscissas 0-3 in FIG. 8 (for example, 0 represents the table entry 0 in the table D, 1 represents the table entry 1 in the table D, and 2 represents the table in the table D.
  • the item 2, 3 represents the entry 3) in the table D, and the respective data items of the respective entries in the table D are represented by respective intersections of the abscissas 0-3 and the ordinates 0-3.
  • the first entry in the first logical data table provided by the embodiment of the present invention is the entry 0 in the table A
  • the first data entry in the first entry in the first logical data table is The first data item of the entry 0 in the table A, and the data item is the address 1
  • the second data item of the first entry in the first logical data table is the second of the entry 0 in the table A a data item, and the data item is address 2
  • the first entry in the second logical data table is the entry 1 in the table B
  • the first data entry in the first entry in the second logical data table is the table B
  • the first data item of the entry 1 in the table, and the data item is the address 3
  • the first entry in the third logical data table is the entry 0 in the table C
  • the first table in the third logical data table The first data item of the entry is the first data entry of entry 0 in table C, and the data entry is address 4.
  • the router may first obtain the address 1 of the entry 0 in the table A (ie, the abscissa 0 and the ordinate 0 in the table A).
  • the data item represented by the intersection 00 can be understood as the first data item of the first entry in the first logical data table provided by the embodiment of the present invention, and then the address 1 is stored in the entry 0 of the table D.
  • the first position (for example, the position indicated by the intersection 00 of the abscissa 0 and the ordinate 0 in Table D).
  • the router can continue to obtain the data item represented by the address 3 of the entry 1 in the table B (ie, the intersection of the abscissa 1 and the ordinate 0 in the table B, which can be understood as the second logical data table provided by the embodiment of the present invention.
  • the first data item of the first entry and then store the address 3 to the second position of the entry 1 in the table D (for example, the position indicated by the intersection 10 of the abscissa 1 and the ordinate 0 in the table D) .
  • the router can continue to obtain the data item 4 of the entry 0 of the table C in the table C (ie, the data item represented by the intersection 00 of the abscissa 0 and the ordinate 0 in the table C, which can be understood as the third logical data table provided by the embodiment of the present invention.
  • the first data item of the first entry and then store the address 4 to the third position of the entry 0 in the table D (for example, the position indicated by the intersection 01 of the abscissa 0 and the ordinate 1 in the table D) .
  • the router can continue to obtain the address 2 of the entry 0 of the table A in the table A (ie, the data item represented by the intersection 01 of the abscissa 0 and the ordinate 1 in the table A, which can be understood as the first logical data table provided by the embodiment of the present invention.
  • the second data item of the first entry and then store the address 2 to the fourth position of the entry 0 in the table D (for example, the position indicated by the intersection 02 of the abscissa 0 and the ordinate 2 in the table D) .
  • the router can store all the addresses in Table A, Table B, and Table C (that is, all the data items of all the entries in all the logical data tables that can be understood as the embodiments of the present invention) into Table D. .
  • an entry in the physical data table may be stored in different logical data tables.
  • the data item (for example, the entry 0 in the table D shown in FIG. 8 stores the data item in the table A and the data item in the table C), so in order to distinguish which logical data belongs to a certain data item in the physical data table
  • the embodiment of the present invention may also store an identifier of a logical data table to which the data item belongs.
  • the first, second, third, and fourth locations further include a first identifier, a second identifier, a third identifier, and the first identifier, respectively.
  • the first, second, and third identifiers may be used to identify the first logical data table, the second logical data table, and the third logical data table, respectively.
  • the intersection 00 of the abscissa 0 and the ordinate 0 in the entry 0 may store "1 address 1" (where the "1" of the 1st bit identifies "address 1" belongs to the table A.
  • the intersection 01 of the abscissa 0 and the ordinate 1 in the entry 0 can store "2 address 4" (where the "2" flag of the 1st bit "address 4" belongs to the table C), and the abscissa 0 of the entry 0
  • the intersection 02 of the ordinate 2 can store "1 address 2" (where the "1" of the 1st bit identifies "Address 2" belongs to the table A)
  • the intersection 10 of the abscissa 1 and the ordinate 0 in the entry 1 can be Store "3 address 3" (where the "3" of the 1st bit identifies "Address 3" belongs to Table B).
  • the identifier of the logical data table to which each data item of each entry in the physical data table belongs may also be stored in the CPU or NP of the router.
  • the logical data and/or software may record the logical data table to which the certain data item stored in the physical data table belongs.
  • the identifier of the logical data table to which each data item of each entry in the physical data table belongs may be stored in a CPU or an NP of the router (for example, the memory is integrated in the CPU or the NP) Case) can also be stored outside the CPU or NP of the router (for example, when the memory is set outside the CPU or NP).
  • the first identifier may be any identifier that can uniquely identify the first logical data table.
  • the first identifier may be a number, a sequence or a variable, and the like, which is not limited in the embodiment of the present invention.
  • the second identifier may be any identifier that can uniquely identify the second logical data table
  • the third identifier may be any identifier that can uniquely identify the third logical data table.
  • the second identifier and the third identifier refer to the related description of the specific implementation of the first identifier, and details are not described herein again.
  • the data item in the plurality of logical data tables to be stored is used as an example, and the data items in the plurality of logical data tables are stored in the physical data table by using the method for storing the physical data table provided by the embodiment of the present invention. Then, in order to not modify the existing mechanism for querying the data item in the physical data table, when the data item in the plurality of logical data tables is stored by using the method for storing the physical data table provided by the embodiment of the present invention, The data items in the same table in the same logical data table are stored in the same table item in the physical data table (for example, the physical data table may be the same as the order number of the item in the logical data table) Table entry). When the data item is queried, the entry of the data item in the physical data table may be found according to the identifier of the entry in the logical data table to which the data item belongs, and then the data item is searched for in the entry. .
  • the method for storing a physical data table provided by the embodiment of the present invention, because a data item of an entry in a plurality of logical data tables (for example, the first logical data table and the second logical data table) may be used (for example, the first logical data described above)
  • the first data item of the first entry in the table and the first data item of the first entry in the second logical data table are stored in one physical data table, and thus may be only in the plurality of logical data tables
  • the data items existing in the entry that is, the data items stored in the physical data table described above) allocate physical storage space without allocating physical storage space for the entire logical data table, thereby saving physical storage space of the device storing the physical data table. , thereby increasing the utilization rate of the physical storage space of the device.
  • the method for storing a physical data table provided by the embodiment of the present invention can save the physical storage space of the device storing the physical data table and improve the usage rate of the physical storage space of the device on the basis of the mechanism compatible with the existing query data item.
  • the foregoing embodiment mainly introduces the solution provided by the embodiment of the present invention from the perspective of a router that stores the physical data table.
  • the apparatus for storing physical data tables and the like provided by the embodiments of the present invention include hardware structures and/or software modules corresponding to the execution of the respective functions in order to implement the above functions.
  • the embodiments of the present invention can be implemented in a combination of hardware or hardware and computer software in combination with the elements and algorithm steps of the various examples described in the embodiments disclosed herein. Whether a function is implemented in hardware or computer software to drive hardware depends on the specific application and design constraints of the solution. A person skilled in the art can implement the described functions using different methods for each particular application, but such implementation should not be considered to be beyond the scope of the present application.
  • the embodiment of the present invention may perform the division of the function modules on the device or the like that stores the physical data table according to the above method.
  • each functional module can be divided for each function.
  • the division of the module in the embodiment of the present invention is schematic, and is only a logical function division, and the actual implementation may have another division manner.
  • FIG. 9 is a schematic diagram showing a possible structure of an apparatus for storing a physical data table according to an embodiment of the present invention.
  • the apparatus may include an acquisition unit 50 and a storage unit 51.
  • the obtaining unit 50 may be configured to support the apparatus to perform S101, S103, S105, and S107 performed by the router in the foregoing method embodiment;
  • the storage unit 51 may be configured to support the apparatus to execute S102, S104, S106 performed by the router in the foregoing method embodiment.
  • All the related content of the steps involved in the foregoing method embodiments may be referred to the functional descriptions of the corresponding functional modules, and details are not described herein again.
  • FIG. 10 is a schematic diagram showing a possible structure of an apparatus for storing a physical data table according to an embodiment of the present invention.
  • the apparatus can include a processor 60 and a memory 61.
  • the device may also include a communication interface 62.
  • the apparatus may further include a memory 63 (which may be a general memory commonly used in the apparatus, such as a synchronous dynamic random access memory (SDRAM), etc.).
  • SDRAM synchronous dynamic random access memory
  • the processor 60 can be used to control and manage the actions of the device.
  • the processor 60 can be used to support the device to perform S101, S103, S105, and S107 performed by the router in the foregoing method embodiment, and/or used in this document. Other processes of the described technology.
  • the memory 61 can be used to store a physical data table provided by an embodiment of the present invention, and the memory can be an SRAM memory.
  • Communication interface 62 is used to support communication of the device with other network entities, for example, communication interface 62 can be used to support the device to interact with the terminal device.
  • the memory 63 can be used to store program code for execution by the apparatus, for example, the memory 63 can be used to support the apparatus to perform S102, S104, S106, and S108 performed by the routers in the above method embodiments, and/or for the techniques described herein. Other processes.
  • the processor 60 can be a CPU, a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), or a field programmable gate array (FPGA). Or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It is possible to implement or carry out the various illustrative logical blocks, modules and circuits described in connection with the embodiments of the invention.
  • the above processors may also be a combination of computing functions, such as one or more microprocessor combinations, a combination of a DSP and a microprocessor, and the like.
  • the processor 60 may be the CPU 400a, the CPU 403a, the NP 405a, the CPU 403b, or the NP 405b as shown in FIG.
  • the memory 61 may be the memory 404a or the memory 404b in the router shown in FIG. 3 described above.
  • the memory 63 may be a normal memory (not shown in FIG. 3) in the above-described router as shown in FIG.
  • Communication interface 62 can be a physical interface card, a transceiver circuit, or a communication interface.
  • the communication interface 62 can be the physical interface card 406a or the physical interface card 406b as described above in FIG.
  • the processor 60, the memory 61, the communication interface 62, and the memory 63 can be connected by a bus.
  • the bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the bus can be divided into an address bus, a data bus, a control bus, and the like.
  • the above embodiments it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof.
  • a software program it may be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the processes or functions in accordance with embodiments of the present invention are generated in whole or in part.
  • the computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • the computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be wired from a website site, computer, server or data center (for example, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (eg infrared, wireless, microwave, etc.) to another website, computer, server or data center.
  • the computer readable storage medium can be any available media that can be accessed by a computer or a data storage device such as a server, data center, or the like that includes one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a magnetic disk, a magnetic tape), an optical medium (for example, a digital video disc (DVD)), or a semiconductor medium (such as a solid state drives (SSD)).
  • a magnetic medium for example, a floppy disk, a magnetic disk, a magnetic tape
  • an optical medium for example, a digital video disc (DVD)
  • a semiconductor medium such as a solid state drives (SSD)
  • the disclosed system, apparatus, and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the modules or units is only a logical function division.
  • there may be another division manner for example, multiple units or components may be used. Combinations can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e., may be located in one place, or may be distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

Abstract

A method and device for storing a physical data table, related to the technical field of storage, capable of freeing up the physical storage space used to store a physical data table of a device, enhancing the utilization rate of the physical storage space of the device. The method comprises: acquiring a first data entry of a first item in a first logical data table (S101); storing the first data entry of the first item in the first logical data table to a first position in a physical data table (S102); acquiring a first data entry of a first item in a second logical data table (S103); and storing the first data entry of the first item in the second logical data table to a second position different from the first position in the physical data table (S104).

Description

一种存储物理数据表的方法及装置Method and device for storing physical data table
本申请要求于2017年3月8日提交中国专利局、申请号为201710134672.5、申请名称为“一种存储物理数据表的方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. JP-A No. No. No. No. No. No. No. No. No. No. No. No. No. No. In this application.
技术领域Technical field
本申请涉及存储技术领域,尤其涉及一种存储物理数据表的方法及装置。The present application relates to the field of storage technologies, and in particular, to a method and an apparatus for storing a physical data table.
背景技术Background technique
随着网络的不断发展,处理器在存储数据表(例如哈希表或者线性表等)时,对数据表的物理存储空间的需求越来越高。As the network continues to evolve, processors are increasingly demanding physical storage space for data tables when storing data tables (such as hash tables or linear tables).
以哈希表为例,如图1所示,处理器可以将一个所需物理存储空间较大的哈希表在逻辑上划分成多个逻辑子表(如图1中A1、A2、A3和A4)进行存储,并为每个非空的逻辑子表(例如图1中的A1、A2和A3)分别分配物理存储空间进行存储。其中,非空的逻辑子表是指逻辑子表中存在至少一个数据项。Taking a hash table as an example, as shown in FIG. 1, the processor can logically divide a hash table with a large physical storage space into a plurality of logical sub-tables (such as A1, A2, and A3 in FIG. 1). A4) Perform storage and allocate physical storage space for each non-empty logical sub-table (for example, A1, A2, and A3 in FIG. 1) for storage. Wherein, the non-empty logical sub-table refers to the presence of at least one data item in the logical sub-table.
然而,由于哈希表的随机性,哈希表中数据项的分布可能比较分散,即使某个逻辑子表,例如图1所示的A2或者A3中只有一个数据项,也需要为整个逻辑子表分配物理存储空间。如此浪费了物理存储空间。However, due to the randomness of the hash table, the distribution of data items in the hash table may be scattered. Even if a logical sub-table, such as A2 or A3 shown in Figure 1, has only one data item, it needs to be the entire logical sub-item. The table allocates physical storage space. This wastes physical storage space.
发明内容Summary of the invention
本申请提供一种存储物理数据表的方法及装置,能够节省存储物理数据表的设备的物理存储空间,从而提高该设备的物理存储空间的使用率。The present application provides a method and apparatus for storing a physical data table, which can save physical storage space of a device storing a physical data table, thereby improving the usage rate of the physical storage space of the device.
为达到上述目的,本申请采用如下技术方案:To achieve the above objectives, the present application adopts the following technical solutions:
第一方面,提供一种存储物理数据表的方法,该方法包括:获取第一逻辑数据表中的第一表项的第一数据项,并将该第一逻辑数据表中的第一表项的第一数据项存储至物理数据表的第一位置;以及获取第二逻辑数据表中的第一表项的第一数据项,并将该第二逻辑数据表中的第一表项的第一数据项存储至该物理数据表的不同于该第一位置的第二位置。A first aspect provides a method for storing a physical data table, the method comprising: acquiring a first data item of a first entry in a first logical data table, and using a first entry in the first logical data table The first data item is stored to the first location of the physical data table; and the first data item of the first entry in the second logical data table is obtained, and the first entry in the second logical data table is A data item is stored to a second location of the physical data table that is different from the first location.
本申请提供的存储物理数据表的方法,由于可以将多个逻辑数据表(例如上述第一逻辑数据表和第二逻辑数据表)中的表项的数据项(例如上述第一逻辑数据表中的第一表项的第一数据项和第二逻辑数据表中的第一表项的第一数据项)存储到一个物理数据表中,因此可以只为该多个逻辑数据表中的表项中存在的数据项(即上述存储至物理数据表中的数据项)分配物理存储空间,而无需为整个逻辑数据表分配物理存储空间,从而能够节省存储物理数据表的设备的物理存储空间,进而提高该设备的物理存储空间的使用率。The method for storing a physical data table provided by the present application may be a data item of an entry in a plurality of logical data tables (for example, the first logical data table and the second logical data table) (for example, in the first logical data table described above) The first data item of the first entry and the first data entry of the first entry in the second logical data table are stored in one physical data table, so that only the entries in the multiple logical data tables may be The data items existing in the data items (that is, the data items stored in the physical data table described above) allocate physical storage space without allocating physical storage space for the entire logical data table, thereby saving physical storage space of the device storing the physical data table, and further Increase the usage of the device's physical storage space.
在第一方面的第一种可选的实现方式中,本申请提供的存储物理数据表的方法还可以包括:获取第三逻辑数据表中的第一表项的第一数据项,并将该第三逻辑数据表中的第一表项的第一数据项存储至上述物理数据表的第三位置。其中,该第三位置位于该物理数据表中的第一表项,该第三位置不同于该第一位置。如此,可以将不同逻辑数据表(例如第一逻辑数据表和第三逻辑数据表)中的表项的数据项存储至物理数据表中的同一表项。In a first optional implementation manner of the first aspect, the method for storing a physical data table provided by the present application may further include: acquiring a first data item of a first entry in the third logical data table, and The first data item of the first entry in the third logical data table is stored to the third location of the physical data table. The third location is located in a first entry in the physical data table, and the third location is different from the first location. As such, data items of entries in different logical data tables (eg, the first logical data table and the third logical data table) can be stored to the same entry in the physical data table.
在第一方面的第二种可选的实现方式中,本申请提供的存储物理数据表的方法还可以包括:获取上述第一逻辑数据表中的第一表项的第二数据项,并将该第一逻辑数据表中的第一表项的第二数据项存储至上述物理数据表的第四位置。其中,该第四位置位于该物理数据表中的第一表项,该第四位置不同于上述第一位置和上述第三位置。如此,可以将同一逻辑数据表中的同一表项的不同数据项存储至物理数据表中的同一表项,即物理数据表中的一个表项可以用于存储同一逻辑数据表中的同一表项的不同数据项。In a second optional implementation manner of the first aspect, the method for storing a physical data table provided by the present application may further include: acquiring a second data item of the first entry in the first logical data table, and The second data item of the first entry in the first logical data table is stored to the fourth location of the physical data table. The fourth location is located in the first entry in the physical data table, and the fourth location is different from the first location and the third location. In this way, different data items of the same entry in the same logical data table can be stored in the same entry in the physical data table, that is, one entry in the physical data table can be used to store the same entry in the same logical data table. Different data items.
通过第一方面的第二种可选的实现方式,可以使得每个逻辑数据表中的同一表项的所有数据项均存储至物理数据表中与该表项的排列序号相同的表项,如此,在查询某个数据项时,可以按照现有的查询数据项的机制查询该数据项,例如可以根据该数据项在其所属的逻辑数据表中的表项查找到该数据项在物理数据表中所在的表项,然后再在该表项中查找该数据项。也就是说,采用本发明实施例提供的存储物理数据表的方法,可以无需修改现有的在数据表中查询数据项的机制。With the second optional implementation of the first aspect, all data items of the same entry in each logical data table may be stored in an entry in the physical data table that is the same as the sequence number of the entry. When querying a data item, the data item may be queried according to the mechanism of the existing query data item. For example, the data item may be found in the physical data table according to the entry in the logical data table to which the data item belongs. The table entry in which it is located, and then look up the data item in the table entry. That is to say, the method for storing the physical data table provided by the embodiment of the present invention does not need to modify the existing mechanism for querying the data item in the data table.
如此,本申请提供的存储物理数据表的方法,可以在兼容现有查询数据项的机制的基础上,节省存储物理数据表的设备的物理存储空间,提高该设备的物理存储空间的使用率。As such, the method for storing the physical data table provided by the present application can save the physical storage space of the device storing the physical data table and improve the usage rate of the physical storage space of the device on the basis of the mechanism compatible with the existing query data item.
第二方面,提供一种存储物理数据表的装置,该装置包括获取单元和存储单元。其中,获取单元用于获取第一逻辑数据表中的第一表项的第一数据项;存储单元用于将获取单元获取的该第一逻辑数据表中的第一表项的第一数据项存储至物理数据表的第一位置。获取单元还用于获取第二逻辑数据表中的第一表项的第一数据项;存储单元还用于将获取单元获取的该第二逻辑数据表中的第一表项的第一数据项存储至该物理数据表的不同于该第一位置的第二位置。In a second aspect, an apparatus for storing a physical data table is provided, the apparatus comprising an acquisition unit and a storage unit. The obtaining unit is configured to acquire a first data item of the first entry in the first logical data table, where the storage unit is configured to use the first data item of the first entry in the first logical data table acquired by the obtaining unit Store to the first location of the physical data table. The obtaining unit is further configured to acquire a first data item of the first entry in the second logical data table, where the storage unit is further configured to use the first data item of the first entry in the second logical data table acquired by the obtaining unit Stored to a second location of the physical data table that is different from the first location.
在第二方面的第一种可选的实现方式中,上述获取单元还用于获取第三逻辑数据表中的第一表项的第一数据项;上述存储单元还用于将获取单元获取的该第三逻辑数据表中的第一表项的第一数据项存储至该物理数据表的第三位置。该第三位置位于该物理数据表中的第一表项,该第三位置不同于上述第一位置。In a first optional implementation manner of the second aspect, the acquiring unit is further configured to acquire a first data item of the first entry in the third logical data table, where the storage unit is further configured to acquire the obtained data by the acquiring unit. The first data item of the first entry in the third logical data table is stored to a third location of the physical data table. The third location is located in a first entry in the physical data table, the third location being different from the first location.
在第二方面的第二种可选的实现方式中,上述获取单元还用于获取上述第一逻辑数据表中的第一表项的第二数据项;上述存储单元还用于将获取单元获取的该第一逻辑数据表中的第一表项的第二数据项存储至该物理数据表的第四位置。该第四位置位于该物理数据表中的第一表项,该第四位置不同于上述第一位置和上述第三位置。In a second optional implementation manner of the second aspect, the acquiring unit is further configured to acquire a second data item of the first entry in the first logical data table, where the storage unit is further configured to obtain the acquiring unit. The second data item of the first entry in the first logical data table is stored to the fourth location of the physical data table. The fourth location is located in a first entry in the physical data table, the fourth location being different from the first location and the third location.
可选地,在上述第一方面和第二方面中,上述第一位置位于上述物理数据表中的第一表项,上述第二位置位于该物理数据表中的第二表项。即该第一位置和该第二位置位于该物理数据表中的不同表项。Optionally, in the first aspect and the second aspect, the first location is located in a first entry in the physical data table, and the second location is located in a second entry in the physical data table. That is, the first location and the second location are located in different entries in the physical data table.
可选地,在上述第一方面和第二方面中,上述第一位置还存储有用于标识上述第一逻辑数据表的第一标识;上述第二位置还存储有用于标识上述第二逻辑数据表的第二标识。Optionally, in the foregoing first aspect and the second aspect, the first location further includes a first identifier for identifying the first logical data table, and the second location further stores a second logical data table for identifying the second logical data table. The second logo.
可选地,在上述第一方面和第二方面中,上述用于标识第一逻辑数据表的第一标识和用于标识第二逻辑数据表的第二标识还存储于执行本申请提供的存储物理数据表的方法的装置(即存储物理数据表的装置)中。可选地,该第一标识和第二标识存储于该装置的存储器、中央处理器(central processing unit,CPU)或网络处理器(network processor,NP)中。Optionally, in the foregoing first aspect and the second aspect, the foregoing first identifier for identifying the first logical data table and the second identifier for identifying the second logical data table are further stored in performing the storage provided by the present application. A device of a method of physical data tables (ie, a device that stores a physical data table). Optionally, the first identifier and the second identifier are stored in a memory, a central processing unit (CPU), or a network processor (NP) of the device.
本申请中,通过存储第一逻辑数据表的标识和第二逻辑数据表的标识,能够区分物理数据表中存储的不同数据项(这些数据项可以为同一表项的,也可以为不同表项的)所属的逻辑数据表。In the present application, by storing the identifier of the first logical data table and the identifier of the second logical data table, different data items stored in the physical data table can be distinguished (the data items can be the same entry or different entries). The logical data table to which it belongs.
可以理解,本申请中,上述第三位置还可以还存储有用于标识上述第三逻辑数据表的第三标识;上述第四位置还可以还存储有用于标识上述第一逻辑数据表的第一标识。It is to be understood that, in the present application, the third location may further include a third identifier for identifying the third logical data table, where the fourth location may further store a first identifier for identifying the first logical data table. .
本申请中,如果物理数据表中的某个表项不足以存储多个逻辑数据表中排列序号相同的表项的数据项,那么本申请在存储该多个逻辑数据表中的各个数据项时,可以设置或者创建多个物理数据表,并将该多个逻辑数据表中的各个数据项分别按照存储顺序依次存储至该多个物理数据表中的相应物理数据表中。In the present application, if an entry in the physical data table is insufficient to store data items of the same number of entries in the plurality of logical data tables, the present application stores each data item in the plurality of logical data tables. A plurality of physical data tables may be set or created, and each of the plurality of logical data tables is sequentially stored in a storage order to a corresponding one of the plurality of physical data tables.
第三方面,提供一种存储物理数据表的装置,该装置包括处理器和与处理器耦合连接的存储器。该处理器用于执行上述第一方面或其任意一种可选的实现方式中的存储物理数据表的方法,该存储器用于存储该物理数据表。In a third aspect, an apparatus for storing a physical data table is provided, the apparatus comprising a processor and a memory coupled to the processor. The processor is configured to perform the method of storing a physical data table in the foregoing first aspect or any alternative implementation thereof, the memory being used to store the physical data table.
第四方面,提供一种计算机可读存储介质,该计算机可读存储介质包括计算机指令,当该计算机指令在存储物理数据表的装置上运行时,使得该装置执行上述第一方面或其任意一种可选的实现方式中的存储物理数据表的方法。In a fourth aspect, a computer readable storage medium is provided, the computer readable storage medium comprising computer instructions that, when executed on a device storing a physical data table, cause the device to perform the first aspect or any one of the above A method of storing a physical data table in an alternative implementation.
对第二方面、第二方面的任意一种可选的实现方式、第三方面以及第四方面的技术效果以及其他内容可以参见上述对第一方面和其任意一种可选的实现方式的技术效果以及其他内容的相关描述,此处不再赘述。For the second aspect, any optional implementation manner of the second aspect, the technical effects of the third aspect and the fourth aspect, and other contents, refer to the foregoing technology for the first aspect and any of the alternative implementation manners. The description of the effect and other content is not described here.
附图说明DRAWINGS
图1为现有技术提供的数据表的结构示意图;1 is a schematic structural diagram of a data table provided by the prior art;
图2为本发明实施例提供的通信系统的架构示意图;2 is a schematic structural diagram of a communication system according to an embodiment of the present invention;
图3为本发明实施例提供的路由器的硬件示意图;FIG. 3 is a schematic diagram of hardware of a router according to an embodiment of the present disclosure;
图4为本发明实施例提供的存储物理数据表的方法示意图一;4 is a first schematic diagram of a method for storing a physical data table according to an embodiment of the present invention;
图5为本发明实施例提供的第一逻辑数据表或者物理数据表的结构示意图;FIG. 5 is a schematic structural diagram of a first logical data table or a physical data table according to an embodiment of the present disclosure;
图6为本发明实施例提供的存储物理数据表的方法示意图二;FIG. 6 is a second schematic diagram of a method for storing a physical data table according to an embodiment of the present invention;
图7为本发明实施例提供的存储物理数据表的方法示意图三;FIG. 7 is a third schematic diagram of a method for storing a physical data table according to an embodiment of the present disclosure;
图8为本发明实施例提供的存储逻辑数据表中的数据项的示意图;FIG. 8 is a schematic diagram of a data item in a storage logical data table according to an embodiment of the present invention;
图9为本发明实施例提供的存储物理数据表的装置的结构示意图一;FIG. 9 is a schematic structural diagram 1 of an apparatus for storing a physical data table according to an embodiment of the present disclosure;
图10为本发明实施例提供的存储物理数据表的装置的结构示意图二。FIG. 10 is a schematic structural diagram 2 of an apparatus for storing a physical data table according to an embodiment of the present invention.
具体实施方式detailed description
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。The term "and/or" in this context is merely an association describing the associated object, indicating that there may be three relationships, for example, A and / or B, which may indicate that A exists separately, and both A and B exist, respectively. B these three situations.
本申请的说明书和权利要求书中的术语“第一”、“第二”和“第三”等是用于区别不同的对象,而不是用于描述对象的特定顺序。例如,第一数据表、第二数据表和第三数据表等是用于区别不同的数据表,而不是用于描述数据表的特定顺序。The terms "first", "second", and "third" and the like in the specification and claims of the present application are used to distinguish different objects, and are not intended to describe a particular order of the objects. For example, the first data table, the second data table, the third data table, and the like are used to distinguish different data tables, rather than to describe a specific order of the data tables.
在本发明实施例的描述中,除非另有说明,“多个”的含义是指两个或两个以上。例如,多个逻辑数据表是指两个或两个以上的逻辑数据表;多个局域网是指两个或两个以上的局域网。In the description of the embodiments of the present invention, the meaning of "a plurality" means two or more unless otherwise stated. For example, multiple logical data tables refer to two or more logical data tables; multiple local area networks refer to two or more local area networks.
本发明实施例中,存储物理数据表的设备可以为路由器、交换机或者工作站等。路由器可以为有线路由器、无线路由器或者分布式路由器等。In the embodiment of the present invention, the device for storing the physical data table may be a router, a switch, a workstation, or the like. The router can be a wired router, a wireless router, or a distributed router.
本发明实施例提供的存储物理数据表的方法可以应用于路由器、交换机或者工作站中。具体可以应用于路由器、交换机或者工作站中的各个处理器中。例如,路由器、交换机或者工作站中的CPU,路由器、交换机或者工作站中的主控板或接口板中的CPU或者路由器、交换机或者工作站中的NP等。The method for storing a physical data table provided by the embodiment of the present invention can be applied to a router, a switch, or a workstation. It can be specifically applied to each processor in a router, switch or workstation. For example, a CPU in a router, switch, or workstation, a CPU in a main control board or interface board in a router, switch, or workstation, or an NP in a router, switch, or workstation.
图2所示为本发明实施例提供的一种存储物理数据表的方法应用的通信系统的架构示意图。在图2中,该通信系统包括位于核心网中的核心路由器10、位于多个局域网中的边缘路由器(图2以2个边缘路由器,分别为边缘路由器20和边缘路由器21为例)和多个终端设备(图2以4个终端设备,分别为终端设备30、终端设备31、终端设备32和终端设备33为例)。其中,核心路由器10与边缘路由器20和边缘路由器21分别连接,边缘路由器20与终端设备30和终端设备31分别连接,边缘路由器21与终端设备32和终端设备33分别连接。以终端设备30向终端设备32发送数据报文为例,终端设备30经由边缘路由器20将该数据报文发送给核心路由器10,核心路由器10根据该数据报文确定从核心路由器10的哪个端口发出该数据报文,然后核心路由器10再将该数据报文从确定的端口经由边缘路由器21转发给终端设备32。FIG. 2 is a schematic structural diagram of a communication system applied to a method for storing a physical data table according to an embodiment of the present invention. In FIG. 2, the communication system includes a core router 10 located in a core network, an edge router located in a plurality of local area networks (FIG. 2 with two edge routers, respectively, an edge router 20 and an edge router 21) and a plurality of The terminal device (FIG. 2 takes four terminal devices, which are the terminal device 30, the terminal device 31, the terminal device 32, and the terminal device 33 as examples). The core router 10 is connected to the edge router 20 and the edge router 21, the edge router 20 is connected to the terminal device 30 and the terminal device 31, and the edge router 21 is connected to the terminal device 32 and the terminal device 33, respectively. Taking the data packet sent by the terminal device 30 to the terminal device 32 as an example, the terminal device 30 sends the data packet to the core router 10 via the edge router 20, and the core router 10 determines which port of the core router 10 is issued according to the data packet. The data message is then forwarded by the core router 10 from the determined port to the terminal device 32 via the edge router 21.
在终端设备30向终端设备32发送数据报文的过程中,核心路由器10、边缘路由器20和边缘路由器21均可以生成、接收或者发送数据表、数据表中的表项或数据表中的表项的数据项,并按照这些数据表中的表项或数据表中的表项的数据项向各自的下一跳设备转发该数据报文。In the process in which the terminal device 30 sends a data message to the terminal device 32, the core router 10, the edge router 20, and the edge router 21 can generate, receive, or transmit entries in the data table, the data table, or the data table. The data items are forwarded to the respective next hop devices according to the entries in the data tables or the data items of the entries in the data table.
本发明实施例中,如图2所示的各个设备之间可以通过无线方式连接。图2中为了直观的表示各个设备之间的连接关系,均以实线示意各个设备之间的连接关系。In the embodiment of the present invention, the devices shown in FIG. 2 can be connected by wireless. In FIG. 2, in order to visually indicate the connection relationship between the devices, the connection relationship between the devices is indicated by a solid line.
可选的,本发明实施例提供的逻辑数据表可以为哈希表,也可以为线性表,还可以为能够采用本发明实施例提供的存储物理数据表的方法的任意形式的逻辑数据表,本发明实施例不作限定。Optionally, the logical data table provided by the embodiment of the present invention may be a hash table, or may be a linear table, or may be any form of logical data table capable of using the method for storing a physical data table provided by the embodiment of the present invention. The embodiment of the invention is not limited.
其中,以存储物理数据表的设备是路由器,逻辑数据表是哈希表为例,逻辑数据表可以为媒体接入控制(media access control,MAC)表、组播路由表、地址解析协议(address resolution protocol,ARP)表等。以存储物理数据表的设备是路由器, 逻辑数据表是线性表为例,逻辑数据表可以为多协议标签交换(multi-protocol label switching,MPLS)表、虚拟局域网(virtual local area network,VLAN)表、子接口表或者流表等。The device that stores the physical data table is a router, and the logical data table is a hash table. The logical data table may be a media access control (MAC) table, a multicast routing table, or an address resolution protocol (address). Resolution protocol, ARP) table, etc. The device that stores the physical data table is a router, and the logical data table is a linear table. The logical data table can be a multi-protocol label switching (MPLS) table or a virtual local area network (VLAN) table. , sub-interface table or flow table.
本发明实施例中,上述线性表通常需要预先为其分配好物理存储空间。以路由器或者交换机中存储的VLAN表为例,由于路由器或者交换机的某个端口可能并没有在VLAN中使用,因此路由器或者交换机中存储的该VLAN表中可能并没有与该端口对应的表项,但是该表项占用的物理存储空间通常需要预先为其分配好。In the embodiment of the present invention, the above linear table generally needs to allocate a physical storage space for it in advance. Take the VLAN table stored in the router or switch as an example. The port of the router or switch may not be used in the VLAN. Therefore, the VLAN table stored in the router or switch may not have an entry corresponding to the port. However, the physical storage space occupied by this entry usually needs to be allocated in advance.
上述如图2所示的终端设备可以为手机、平板电脑、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本或者个人数字助理(personal Digital Assistant,PDA)等,具体的可以根据实际应用场景确定,本发明实施例不作限定。The terminal device shown in FIG. 2 may be a mobile phone, a tablet computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA). The embodiment of the present invention is not limited according to the actual application scenario.
本发明实施例中,上述如图2所示的核心路由器10、边缘路由器20和边缘路由器21的结构可以相同,也可以不同。下面以核心路由器10、边缘路由器20和边缘路由器21的结构相同为例,结合图3介绍本发明实施例提供的路由器的硬件结构。如图3所示,本发明实施例提供的路由器可以包括:主控板400、与主控板400连接的交换网板(switch fabric)401和至少一个接口板(图3以两个接口板,分别为接口板402a和接口板402b为例),交换网板401和至少一个接口板中的每个接口板连接。主控板400可以包括CPU 400a。接口板402a可以包括CPU 403a、与CPU 403a连接的存储器404a、NP 405a和物理接口卡406a。接口板402b可以包括CPU 403b、与CPU 403b连接的存储器404b、NP 405b和物理接口卡406b。In the embodiment of the present invention, the configurations of the core router 10, the edge router 20, and the edge router 21 shown in FIG. 2 may be the same or different. The following is an example of the structure of the core router 10, the edge router 20, and the edge router 21, and the hardware structure of the router provided by the embodiment of the present invention is introduced in conjunction with FIG. As shown in FIG. 3, the router provided by the embodiment of the present invention may include: a main control board 400, a switch fabric 401 connected to the main control board 400, and at least one interface board (FIG. 3 uses two interface boards, For example, the interface board 402a and the interface board 402b are respectively connected, and the switching network board 401 is connected to each interface board of at least one interface board. The main control board 400 may include a CPU 400a. The interface board 402a may include a CPU 403a, a memory 404a connected to the CPU 403a, an NP 405a, and a physical interface card 406a. The interface board 402b may include a CPU 403b, a memory 404b connected to the CPU 403b, an NP 405b, and a physical interface card 406b.
其中,主控板400用于路由器上的整体控制。例如主控板400可以控制接口板402a(或者接口板402b)从与路由器连接的一个设备接收数据报文,并控制交换网板401对接口板402a(或者接口板402b)接收到的数据报文进行交换处理,以及控制接口板402b(或者接口板402a)发送经交换网板401传送过来的数据报文给与路由器连接的另一个设备。可以理解,上述数据报文从接口板402a进入交换网板401之后也可以再从接口板402a发出。Among them, the main control board 400 is used for overall control on the router. For example, the main control board 400 can control the interface board 402a (or the interface board 402b) to receive data packets from a device connected to the router, and control the data packets received by the switching network board 401 to the interface board 402a (or the interface board 402b). The switching process is performed, and the control interface board 402b (or the interface board 402a) transmits the data message transmitted via the switching network board 401 to another device connected to the router. It can be understood that the data packet can be sent from the interface board 402a after entering the switching network board 401 from the interface board 402a.
交换网板400用于对接口板402a或者接口板402b接收到的数据报文进行交换处理。The switching network board 400 is configured to exchange data packets received by the interface board 402a or the interface board 402b.
接口板402a或者接口板402b用于接收与路由器连接的一个设备发送的数据报文,并将该数据报文发送给交换网板401,以及将从交换网板401接收的数据报文发送给该设备或者与路由器连接的另一个设备。The interface board 402a or the interface board 402b is configured to receive a data packet sent by a device connected to the router, and send the data packet to the switching network board 401, and send the data packet received from the switching network board 401 to the data packet. Device or another device connected to the router.
上面描述的路由器是以如图3所示的路由器的硬件结构为例的。路由器中还可以包括更多或者更少的部件,路由器的功能也可以包括更多或者更少的功能,具体以实际使用情况确定,本发明实施例不再详述。The router described above is exemplified by the hardware structure of the router as shown in FIG. The router may also include more or less components, and the function of the router may also include more or less functions, which are determined by actual use, and are not described in detail in the embodiments of the present invention.
本发明实施例提供的存储物理数据表的方法的执行主体可以为上述的路由器、交换机或者工作站等。以在路由器中执行为例,执行主体也可以为该路由器中的CPU、该路由器中的主控板或接口板中的CPU或者该路由器中的NP等,例如图3所示的路由器中的CPU 400a、CPU 403a、NP 405a、CPU 403b或者NP 405b。The execution body of the method for storing the physical data table provided by the embodiment of the present invention may be the above-mentioned router, switch, workstation, or the like. For example, in the router, the execution entity may also be a CPU in the router, a CPU in the main control board or the interface board of the router, or an NP in the router, such as a CPU in the router shown in FIG. 3. 400a, CPU 403a, NP 405a, CPU 403b, or NP 405b.
本发明实施例提供的存储物理数据表的方法应用于上述如图3所示的路由器时, 如图3所示的存储器404a或者存储器404b可以用于存储该物理数据表。其中,存储器404a也可以集成在NP 405a中,存储器404b也可以集成在NP 405b。该存储器404a和存储器404b可以为静态随机存取存储器(static random access memory,SRAM)。When the method for storing a physical data table provided by the embodiment of the present invention is applied to the router shown in FIG. 3, the memory 404a or the memory 404b shown in FIG. 3 can be used to store the physical data table. The memory 404a may also be integrated in the NP 405a, and the memory 404b may also be integrated in the NP 405b. The memory 404a and the memory 404b may be static random access memory (SRAM).
下面以执行主体是路由器为例介绍本发明实施例提供的存储物理数据表的方法。The method for storing a physical data table provided by an embodiment of the present invention is described below by taking an execution host as a router.
如图4所示,本发明实施例提供一种存储物理数据表的方法,该方法可以包括S101-S104。As shown in FIG. 4, an embodiment of the present invention provides a method for storing a physical data table, and the method may include S101-S104.
S101、路由器获取第一逻辑数据表中的第一表项的第一数据项。S101. The router acquires a first data item of the first entry in the first logical data table.
本发明实施例中,在通信过程中,由于路由器可以实现路由的功能,即路由器可以根据传输信道的情况自动选择和设定传输路径,然后以最佳的传输路径,按顺序发送通信数据,因此为了提升路由器的路由效率,路由器在实现路由过程中可能需要存储各种各样的数据表。路由器存储了数据表之后,在后续通信过程中可以直接使用已存储的数据表,该数据表例如是哈希表或线性表。具体可以是路由器需要存储哈希表或者线性表中的各个数据项。In the embodiment of the present invention, in the communication process, since the router can implement the routing function, the router can automatically select and set the transmission path according to the condition of the transmission channel, and then send the communication data in order according to the optimal transmission path. In order to improve the routing efficiency of the router, the router may need to store various data tables in the process of implementing routing. After the router stores the data table, the stored data table can be used directly in the subsequent communication process, such as a hash table or a linear table. Specifically, the router needs to store each data item in the hash table or the linear table.
上述第一表项可以由第一逻辑数据表中的多个数据项组成。示例性的,假设图5为本发明实施例提供的第一逻辑数据表的结构示意图,那么在图5中,00-03(图5中标记为表项1)、10-13(图5中标记为表项2)以及20-23(图5中标记为表项3)分别为第一逻辑数据表中的一个表项。以第一逻辑数据表中的表项00-03为例,该表项中的00、01、02和03为该表项的4个数据项。The first item above may be composed of a plurality of data items in the first logical data table. Illustratively, FIG. 5 is a schematic structural diagram of a first logical data table according to an embodiment of the present invention. In FIG. 5, 00-03 (labeled as entry 1 in FIG. 5), 10-13 (in FIG. 5 Marked as entry 2) and 20-23 (labeled as entry 3 in Figure 5) are respectively an entry in the first logical data table. Take the entry 00-03 in the first logical data table as an example. 00, 01, 02, and 03 in the entry are the four data items of the entry.
本发明实施例中,上述第一逻辑数据表中的第一表项的第一数据项可以是路由器生成的,也可以是路由器从其他设备接收的,还可以是路由器从其他设备接收并计算后生成的。具体的,可以根据实际使用情况确定,本发明实施例不作限定。In the embodiment of the present invention, the first data item of the first entry in the first logical data table may be generated by a router, or may be received by the router from another device, or may be received and calculated by the router from other devices. Generated. Specifically, it can be determined according to the actual use, and the embodiment of the present invention is not limited.
可选的,本发明实施例中,上述第一逻辑数据表中的第一表项的第一数据项中可以包括该第一数据项所属的第一表项的标识。该标识可以为路由器计算的该第一表项的关键(key)值。以第一逻辑数据表中的第一表项的第一数据项是一个MAC地址为例,当路由器获取到一个新的MAC地址时,路由器可以对该MAC地址进行哈希计算得到一个哈希值,并根据该哈希值确定该MAC地址在逻辑数据表中对应于或具体位于哪个表项,然后根据该哈希值在第一逻辑数据表中对应的表项,将该哈希值存储至物理数据表中的一个表项的一个位置,例如下述S102。Optionally, in the embodiment of the present invention, the first data item of the first entry in the first logical data table may include an identifier of the first entry to which the first data item belongs. The identifier may be a key value of the first entry calculated by the router. Taking the first data item of the first entry in the first logical data table as a MAC address as an example, when the router obtains a new MAC address, the router can perform hash calculation on the MAC address to obtain a hash value. And determining, according to the hash value, which entry the MAC address corresponds to or specifically located in the logical data table, and then storing the hash value to the corresponding entry in the first logical data table according to the hash value to A location of an entry in the physical data table, such as S102 described below.
本发明实施例中,逻辑数据表可以理解为逻辑存储的一些数据项,这些数据项具有一定的逻辑关系。例如,在路由器中,该逻辑数据表可以为存储在路由器的CPU或内存中的一些数据项。可以理解,上述第一逻辑数据表可以存储在路由器的CPU或内存中。In the embodiment of the present invention, a logical data table can be understood as some data items that are logically stored, and these data items have a certain logical relationship. For example, in a router, the logical data table can be some data items stored in the router's CPU or memory. It can be understood that the above first logical data table can be stored in the CPU or the memory of the router.
S102、路由器将第一逻辑数据表中的第一表项的第一数据项存储至物理数据表的第一位置。S102. The router stores the first data item of the first entry in the first logical data table to the first location of the physical data table.
本发明实施例中,物理数据表可以理解为物理存储的数据表。例如,在路由器中,该物理数据表可以存储在路由器的接口板中的存储器(该存储器可以集成在接口板中的NP中)中,该存储器例如是具有较高性能且容量较小的SRAM。In the embodiment of the present invention, the physical data table can be understood as a data table physically stored. For example, in a router, the physical data table can be stored in a memory in the interface board of the router (which can be integrated in the NP in the interface board), such as an SRAM with higher performance and smaller capacity.
举例来说,本发明实施例中,假设第一逻辑数据表包括表项1、表项2和表项3,物理数据表包括表项1、表项2和表项3,那么采用本发明实施例提供的存储物理数据 表的方法可以将第一逻辑数据表中的表项1的各个数据项存储至物理数据表中的表项1的各个位置,将第一逻辑数据表中的表项2的各个数据项存储至物理数据表中的表项2的各个位置,将第一逻辑数据表中的表项3的各个数据项存储至物理数据表中的表项3的各个位置。For example, in the embodiment of the present invention, it is assumed that the first logical data table includes the entry 1, the entry 2, and the entry 3. The physical data table includes the entry 1, the entry 2, and the entry 3. The method for storing the physical data table provided by the example may store each data item of the entry 1 in the first logical data table to each position of the entry 1 in the physical data table, and the entry 2 in the first logical data table The respective data items are stored to respective locations of the entry 2 in the physical data table, and the respective data items of the entry 3 in the first logical data table are stored to respective locations of the entry 3 in the physical data table.
可选地,本发明实施例中,上述第一逻辑数据表中的表项1、表项2和表项3顺序排列,例如第一逻辑数据表中的表项1、表项2和表项3分别是第一逻辑数据表中的第一个、第二个和第三个表项,同样地,物理数据表中的表项1、表项2和表项3也顺序排列,例如物理数据表中的表项1、表项2和表项3分别是物理数据表中的第一个、第二个和第三个表项。那么本发明实施例中,可以认为逻辑数据表中的表项1与物理数据表中的表项1是指排列序号相同的两个表项,逻辑数据表中的表项2与物理数据表中的表项2是指排列序号相同的两个表项,逻辑数据表中的表项3与物理数据表中的表项3是指排列序号相同的两个表项。Optionally, in the embodiment of the present invention, the entry 1, the entry 2, and the entry 3 in the first logical data table are sequentially arranged, for example, the entry 1, the entry 2, and the entry in the first logical data table. 3 is the first, second, and third entries in the first logical data table, respectively, and the entries 1, 2, and 3 in the physical data table are also sequentially arranged, for example, physical data. Table 1, Table 2, and Table 3 in the table are the first, second, and third entries in the physical data table, respectively. In the embodiment of the present invention, the entry 1 in the logical data table and the entry 1 in the physical data table refer to two entries with the same sequence number, and the entry 2 and the physical data table in the logical data table. The entry 2 refers to two entries with the same sequence number. The entry 3 in the logical data table and the entry 3 in the physical data table refer to two entries with the same sequence number.
可选的,上述描述中,表项的标号(诸如表项1中的“1”、表项2中的“2”或表项3中的“3”)可以用于表示表项在数据表中的排列序号。不同数据表中标号相同的表项是指不同数据表中排列序号相同的表项。例如第一逻辑数据表中的表项1、第二逻辑数据表中的表项1和物理数据表中的表项1是指第一逻辑数据表、第二逻辑数据表和物理数据表中排列序号相同的表项。Optionally, in the foregoing description, the label of the entry (such as "1" in the entry 1 or "2" in the entry 2 or "3" in the entry 3) may be used to indicate the entry in the data table. The serial number in the middle. An entry with the same label in different data tables refers to an entry with the same sequence number in different data tables. For example, the entry in the first logical data table, the entry 1 in the second logical data table, and the entry 1 in the physical data table refer to the arrangement in the first logical data table, the second logical data table, and the physical data table. The same number of entries.
本发明实施例中,上述逻辑数据表中的表项与物理数据表中的表项的排列序号的说明同样也适用于两个逻辑数据表中的表项。例如,第一逻辑数据表中的表项1与第二逻辑数据表中的表项1是指排列序号相同的两个表项。In the embodiment of the present invention, the description of the arrangement number of the entry in the logical data table and the entry in the physical data table also applies to the entries in the two logical data tables. For example, the entry 1 in the first logical data table and the entry 1 in the second logical data table refer to two entries having the same sequence number.
可选的,第二逻辑数据表中的表项1与物理数据表中的表项1也是指排列序号相同的两个表项。在本发明实施例提供的存储物理数据表的方法中,可以将多个逻辑数据表中排列序号相同的表项的数据项存储到物理数据表中与这些表项的排列序号相同的物理数据表中。例如,可以将第一逻辑数据表中的表项1的各个数据项与第二逻辑数据表中的表项1的各个数据项均存储至物理数据表中的表项1的各个位置。Optionally, the entry 1 in the second logical data table and the entry 1 in the physical data table also refer to two entries with the same sequence number. In the method for storing a physical data table provided by the embodiment of the present invention, the data items of the items with the same sequence number in the plurality of logical data tables may be stored in the physical data table in the physical data table and the same as the arrangement number of the entries. in. For example, each data item of the entry 1 in the first logical data table and each data item of the entry 1 in the second logical data table may be stored to respective locations of the entry 1 in the physical data table.
可选的,本发明实施例中,逻辑数据表(包括上述第一逻辑数据表、下述第二逻辑数据表和下述第三逻辑数据表)和物理数据表的结构相同,且逻辑数据表中的表项的排列顺序和物理数据表中的表项的排列顺序也相同。例如,上述第一逻辑数据表、下述第二逻辑数据表、下述第三逻辑数据表和物理数据表均可以为如图5所示的结构。Optionally, in the embodiment of the present invention, the logical data table (including the first logical data table, the second logical data table and the third logical data table described below) and the physical data table have the same structure, and the logical data table The order of the items in the table and the order of the items in the physical data table are also the same. For example, the first logical data table, the second logical data table described below, the third logical data table and the physical data table described below may each have a structure as shown in FIG. 5.
S103、路由器获取第二逻辑数据表中的第一表项的第一数据项。S103. The router acquires a first data item of the first entry in the second logical data table.
其中,上述第一逻辑数据表中的第一表项的标识和第二逻辑数据表中的第一表项的标识可以相同,也可以不同。例如,第一逻辑数据表中的第一表项的标识为key1,那么第二逻辑数据表中的第一表项的标识也可以为key1;或者第一逻辑数据表中的第一表项的标识为key1,那么第二逻辑数据表中的第一表项的标识可以为key2。The identifier of the first entry in the first logical data table and the identifier of the first entry in the second logical data table may be the same or different. For example, the identifier of the first entry in the first logical data table is key1, and the identifier of the first entry in the second logical data table may also be key1; or the first entry in the first logical data table The identifier is key1, and the identifier of the first entry in the second logical data table may be key2.
对于第二逻辑数据表中的第一表项和第二逻辑数据表中的第一表项的第一数据项的描述可以参见上述S101中对第一逻辑数据表中的第一表项和第一逻辑数据表中的第一表项的第一数据项的相关描述,此处不再赘述。For the description of the first data item in the first entry in the second logical data table and the first data entry in the second logical data table, refer to the first entry in the first logical data table and the first in the foregoing S101. A related description of the first data item of the first entry in a logical data table is not described here.
S104、路由器将第二逻辑数据表中的第一表项的第一数据项存储至物理数据表的第二位置。S104. The router stores the first data item of the first entry in the second logical data table to the second location of the physical data table.
其中,上述第二位置不同于第一位置。即物理数据表中的第二位置和物理数据表中的第一位置为物理数据表中两个不同的位置。Wherein the second location is different from the first location. That is, the second location in the physical data table and the first location in the physical data table are two different locations in the physical data table.
可选的,本发明实施例中,上述第一位置可以位于物理数据表中的第一表项,上述第二位置可以位于物理数据表中的第二表项。示例性的,假设图5为本发明实施例提供的物理数据表的结构示意图,那么该第一位置可以为如图5所示的物理数据表中的00表示的位置,该第二位置可以为如图5所示的物理数据表中的10表示的位置。Optionally, in the embodiment of the present invention, the first location may be located in a first entry in the physical data table, and the second location may be located in a second entry in the physical data table. Illustratively, FIG. 5 is a schematic structural diagram of a physical data table according to an embodiment of the present invention. The first location may be a location indicated by 00 in the physical data table as shown in FIG. 5, and the second location may be The position indicated by 10 in the physical data table shown in FIG.
本发明实施例中,如果物理数据表中的某个表项不足以存储多个逻辑数据表中排列序号相同的表项的数据项,那么本发明实施例在存储该多个逻辑数据表中的各个数据项时,可以设置或者创建多个物理数据表,并将该多个逻辑数据表中的各个数据项分别按照存储顺序依次存储至该多个物理数据表中的相应物理数据表中。In the embodiment of the present invention, if a certain item in the physical data table is insufficient to store the data items of the items having the same sequence number in the plurality of logical data tables, the embodiment of the present invention stores the plurality of logical data tables. For each data item, a plurality of physical data tables may be set or created, and each of the plurality of logical data tables is sequentially stored in a corresponding physical data table of the plurality of physical data tables in a storage order.
举例来说,假设物理数据表中的表项1(例如图5所示的表项1)不足以存储第一逻辑数据表中的表项1的所有数据项和第二逻辑数据表中的表项1的所有数据项,那么路由器在存储第一逻辑数据表中的各个数据项和第二逻辑数据表中的各个数据项时,可以设置或者创建多个物理数据表,并将第一逻辑数据表中的各个数据项和第二数据表中的各个数据项按照存储顺序依次存储至该多个物理数据表中的相应物理数据表中。For example, it is assumed that the entry 1 in the physical data table (for example, the entry 1 shown in FIG. 5) is insufficient to store all the data items of the entry 1 in the first logical data table and the table in the second logical data table. For all data items of item 1, when the router stores each data item in the first logical data table and each data item in the second logical data table, the plurality of physical data tables may be set or created, and the first logical data is Each data item in the table and each data item in the second data table are sequentially stored in a storage order to a corresponding physical data table in the plurality of physical data tables.
具体的,本发明实施例可以采用下述两种可能的实现方式存储该多个逻辑数据表中的各个数据项。Specifically, the embodiment of the present invention may store each data item in the multiple logical data tables by using the following two possible implementation manners.
一种可能的实现方式是,本发明实施例可以在一个物理数据表中的某一表项全部存储了数据项之后,再在另一个物理数据表中与该表项的排列序号相同的表项存储该多个逻辑数据表中与该表项的排列序号相同的表项中还未存储的数据项。A possible implementation manner is that, in the embodiment of the present invention, after all the entries in one physical data table store the data item, and the other physical data table is the same as the sequence number of the entry. And storing, in the plurality of logical data tables, the data items that are not stored in the table with the same sequence number as the table item.
例如,路由器可以在一个物理数据表中的表项1全部存储了数据项之后,再在另一个物理数据表中的表项1存储第一逻辑数据表中的表项1中还未存储的数据项和第二逻辑数据表中的表项1中还未存储的数据项。For example, the router may store the data item after all the entries 1 in one physical data table, and then store the data that is not stored in the entry 1 of the first logical data table in the entry 1 of the other physical data table. The item and the data item not yet stored in the entry 1 in the second logical data table.
另一种可能的实现方式是,本发明实施例可以在一个物理数据表中的某一表项全部存储了数据项之后,将该物理数据表中属于同一个逻辑数据表、且位于每一表项中的所有数据项分别对应搬移至另一个物理数据表中的各个表项。Another possible implementation manner is that, after the data item is stored in an item in a physical data table, the physical data table belongs to the same logical data table and is located in each table. All data items in the item are moved to respective items in another physical data table.
本发明实施例中,通过上述另一种可能的实现方式,可以避免在物理数据表中存储数据项之后,在物理数据表中查找某个数据项时在多个物理数据表中查找该数据项,如此,能够提高在物理数据表中查找数据项的效率。In the embodiment of the present invention, after the data item is stored in the physical data table, the data item in the physical data table is searched for, and the data item is searched in the plurality of physical data tables. In this way, the efficiency of finding data items in the physical data table can be improved.
本发明实施例可以不限定S102和S103之间的执行顺序,例如可以先执行S102后执行S103,也可以先执行S103后执行S102,还可以同时执行S102和S103。The embodiment of the present invention may not limit the execution order between S102 and S103. For example, S103 may be executed first after S102, or S102 may be executed after S103, and S102 and S103 may be simultaneously executed.
可选的,结合图4,如图6所示,本发明实施例提供的存储物理数据表的方法还可以包括下述的S105-S106:Optionally, in conjunction with FIG. 4, as shown in FIG. 6, the method for storing a physical data table provided by the embodiment of the present invention may further include the following S105-S106:
S105、路由器获取第三逻辑数据表中的第一表项的第一数据项。S105. The router acquires a first data item of the first entry in the third logical data table.
S106、路由器将该第三逻辑数据表中的第一表项的第一数据项存储至物理数据表的第三位置。S106. The router stores the first data item of the first entry in the third logical data table to a third location of the physical data table.
其中,上述第三位置位于该物理数据表中的第一表项,该第三位置不同于上述第一位置。即物理数据表中的第三位置和物理数据表中的第一位置为物理数据表中同一个表项中的两个不同的位置。示例性的,假设图5为本发明实施例提供的物理数据表 的结构示意图,如图5所示,该第一位置可以为如图5所示的物理数据表中的00表示的位置,该第三位置可以为如图5所示的物理数据表中的01表示的位置。The third location is located in a first entry in the physical data table, and the third location is different from the first location. That is, the third location in the physical data table and the first location in the physical data table are two different locations in the same entry in the physical data table. Illustratively, FIG. 5 is a schematic structural diagram of a physical data table according to an embodiment of the present invention. As shown in FIG. 5, the first location may be a location indicated by 00 in the physical data table as shown in FIG. 5, where The third position may be a position indicated by 01 in the physical data table as shown in FIG.
本发明实施例中对于S101、S102、S103、S104、S105、S106各个步骤之间的执行顺序只限定S101在S102之前,S103在S104之前,S105在S106之前,对其余的步骤间执行顺序不做限定。例如可以先执行S103-S104后执行S105-S106,或者可以先执行S105-S106后执行S103-S104,还可以同时执行S103-S104和S105-S106。具体的可以根据第二逻辑数据表中的第一表项的第一数据项和第三逻辑数据表中的第一表项的第一数据项的存储顺序确定,本发明实施例不作限定。还例如可以先执行S104后执行S105,也可以先执行S105后执行S104,还可以同时执行S104和S105。上述图6是以S105-S106在S103-S104之后执行为例进行示例的。In the embodiment of the present invention, the execution order between the steps S101, S102, S103, S104, S105, S106 only defines S101 before S102, S103 before S104, S105 before S106, and does not perform the execution sequence between the remaining steps. limited. For example, S105-S106 may be executed first and then S105-S106 may be executed, or S105-S106 may be executed first, then S103-S104 may be executed, and S103-S104 and S105-S106 may be simultaneously executed. Specifically, it may be determined according to the storage order of the first data item of the first entry in the second logical data table and the first data entry of the first entry in the third logical data table, which is not limited by the embodiment of the present invention. For example, S105 may be executed first after S104 is executed, or S104 may be executed after S105 is executed first, and S104 and S105 may be simultaneously executed. The above FIG. 6 is exemplified by S105-S106 being executed after S103-S104 as an example.
可选的,结合图6,如图7所示,本发明实施例提供的存储物理数据表的方法还可以包括下述的S107-S108:Optionally, in conjunction with FIG. 6, as shown in FIG. 7, the method for storing a physical data table provided by the embodiment of the present invention may further include the following S107-S108:
S107、路由器获取第一逻辑数据表中的第一表项的第二数据项。S107. The router acquires a second data item of the first entry in the first logical data table.
S108、路由器将该第一逻辑数据表中的第一表项的第二数据项存储至物理数据表的第四位置。S108. The router stores the second data item of the first entry in the first logical data table to a fourth location of the physical data table.
其中,上述第四位置位于该物理数据表中的第一表项。该第四位置不同于上述第一位置和上述第三位置。即物理数据表中的第四位置与物理数据表中的第三位置和物理数据表中的第一位置为物理数据表中同一个表项中的三个不同的位置。示例性的,假设图5为本发明实施例提供的物理数据表的结构示意图,如图5所示,该第一位置可以为如图5所示的物理数据表中的00表示的位置,该第三位置可以为如图5所示的物理数据表中的01表示的位置。该第四位置可以为如图5所示的物理数据表中的02表示的位置。The fourth location is located in the first entry in the physical data table. The fourth position is different from the first position and the third position described above. That is, the fourth location in the physical data table and the third location in the physical data table and the first location in the physical data table are three different locations in the same entry in the physical data table. Illustratively, FIG. 5 is a schematic structural diagram of a physical data table according to an embodiment of the present invention. As shown in FIG. 5, the first location may be a location indicated by 00 in the physical data table as shown in FIG. 5, where The third position may be a position indicated by 01 in the physical data table as shown in FIG. The fourth position may be a position indicated by 02 in the physical data table as shown in FIG.
本发明实施例中对于S101、S102、S103、S104、S105、S106、S107和S108各个步骤之间的执行顺序只限定S101在S102之前,S103在S104之前,S105在S106之前,S107在S108之前,对其余的步骤间执行顺序不做限定。本发明实施例可以不限定S103-S104、S105-S106和S107-S108之间的执行顺序。具体的可以根据第二逻辑数据表中的第一表项的第一数据项、第三逻辑数据表中的第一表项的第一数据项以及第一逻辑数据表中的第一表项的第二数据项的存储顺序确定,本发明实施例不作限定。本发明实施例也可以不限定S106和S107之间的执行顺序,例如可以先执行S106后执行S107,也可以先执行S107后执行S106,还可以同时执行S106和S107。上述图7是以S105-S106在S103-S104之后、且S107-S108在S105-S106之后执行为例进行示例的。In the embodiment of the present invention, the execution order between the steps S101, S102, S103, S104, S105, S106, S107 and S108 only defines S101 before S102, S103 before S104, S105 before S106, S107 before S108, The order of execution between the remaining steps is not limited. The embodiment of the present invention may not limit the execution order between S103-S104, S105-S106, and S107-S108. Specifically, the first data item of the first entry in the second logical data table, the first data item of the first entry in the third logical data table, and the first entry in the first logical data table may be The storage order of the second data item is determined, which is not limited in the embodiment of the present invention. The embodiment of the present invention may not limit the execution order between S106 and S107. For example, S107 may be executed first after S106, or S106 may be executed after S107, and S106 and S107 may be simultaneously executed. The above-described FIG. 7 is exemplified by S105-S106 being executed after S103-S104 and S107-S108 being executed after S105-S106.
下面以一个实例,结合图8进一步说明本发明实施例提供的存储物理数据表的方法。The method for storing a physical data table provided by the embodiment of the present invention is further described below with reference to FIG. 8 .
假设待存储的多个逻辑数据表中的各个数据项为各个地址(例如可以为MAC地址或者互联网协议(Internet protocol,IP)地址,或者可以为各个地址经过哈希计算得到的key值等)。如图8所示,图8中的表A表示本发明实施例提供的第一逻辑数据表,第一逻辑数据表包括一些地址。图8中的表B表示本发明实施例提供的第二逻辑数据表,第二逻辑数据表包括另一些地址。图8中的表C表示本发明实施例提供的第三逻辑数据表,第三逻辑数据表包括又一些地址。图8中的表D表示本发明实施例 提供的物理数据表。示例性的,如图8所示,对于表A,图8中以横坐标0-3表示表A中的各个表项(例如0表示表A中的表项0,1表示表A中的表项1,2表示表A中的表项2,3表示表A中的表项3),以横坐标0-3和纵坐标0-3的各个交叉点表示表A中的各个表项的各个数据项。对于表B,图8中以横坐标0-3表示表B中的各个表项(例如0表示表B中的表项0,1表示表B中的表项1,2表示表B中的表项2,3表示表B中的表项3),以横坐标0-3和纵坐标0-3的各个交叉点表示表B中的各个表项的各个数据项。对于表C,图8中以横坐标0-3表示表C中的各个表项(例如0表示表C中的表项0,1表示表C中的表项1,2表示表C中的表项2,3表示表C中的表项3),以横坐标0-3和纵坐标0-3的各个交叉点表示表C中的各个表项的各个数据项。对于表D,图8中以横坐标0-3表示表D中的各个表项(例如0表示表D中的表项0,1表示表D中的表项1,2表示表D中的表项2,3表示表D中的表项3),以横坐标0-3和纵坐标0-3的各个交叉点表示表D中的各个表项的各个数据项。It is assumed that each data item in the plurality of logical data tables to be stored is a respective address (for example, may be a MAC address or an Internet Protocol (IP) address, or may be a key value obtained by hashing each address, and the like). As shown in FIG. 8, the table A in FIG. 8 represents a first logical data table provided by an embodiment of the present invention, and the first logical data table includes some addresses. Table B in Figure 8 shows a second logical data table provided by an embodiment of the present invention, and the second logical data table includes other addresses. Table C in Figure 8 shows a third logical data table provided by an embodiment of the present invention, and the third logical data table includes further addresses. Table D in Fig. 8 shows a physical data table provided by an embodiment of the present invention. Exemplarily, as shown in FIG. 8, for Table A, each entry in Table A is represented by an abscissa 0-3 in FIG. 8 (for example, 0 indicates an entry 0 in Table A, and 1 indicates a table in Table A. Item 1, 2 represents the entry 2 in the table A, 3 represents the entry 3) in the table A, and each of the entries in the table A is represented by each intersection of the abscissa 0-3 and the ordinate 0-3. data item. For Table B, each entry in Table B is represented by the abscissa 0-3 in FIG. 8 (for example, 0 represents the entry 0 in the table B, 1 represents the entry 1 in the table B, and 2 represents the table in the table B. The item 2, 3 represents the entry 3) in the table B, and the respective data items of the respective entries in the table B are represented by respective intersections of the abscissas 0-3 and the ordinates 0-3. For Table C, each entry in Table C is represented by the abscissa 0-3 in FIG. 8 (for example, 0 indicates the entry 0 in the table C, 1 indicates the entry 1 in the table C, and 2 indicates the table in the table C. The item 2, 3 represents the entry 3) in the table C, and the respective data items of the respective entries in the table C are represented by respective intersections of the abscissas 0-3 and the ordinates 0-3. For the table D, the individual entries in the table D are represented by the abscissas 0-3 in FIG. 8 (for example, 0 represents the table entry 0 in the table D, 1 represents the table entry 1 in the table D, and 2 represents the table in the table D. The item 2, 3 represents the entry 3) in the table D, and the respective data items of the respective entries in the table D are represented by respective intersections of the abscissas 0-3 and the ordinates 0-3.
如图8所示,假设本发明实施例提供的第一逻辑数据表中的第一表项为表A中的表项0,第一逻辑数据表中的第一表项的第一数据项为表A中的表项0的第一个数据项,且该数据项为地址1;第一逻辑数据表中的第一表项的第二数据项为表A中的表项0的第二个数据项,且该数据项为地址2;第二逻辑数据表中的第一表项为表B中的表项1,第二逻辑数据表中的第一表项的第一数据项为表B中的表项1的第一个数据项,且该数据项为地址3;第三逻辑数据表中的第一表项为表C中的表项0,第三逻辑数据表中的第一表项的第一数据项为表C中的表项0的第一个数据项,且该数据项为地址4。那么,如图8所示,采用本发明实施例提供的存储物理数据表的方法时,路由器可以先获取表A中的表项0的地址1(即表A中横坐标0和纵坐标0的交叉点00表示的数据项,可以理解为本发明实施例提供的第一逻辑数据表中的第一表项的第一数据项),然后再将地址1存储至表D中的表项0的第一位置(例如表D中横坐标0和纵坐标0的交叉点00表示的位置)。路由器可以继续获取表B中的表项1的地址3(即表B中横坐标1和纵坐标0的交叉点10表示的数据项,可以理解为本发明实施例提供的第二逻辑数据表中的第一表项的第一数据项),然后再将地址3存储至表D中的表项1的第二位置(例如表D中横坐标1和纵坐标0的交叉点10表示的位置)。路由器可以继续获取表C中的表项0的地址4(即表C中横坐标0和纵坐标0的交叉点00表示的数据项,可以理解为本发明实施例提供的第三逻辑数据表中的第一表项的第一数据项),然后再将地址4存储至表D中的表项0的第三位置(例如表D中横坐标0和纵坐标1的交叉点01表示的位置)。路由器可以继续获取表A中的表项0的地址2(即表A中横坐标0和纵坐标1的交叉点01表示的数据项,可以理解为本发明实施例提供的第一逻辑数据表中的第一表项的第二数据项),然后再将地址2存储至表D中的表项0的第四位置(例如表D中横坐标0和纵坐标2的交叉点02表示的位置)。以此类推,路由器可以将表A、表B和表C中的所有地址(即可以理解为本发明实施例提供的所有逻辑数据表中的所有表项的所有数据项)都存储到表D中。As shown in FIG. 8, it is assumed that the first entry in the first logical data table provided by the embodiment of the present invention is the entry 0 in the table A, and the first data entry in the first entry in the first logical data table is The first data item of the entry 0 in the table A, and the data item is the address 1; the second data item of the first entry in the first logical data table is the second of the entry 0 in the table A a data item, and the data item is address 2; the first entry in the second logical data table is the entry 1 in the table B, and the first data entry in the first entry in the second logical data table is the table B The first data item of the entry 1 in the table, and the data item is the address 3; the first entry in the third logical data table is the entry 0 in the table C, and the first table in the third logical data table The first data item of the entry is the first data entry of entry 0 in table C, and the data entry is address 4. Then, as shown in FIG. 8, when the method for storing the physical data table provided by the embodiment of the present invention is used, the router may first obtain the address 1 of the entry 0 in the table A (ie, the abscissa 0 and the ordinate 0 in the table A). The data item represented by the intersection 00 can be understood as the first data item of the first entry in the first logical data table provided by the embodiment of the present invention, and then the address 1 is stored in the entry 0 of the table D. The first position (for example, the position indicated by the intersection 00 of the abscissa 0 and the ordinate 0 in Table D). The router can continue to obtain the data item represented by the address 3 of the entry 1 in the table B (ie, the intersection of the abscissa 1 and the ordinate 0 in the table B, which can be understood as the second logical data table provided by the embodiment of the present invention. The first data item of the first entry), and then store the address 3 to the second position of the entry 1 in the table D (for example, the position indicated by the intersection 10 of the abscissa 1 and the ordinate 0 in the table D) . The router can continue to obtain the data item 4 of the entry 0 of the table C in the table C (ie, the data item represented by the intersection 00 of the abscissa 0 and the ordinate 0 in the table C, which can be understood as the third logical data table provided by the embodiment of the present invention. The first data item of the first entry), and then store the address 4 to the third position of the entry 0 in the table D (for example, the position indicated by the intersection 01 of the abscissa 0 and the ordinate 1 in the table D) . The router can continue to obtain the address 2 of the entry 0 of the table A in the table A (ie, the data item represented by the intersection 01 of the abscissa 0 and the ordinate 1 in the table A, which can be understood as the first logical data table provided by the embodiment of the present invention. The second data item of the first entry), and then store the address 2 to the fourth position of the entry 0 in the table D (for example, the position indicated by the intersection 02 of the abscissa 0 and the ordinate 2 in the table D) . By analogy, the router can store all the addresses in Table A, Table B, and Table C (that is, all the data items of all the entries in all the logical data tables that can be understood as the embodiments of the present invention) into Table D. .
可选的,采用本发明实施例提供的存储物理数据表的方法存储待存储的多个逻辑数据表中的数据项时,由于物理数据表中的一个表项可能会存储不同逻辑数据表中的数据项(例如如图8所示的表D中的表项0存储了表A中的数据项和表C中的数据项), 因此为了区分物理数据表中某个数据项具体属于哪个逻辑数据表,本发明实施例还可以存储该数据项所属的逻辑数据表的标识。Optionally, when the method for storing the physical data table provided by the embodiment of the present invention stores the data items in the plurality of logical data tables to be stored, an entry in the physical data table may be stored in different logical data tables. The data item (for example, the entry 0 in the table D shown in FIG. 8 stores the data item in the table A and the data item in the table C), so in order to distinguish which logical data belongs to a certain data item in the physical data table The embodiment of the present invention may also store an identifier of a logical data table to which the data item belongs.
可选的,本发明实施例提供的存储物理数据表的方法中,上述第一、二、三、四位置还分别存储有第一标识、第二标识、第三标识和所述第一标识,该第一、二、三标识可以分别用于标识上述第一逻辑数据表、第二逻辑数据表、第三逻辑数据表。例如在图8所示的表D中,表项0中横坐标0和纵坐标0的交叉点00可以存储“1地址1”(其中第1位的“1”标识“地址1”属于表A),表项0中横坐标0和纵坐标1的交叉点01可以存储“2地址4”(其中第1位的“2”标识“地址4”属于表C),表项0中横坐标0和纵坐标2的交叉点02可以存储“1地址2”(其中第1位的“1”标识“地址2”属于表A),表项1中横坐标1和纵坐标0的交叉点10可以存储“3地址3”(其中第1位的“3”标识“地址3”属于表B)。如此,通过在物理数据表中用于存储各个逻辑数据表中的各个数据项的位置存储相应数据项所属的逻辑数据表的标识,能够区分物理数据表中存储的某个数据项具体属于哪个逻辑数据表。从而,在查询某个数据项时,可以提高查询该数据项的效率。Optionally, in the method for storing a physical data table, the first, second, third, and fourth locations further include a first identifier, a second identifier, a third identifier, and the first identifier, respectively. The first, second, and third identifiers may be used to identify the first logical data table, the second logical data table, and the third logical data table, respectively. For example, in the table D shown in FIG. 8, the intersection 00 of the abscissa 0 and the ordinate 0 in the entry 0 may store "1 address 1" (where the "1" of the 1st bit identifies "address 1" belongs to the table A. ), the intersection 01 of the abscissa 0 and the ordinate 1 in the entry 0 can store "2 address 4" (where the "2" flag of the 1st bit "address 4" belongs to the table C), and the abscissa 0 of the entry 0 And the intersection 02 of the ordinate 2 can store "1 address 2" (where the "1" of the 1st bit identifies "Address 2" belongs to the table A), and the intersection 10 of the abscissa 1 and the ordinate 0 in the entry 1 can be Store "3 address 3" (where the "3" of the 1st bit identifies "Address 3" belongs to Table B). In this way, by storing the identifier of the logical data table to which the corresponding data item belongs in the physical data table for storing the location of each data item in each logical data table, it is possible to distinguish which logic belongs to a certain data item stored in the physical data table. data sheet. Thus, when querying a data item, the efficiency of querying the data item can be improved.
可选的,本发明实施例中,还可以在路由器的CPU或NP中存储物理数据表中的各个表项的各个数据项所属的逻辑数据表的标识。如此,可以在本发明实施例提供的存储物理数据表的方法执行过程中,通过硬件和/或软件的方式记录物理数据表中存储的某个数据项具体属于哪个逻辑数据表。从而,在需要应用某个数据项时,可以提高查询该数据项的效率。Optionally, in the embodiment of the present invention, the identifier of the logical data table to which each data item of each entry in the physical data table belongs may also be stored in the CPU or NP of the router. In this way, during the execution of the method for storing the physical data table provided by the embodiment of the present invention, the logical data and/or software may record the logical data table to which the certain data item stored in the physical data table belongs. Thus, when a certain data item needs to be applied, the efficiency of querying the data item can be improved.
可选的,本发明实施例中,上述物理数据表中的各个表项的各个数据项所属的逻辑数据表的标识可以存储在路由器的CPU或NP的内部(例如存储器集成在CPU或NP内部的情况),也可以存储在路由器的CPU或NP的外部(例如存储器设置在CPU或NP外部的情况)。Optionally, in the embodiment of the present invention, the identifier of the logical data table to which each data item of each entry in the physical data table belongs may be stored in a CPU or an NP of the router (for example, the memory is integrated in the CPU or the NP) Case) can also be stored outside the CPU or NP of the router (for example, when the memory is set outside the CPU or NP).
可选的,本发明实施例中,上述第一标识可以为能够唯一标识第一逻辑数据表的任意一个标识。该第一标识可以为一个数字、一个序列或者一个变量等,本发明实施例不作限定。上述第二标识可以为能够唯一标识第二逻辑数据表的任意一个标识,第三标识可以为能够唯一标识第三逻辑数据表的任意一个标识。第二标识和第三标识的具体实现形式可以参见对第一标识的具体实现形式的相关描述,此处不再赘述。Optionally, in the embodiment of the present invention, the first identifier may be any identifier that can uniquely identify the first logical data table. The first identifier may be a number, a sequence or a variable, and the like, which is not limited in the embodiment of the present invention. The second identifier may be any identifier that can uniquely identify the second logical data table, and the third identifier may be any identifier that can uniquely identify the third logical data table. For a specific implementation of the second identifier and the third identifier, refer to the related description of the specific implementation of the first identifier, and details are not described herein again.
可选的,以待存储的多个逻辑数据表中的数据项为例,在采用本发明实施例提供的存储物理数据表的方法将该多个逻辑数据表中的数据项存储至物理数据表之后,为了不修改现有的在物理数据表中查询数据项的机制,在采用本发明实施例提供的存储物理数据表的方法存储该多个逻辑数据表中的数据项时,可以将该多个逻辑数据表中属于同一逻辑数据表中的同一表项中的数据项存储至物理数据表中的同一表项(例如可以是物理数据表中与逻辑数据表中的该表项的排列序号相同的表项)。这样在查询数据项时,可以根据数据项在其所属的逻辑数据表中的表项的标识查找到该数据项在物理数据表中所在的表项,然后再在该表项中查找该数据项。Optionally, the data item in the plurality of logical data tables to be stored is used as an example, and the data items in the plurality of logical data tables are stored in the physical data table by using the method for storing the physical data table provided by the embodiment of the present invention. Then, in order to not modify the existing mechanism for querying the data item in the physical data table, when the data item in the plurality of logical data tables is stored by using the method for storing the physical data table provided by the embodiment of the present invention, The data items in the same table in the same logical data table are stored in the same table item in the physical data table (for example, the physical data table may be the same as the order number of the item in the logical data table) Table entry). When the data item is queried, the entry of the data item in the physical data table may be found according to the identifier of the entry in the logical data table to which the data item belongs, and then the data item is searched for in the entry. .
本发明实施例提供的存储物理数据表的方法,由于可以将多个逻辑数据表(例如上述第一逻辑数据表和第二逻辑数据表)中的表项的数据项(例如上述第一逻辑数据表中的第一表项的第一数据项和第二逻辑数据表中的第一表项的第一数据项)存储到 一个物理数据表中,因此可以只为该多个逻辑数据表中的表项中存在的数据项(即上述存储至物理数据表中的数据项)分配物理存储空间,而无需为整个逻辑数据表分配物理存储空间,从而能够节省存储物理数据表的设备的物理存储空间,进而提高该设备的物理存储空间的使用率。The method for storing a physical data table provided by the embodiment of the present invention, because a data item of an entry in a plurality of logical data tables (for example, the first logical data table and the second logical data table) may be used (for example, the first logical data described above) The first data item of the first entry in the table and the first data item of the first entry in the second logical data table are stored in one physical data table, and thus may be only in the plurality of logical data tables The data items existing in the entry (that is, the data items stored in the physical data table described above) allocate physical storage space without allocating physical storage space for the entire logical data table, thereby saving physical storage space of the device storing the physical data table. , thereby increasing the utilization rate of the physical storage space of the device.
本发明实施例提供的存储物理数据表的方法,可以在兼容现有查询数据项的机制的基础上,节省存储物理数据表的设备的物理存储空间,提高该设备的物理存储空间的使用率。The method for storing a physical data table provided by the embodiment of the present invention can save the physical storage space of the device storing the physical data table and improve the usage rate of the physical storage space of the device on the basis of the mechanism compatible with the existing query data item.
上述实施例主要从存储物理数据表的装置是路由器的角度对本发明实施例提供的方案进行了介绍。可以理解的是,本发明实施例提供的存储物理数据表的装置等为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本发明实施例能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法实现所描述的功能,但是这种实现不应认为超出本申请的范围。The foregoing embodiment mainly introduces the solution provided by the embodiment of the present invention from the perspective of a router that stores the physical data table. It is to be understood that the apparatus for storing physical data tables and the like provided by the embodiments of the present invention include hardware structures and/or software modules corresponding to the execution of the respective functions in order to implement the above functions. Those skilled in the art will readily appreciate that the embodiments of the present invention can be implemented in a combination of hardware or hardware and computer software in combination with the elements and algorithm steps of the various examples described in the embodiments disclosed herein. Whether a function is implemented in hardware or computer software to drive hardware depends on the specific application and design constraints of the solution. A person skilled in the art can implement the described functions using different methods for each particular application, but such implementation should not be considered to be beyond the scope of the present application.
本发明实施例可以根据上述方法示例对存储物理数据表的装置等进行功能模块的划分。例如,可以对应各个功能划分各个功能模块。需要说明的是,本发明实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。The embodiment of the present invention may perform the division of the function modules on the device or the like that stores the physical data table according to the above method. For example, each functional module can be divided for each function. It should be noted that the division of the module in the embodiment of the present invention is schematic, and is only a logical function division, and the actual implementation may have another division manner.
在采用对应各个功能划分各个功能模块的情况下,图9示出了本发明实施例提供的存储物理数据表的装置的一种可能的结构示意图。如图9所示,该装置可以包括:获取单元50和存储单元51。获取单元50可以用于支持该装置执行上述方法实施例中路由器执行的S101、S103、S105和S107;存储单元51可以用于支持该装置执行上述方法实施例中路由器执行的S102、S104、S106和S108。其中,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。FIG. 9 is a schematic diagram showing a possible structure of an apparatus for storing a physical data table according to an embodiment of the present invention. As shown in FIG. 9, the apparatus may include an acquisition unit 50 and a storage unit 51. The obtaining unit 50 may be configured to support the apparatus to perform S101, S103, S105, and S107 performed by the router in the foregoing method embodiment; the storage unit 51 may be configured to support the apparatus to execute S102, S104, S106 performed by the router in the foregoing method embodiment. S108. All the related content of the steps involved in the foregoing method embodiments may be referred to the functional descriptions of the corresponding functional modules, and details are not described herein again.
图10示出了本发明实施例提供的存储物理数据表的装置的一种可能的结构示意图。如图10所示,该装置可以包括:处理器60和存储器61。可选地,该装置还可以包括通信接口62。可选地,如图10所示,该装置还可以包括存储器63(该存储器63可以为该装置中通常使用的普通存储器,例如同步动态随机存储器(synchronous dynamic random access memory,SDRAM)等)。处理器60可以用于对该装置的动作进行控制管理,例如,处理器60可以用于支持该装置执行上述方法实施例中路由器执行的S101、S103、S105和S107,和/或用于本文所描述的技术的其它过程。存储器61可以用于存储本发明实施例提供的物理数据表,该存储器可以为SRAM存储器。通信接口62用于支持该装置与其他网络实体的通信,例如通信接口62可以用于支持该装置与终端设备交互。存储器63可以用于存储该装置执行的程序代码,例如,存储器63可以用于支持该装置执行上述方法实施例中路由器执行的S102、S104、S106和S108,和/或用于本文所描述的技术的其它过程。FIG. 10 is a schematic diagram showing a possible structure of an apparatus for storing a physical data table according to an embodiment of the present invention. As shown in FIG. 10, the apparatus can include a processor 60 and a memory 61. Optionally, the device may also include a communication interface 62. Optionally, as shown in FIG. 10, the apparatus may further include a memory 63 (which may be a general memory commonly used in the apparatus, such as a synchronous dynamic random access memory (SDRAM), etc.). The processor 60 can be used to control and manage the actions of the device. For example, the processor 60 can be used to support the device to perform S101, S103, S105, and S107 performed by the router in the foregoing method embodiment, and/or used in this document. Other processes of the described technology. The memory 61 can be used to store a physical data table provided by an embodiment of the present invention, and the memory can be an SRAM memory. Communication interface 62 is used to support communication of the device with other network entities, for example, communication interface 62 can be used to support the device to interact with the terminal device. The memory 63 can be used to store program code for execution by the apparatus, for example, the memory 63 can be used to support the apparatus to perform S102, S104, S106, and S108 performed by the routers in the above method embodiments, and/or for the techniques described herein. Other processes.
其中,处理器60可以是CPU、通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application-specific integrated circuit,ASIC)、 现场可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本发明实施例公开内容所描述的各种示例性的逻辑方框、模块和电路。上述处理器也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,DSP和微处理器的组合等等。示例性的,该处理器60可以是上述如图3所示的CPU 400a、CPU 403a、NP 405a、CPU 403b或者NP 405b或者这几种中的至少两种以上的组合。存储器61可以是上述如图3所示的路由器中的存储器404a或者存储器404b。存储器63可以是上述如图3所示的路由器中的普通存储器(图3中未示出)。通信接口62可以是物理接口卡、收发电路或通信接口等。示例性的,该通信接口62可以是上述如图3所示的物理接口卡406a或者物理接口卡406b。The processor 60 can be a CPU, a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), or a field programmable gate array (FPGA). Or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It is possible to implement or carry out the various illustrative logical blocks, modules and circuits described in connection with the embodiments of the invention. The above processors may also be a combination of computing functions, such as one or more microprocessor combinations, a combination of a DSP and a microprocessor, and the like. Exemplarily, the processor 60 may be the CPU 400a, the CPU 403a, the NP 405a, the CPU 403b, or the NP 405b as shown in FIG. 3 described above or a combination of at least two of these. The memory 61 may be the memory 404a or the memory 404b in the router shown in FIG. 3 described above. The memory 63 may be a normal memory (not shown in FIG. 3) in the above-described router as shown in FIG. Communication interface 62 can be a physical interface card, a transceiver circuit, or a communication interface. Illustratively, the communication interface 62 can be the physical interface card 406a or the physical interface card 406b as described above in FIG.
处理器60、存储器61、通信接口62以及存储器63可以通过总线连接。总线可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended Industry standard architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。The processor 60, the memory 61, the communication interface 62, and the memory 63 can be connected by a bus. The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, and the like.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件程序实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行该计算机指令时,全部或部分地产生按照本发明实施例中的流程或功能。该计算机可以是通用计算机、专用计算机、计算机网络或者其他可编程装置。该计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,该计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))方式或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心传输。该计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包括一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质(例如,软盘、磁盘、磁带)、光介质(例如,数字视频光盘(digital video disc,DVD))、或者半导体介质(例如固态硬盘(solid state drives,SSD))等。In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using a software program, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the processes or functions in accordance with embodiments of the present invention are generated in whole or in part. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be wired from a website site, computer, server or data center (for example, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (eg infrared, wireless, microwave, etc.) to another website, computer, server or data center. The computer readable storage medium can be any available media that can be accessed by a computer or a data storage device such as a server, data center, or the like that includes one or more available media. The usable medium may be a magnetic medium (for example, a floppy disk, a magnetic disk, a magnetic tape), an optical medium (for example, a digital video disc (DVD)), or a semiconductor medium (such as a solid state drives (SSD)). .
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and brevity of the description, only the division of the above functional modules is illustrated. In practical applications, the above functions can be allocated according to needs. It is completed by different functional modules, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. For the specific working process of the system, the device and the unit described above, reference may be made to the corresponding process in the foregoing method embodiments, and details are not described herein again.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present application, it should be understood that the disclosed system, apparatus, and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be another division manner, for example, multiple units or components may be used. Combinations can be integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显 示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e., may be located in one place, or may be distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The foregoing is only a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present application should be covered by the scope of the present application. . Therefore, the scope of protection of the present application should be determined by the scope of the claims.

Claims (11)

  1. 一种存储物理数据表的方法,其特征在于,包括:A method for storing a physical data table, comprising:
    获取第一逻辑数据表中的第一表项的第一数据项;Obtaining a first data item of the first entry in the first logical data table;
    将所述第一逻辑数据表中的第一表项的第一数据项存储至物理数据表的第一位置;And storing, by the first data item of the first entry in the first logical data table, a first location of the physical data table;
    获取第二逻辑数据表中的第一表项的第一数据项;Obtaining a first data item of the first entry in the second logical data table;
    将所述第二逻辑数据表中的第一表项的第一数据项存储至所述物理数据表的第二位置,所述第二位置不同于所述第一位置。And storing a first data item of the first entry in the second logical data table to a second location of the physical data table, the second location being different from the first location.
  2. 根据权利要求1所述的方法,其特征在于,The method of claim 1 wherein
    所述第一位置位于所述物理数据表中的第一表项,所述第二位置位于所述物理数据表中的第二表项。The first location is located in a first entry in the physical data table, and the second location is located in a second entry in the physical data table.
  3. 根据权利要求1或2所述的方法,其特征在于,所述方法还包括:The method according to claim 1 or 2, wherein the method further comprises:
    获取第三逻辑数据表中的第一表项的第一数据项;Obtaining a first data item of the first entry in the third logical data table;
    将所述第三逻辑数据表中的第一表项的第一数据项存储至所述物理数据表的第三位置,所述第三位置位于所述物理数据表中的第一表项,所述第三位置不同于所述第一位置。And storing a first data item of the first entry in the third logical data table to a third location of the physical data table, where the third location is located in a first entry in the physical data table, where The third position is different from the first position.
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:The method of claim 3, wherein the method further comprises:
    获取所述第一逻辑数据表中的第一表项的第二数据项;Obtaining a second data item of the first entry in the first logical data table;
    将所述第一逻辑数据表中的第一表项的第二数据项存储至所述物理数据表的第四位置,所述第四位置位于所述物理数据表中的第一表项,所述第四位置不同于所述第一位置和所述第三位置。And storing a second data item of the first entry in the first logical data table to a fourth location of the physical data table, where the fourth location is located in a first entry in the physical data table, where The fourth position is different from the first position and the third position.
  5. 根据权利要求1至4任意一项所述的方法,其特征在于,A method according to any one of claims 1 to 4, characterized in that
    所述第一位置还存储有第一标识,所述第一标识用于标识所述第一逻辑数据表;The first location further stores a first identifier, where the first identifier is used to identify the first logical data table;
    所述第二位置还存储有第二标识,所述第二标识用于标识所述第二逻辑数据表。The second location further stores a second identifier, where the second identifier is used to identify the second logical data table.
  6. 一种存储物理数据表的装置,其特征在于,包括获取单元和存储单元,An apparatus for storing a physical data table, comprising: an acquiring unit and a storage unit,
    所述获取单元,用于获取第一逻辑数据表中的第一表项的第一数据项;The obtaining unit is configured to acquire a first data item of the first entry in the first logical data table;
    所述存储单元,用于将所述获取单元获取的所述第一逻辑数据表中的第一表项的第一数据项存储至物理数据表的第一位置;The storage unit is configured to store the first data item of the first entry in the first logical data table acquired by the acquiring unit to a first location of the physical data table;
    所述获取单元,还用于获取第二逻辑数据表中的第一表项的第一数据项;The obtaining unit is further configured to acquire a first data item of the first entry in the second logical data table;
    所述存储单元,还用于将所述获取单元获取的所述第二逻辑数据表中的第一表项的第一数据项存储至所述物理数据表的第二位置,所述第二位置不同于所述第一位置。The storage unit is further configured to store the first data item of the first entry in the second logical data table acquired by the acquiring unit to a second location of the physical data table, where the second location Different from the first position.
  7. 根据权利要求6所述的装置,其特征在于,The device of claim 6 wherein:
    所述第一位置位于所述物理数据表中的第一表项,所述第二位置位于所述物理数据表中的第二表项。The first location is located in a first entry in the physical data table, and the second location is located in a second entry in the physical data table.
  8. 根据权利要求6或7所述的装置,其特征在于,Device according to claim 6 or 7, characterized in that
    所述获取单元,还用于获取第三逻辑数据表中的第一表项的第一数据项;The obtaining unit is further configured to acquire a first data item of the first entry in the third logical data table;
    所述存储单元,还用于将所述获取单元获取的所述第三逻辑数据表中的第一表项的第一数据项存储至所述物理数据表的第三位置,所述第三位置位于所述物理数据表中的第一表项,所述第三位置不同于所述第一位置。The storage unit is further configured to store, by the acquiring unit, a first data item of the first entry in the third logical data table to a third location of the physical data table, where the third location The first entry in the physical data table, the third location being different from the first location.
  9. 根据权利要求8所述的装置,其特征在于,The device of claim 8 wherein:
    所述获取单元,还用于获取所述第一逻辑数据表中的第一表项的第二数据项;The obtaining unit is further configured to acquire a second data item of the first entry in the first logical data table;
    所述存储单元,还用于将所述获取单元获取的所述第一逻辑数据表中的第一表项的第二数据项存储至所述物理数据表的第四位置,所述第四位置位于所述物理数据表中的第一表项,所述第四位置不同于所述第一位置和所述第三位置。The storage unit is further configured to store, by the acquiring unit, a second data item of the first entry in the first logical data table to a fourth location of the physical data table, where the fourth location a first entry located in the physical data table, the fourth location being different from the first location and the third location.
  10. 根据权利要求6至9任意一项所述的装置,其特征在于,Device according to any one of claims 6 to 9, characterized in that
    所述第一位置还存储有第一标识,所述第一标识用于标识所述第一逻辑数据表;The first location further stores a first identifier, where the first identifier is used to identify the first logical data table;
    所述第二位置还存储有第二标识,所述第二标识用于标识所述第二逻辑数据表。The second location further stores a second identifier, where the second identifier is used to identify the second logical data table.
  11. 一种存储物理数据表的装置,其特征在于,包括处理器和与所述处理器耦合连接的存储器;An apparatus for storing a physical data table, comprising: a processor and a memory coupled to the processor;
    所述处理器用于执行如权利要求1至5任意一项所述的存储物理数据表的方法,所述存储器用于存储所述物理数据表。The processor is configured to perform the method of storing a physical data table according to any one of claims 1 to 5, the memory being configured to store the physical data table.
PCT/CN2018/075284 2017-03-08 2018-02-05 Method and device for storing physical data table WO2018161751A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710134672.5 2017-03-08
CN201710134672.5A CN108572962B (en) 2017-03-08 2017-03-08 Method and device for storing physical data table

Publications (1)

Publication Number Publication Date
WO2018161751A1 true WO2018161751A1 (en) 2018-09-13

Family

ID=63448425

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/075284 WO2018161751A1 (en) 2017-03-08 2018-02-05 Method and device for storing physical data table

Country Status (2)

Country Link
CN (1) CN108572962B (en)
WO (1) WO2018161751A1 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103577590A (en) * 2013-11-12 2014-02-12 北京润乾信息系统技术有限公司 Data query method and system
CN104679445A (en) * 2013-01-02 2015-06-03 国际商业机器公司 Method and system for deduplicating data
CN106471489A (en) * 2014-06-30 2017-03-01 微软技术许可有限责任公司 Management has the data of flexible modes

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104615564A (en) * 2015-02-05 2015-05-13 浪潮电子信息产业股份有限公司 Data transmission method based on QPI bus and computer system
CN106294191B (en) * 2015-05-26 2019-07-09 华为技术有限公司 The method for handling table, the method and apparatus for accessing table

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104679445A (en) * 2013-01-02 2015-06-03 国际商业机器公司 Method and system for deduplicating data
CN103577590A (en) * 2013-11-12 2014-02-12 北京润乾信息系统技术有限公司 Data query method and system
CN106471489A (en) * 2014-06-30 2017-03-01 微软技术许可有限责任公司 Management has the data of flexible modes

Also Published As

Publication number Publication date
CN108572962A (en) 2018-09-25
CN108572962B (en) 2020-11-17

Similar Documents

Publication Publication Date Title
US8891375B2 (en) System and method for virtual Ethernet interface binding
US20160164963A1 (en) Method, system, and device for managing server hardware resources in a cloud scheduling environment
US10425354B2 (en) Resource allocation method, packet communication method, and apparatus
JP5594171B2 (en) Communication processing apparatus, address learning program, and address learning method
US10503565B2 (en) System and method for multicasting data between networking interfaces of hypervisors
WO2014101777A1 (en) Flow table matching method and device, and switch
WO2022116848A1 (en) Packet transmission method and apparatus, computer device, and storage medium
JP5826320B2 (en) Network location service
US20180351878A1 (en) Multicast data packet forwarding
US20130094514A1 (en) Method and switch for sending packet
WO2015027806A1 (en) Read and write processing method and device for memory data
WO2018113701A1 (en) Resource scheduling method
CN107493222B (en) VXLAN message forwarding method and device
US20090164630A1 (en) Network adapter based zoning enforcement
CN104168338A (en) Network address conversion device and network address conversion method
WO2016138845A1 (en) Method and device realizing upload of protocol packet to cpu
WO2016101439A1 (en) Space processing method and device for ternary content addressable memory (tcam)
WO2021103657A1 (en) Network operation method, apparatus, and device and storage medium
WO2016177180A1 (en) Method and device for reporting openflow switch capability
WO2016090848A1 (en) Method and device for managing table space of ternary content addressable memory
US10938721B2 (en) Hash collision mitigation system
US20210243248A1 (en) Cloud service load balancing
US9667540B2 (en) Fiber channel over ethernet (FCoE) frame forwarding system
WO2017036384A1 (en) Provider edge device and data forwarding method
CN109617817B (en) Method and device for generating forwarding table entry of MLAG networking

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18764290

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18764290

Country of ref document: EP

Kind code of ref document: A1