Data sharding storage method, device, electronic device and storage medium
The fragment identification code is determined by the type allocation code of the International Mobile Equipment Identity Code and the final assembly location code, and the index identification code is determined by combining the serial number, which realizes the rapid positioning of IMEI and solves the complexity of maintaining the mapping relationship between IMEI and Index ID. solves the problem and improves system performance and storage efficiency.
Patent Information
- Application Number
- CN202110725937.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-29
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-06-29
AI Technical Summary
In the existing technology, the forward and reverse mapping relationship between the International Mobile Equipment Identity (IMEI) and Index ID requires additional storage and maintenance, which increases system complexity and resource consumption.
The fragment identification code is determined by the type allocation code of the International Mobile Equipment Identity Code and the final assembly location code, and the index identification code is determined by combining the serial number to realize fragmented storage of data and avoid the generation and maintenance of additional mapping relationships.
It reduces storage resources and system complexity, improves system performance, can quickly find the storage location of each IMEI, and saves storage costs and mapping overhead.
Smart Images

Figure CN113343042B
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and specifically relates to a data sharding storage method, device, electronic device and storage medium. Background Art
[0002] In order to provide users with personalized recommendations, user portraits, advertisements, etc., a large amount of user data needs to be stored and analyzed. The identification code of the mobile device is the basis for analyzing user behavior data. In actual business systems, the International Mobile Equipment Identity (IMEI) is used to identify each independent mobile device in the mobile network, which is equivalent to the ID card of the mobile device.
[0003] In the prior art, user behavior data is stored and analyzed, and a bitmap or bit-sliced index (BSI) structure is used to store and calculate data, and users are located by features or their features are determined by users. At the same time, the storage system shards the full amount of IMEI to improve the system's computing power. Generally, sharding is based on the mapped index identification code (Indentity Document, ID). The shard information can only be obtained through the mapped Index ID and cannot be directly determined through the International Mobile Equipment Identity Code.
[0004] However, the system needs to generate and maintain the forward and reverse mapping relationship between the Index ID and the IMEI for subsequent storage calculation and IMEI positioning, and needs to restore the Index ID to the specific IMEI to ensure data consistency between the two. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a data sharding storage method, device, electronic device and storage medium, which can solve the problem of requiring additional storage and maintenance of the forward and reverse mapping relationship between IMEI and Index ID.
[0006] In a first aspect, an embodiment of the present application provides a data sharding storage method, the method comprising:
[0007] Determine the slice identification code corresponding to the International Mobile Equipment Identity IMEI according to the type allocation code and the final assembly location code;
[0008] Determine an index identification code corresponding to the IMEI according to the type allocation code, the final assembly location code and the serial number of the IMEI;
[0009] The shard identifier and the index identifier are stored.
[0010] In a second aspect, an embodiment of the present application provides a data sharding storage device, the device comprising:
[0011] A first determination module is used to determine a fragment identification code corresponding to an International Mobile Equipment Identity code IMEI according to a type allocation code and a final assembly location code;
[0012] A second determination module is used to determine the index identification code corresponding to the IMEI according to the type allocation code, the final assembly site code and the serial number of the IMEI;
[0013] A storage module is used to store the slice identification code and the index identification code.
[0014] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0015] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0016] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0017] In an embodiment of the present application, a shard identification code is obtained through the type allocation code and the final assembly location code of the international mobile equipment identity code, and an index serial number is obtained through the type allocation code, the final assembly location code and the serial number of the international mobile equipment identity code. The characteristics of the IMEI itself are split and stored in the form of shard serial numbers and index serial numbers for distributed storage. There is no need to additionally generate and maintain the forward and reverse mapping relationship between the IMEI and the Index ID. At the same time, the storage location corresponding to each IMEI can be quickly found, thereby reducing storage resources and system complexity and improving system performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flowchart of the union operation between groups of people provided by the prior art;
[0019] Figure 2 This is one of the flow charts of the data sharding storage method provided in the embodiment of the present application;
[0020] Figure 3 This is the second flow chart of the data sharding storage method provided in the embodiment of the present application;
[0021] Figure 4 It is a structural diagram of a data sharding storage device provided in an embodiment of the present application;
[0022] Figure 5 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0024] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0025] The embodiments of the present application are described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0026] The data sharding storage method provided in the embodiment of the present application can be applied to analyze user behavior data, locate people by features or determine their features by users, so as to realize personalized recommendation, user portrait, advertising and other services. The data analysis and storage technology of the current big data analysis and processing business system may use Bitmap and BSI structures for data storage and calculation.
[0027] Figure 1 This is a flow chart of the union operation between groups of people provided by the prior art, such as Figure 1 As shown, taking the recommendation system as an example, assuming that a certain activity needs to be recommended to female users aged 20-30 in a certain city, three user groups can be obtained, user group A represents users in the city, user group B represents users aged 20-30, and user group C represents female users.
[0028] There are 10 users in total, with IDs 1 to 10. In each user group Bitmap, a bit of 1 means that the user is in the user group, and a bit of 0 means that the user is not in the user group. Then the IDs of "female users aged 20-30 in a certain city" that meet the condition are displayed as 3 and 4, and finally the users corresponding to these two IDs are recommended.
[0029] In actual business systems, IMEI is used as the basis for analyzing user behavior data. IMEI is used to identify each independent mobile device in the mobile device network, which is equivalent to the ID card of the mobile device.
[0030] The data sharding storage method provided in the embodiment of the present application is described below using the example of IMEI 869456039964691.
[0031] For this IMEI, the first part of the Type Allocation Code (TAC) is "869456", a total of 6 digits, used to distinguish the brand and model of mobile devices. This code is allocated by the Global System for Mobile Communications Association (GSMA) and its authorized agencies. The first two digits "86" are the Reporting Body Identifier, which is the code of the authorized IMEI code allocation agency, also known as the country code, and China is "86".
[0032] The second part, the Final Assembly Code (FAC), is "03", a total of 2 digits, and is used by manufacturers to distinguish production site codes internally.
[0033] The third part, the serial number (SNR), is "996469", a total of 6 digits, which is used to distinguish the production serial number of each mobile device.
[0034] The fourth part of the verification code (Check Digit, CD) is "1", which is calculated from the first 14 digits through the modulo 10 (Luhn) algorithm. After the current 14 digits are determined, the CD is also determined.
[0035] Figure 2 This is one of the flow charts of the data sharding storage method provided in the embodiment of the present application, such as Figure 2 As shown, an embodiment of the present application provides a data sharding storage method, the method comprising:
[0036] Step 201: Determine a slice identification code corresponding to the International Mobile Equipment Identity IMEI according to the type allocation code and the final assembly location code of the IMEI.
[0037] Specifically, the slice identification code corresponding to the IMEI is determined according to the TAC and FAC of the IMEI.
[0038] TAC has 6 digits in total, the first 2 digits are the identification of the allocation organization, which can be left unprocessed and used as part of the fragment identification code. These 2 digits can also be left unprocessed as part of the fragment identification code. Generally speaking, for a certain application manufacturer, equipment manufacturer or Internet company, the country code of the IMEI processed is basically the same, and not distinguishing the country code will not affect the number of fragments obtained by fragmenting the IMEI, so the country code can be left unprocessed as part of the fragment identification code.
[0039] The last 4 bits of TAC are divided to determine the quotient, which is used as part of the slice identification code. The slice identification code of this part is generally represented by 1 bit.
[0040] FAC is 2 digits in total, indicating the place of production. FAC is divided to determine the quotient as part of the shard identification code. To be compatible with more production locations, this part of the shard identification code can be represented by 2 digits, and the high digits are filled with 0 if they are less than two digits.
[0041] The embodiments of the present application do not limit the position of the quotient value determined by dividing the TAC, the country code, and the quotient value determined by dividing the FAC in the slice identification code.
[0042] For example, for IMEI 869456039964691, "86" is used as the first two digits of the fragment identification code; for "9456", the quotient of 1000 is taken, the quotient value is 9, and "9" is used as the third digit of the fragment identification code; for "03", the quotient of 4 is taken, the quotient value is 0, and "00" is used as the last two digits of the fragment identification code. The fragment identification code is finally determined to be "86900".
[0043] For example, for IMEI 869456039964691, "86" is used as the first two digits of the fragment identification code; for "9456", the quotient of 1005 is taken, and the quotient value is 9, and "9" is used as the third digit of the fragment identification code; for "03", the quotient of 2 is taken, and the quotient value is 1, and "01" is used as the last two digits of the fragment identification code. The fragment identification code is finally determined to be "86901".
[0044] For example, for IMEI 869456039964691, the quotient of 1000 is taken for "9456", and the quotient value is 9, and "9" is used as the first digit of the fragment identification code; "86" is used as the second and third digits of the fragment identification code; the quotient of 4 is taken for "03", and the quotient value is 0, and "00" is used as the last two digits of the fragment identification code. The fragment identification code is finally determined to be "98600".
[0045] For example, for IMEI 869456039964691, the quotient of 1000 is taken for "9456", and the quotient value is 9, and "9" is used as the first digit of the fragment identification code; the quotient of 4 is taken for "03", and the quotient value is 0, and "00" is used as the second and third digits of the fragment identification code; "86" is used as the last two digits of the fragment identification code. The fragment identification code is finally determined to be "90086".
[0046] For example, for IMEI 869456039964691, the quotient of 1000 is taken for "9456", and the quotient value is 9, and "9" is used as the first digit of the fragment identification code; the quotient of 4 is taken for "03", and the quotient value is 0, and "00" is used as the second and third digits of the fragment identification code. The fragment identification code is finally determined to be "900".
[0047] Step 202: Determine an index identification code corresponding to the IMEI according to the type allocation code, the final assembly location code and the serial number of the IMEI.
[0048] Specifically, the index identification code corresponding to the IMEI is determined according to the TAC, FAC and SNR of the IMEI.
[0049] After the last four bits of TAC are divided, the quotient is used as part of the slice identification code, and the corresponding remainder can be used as part of the index identification code.
[0050] After the FAC performs a division operation, the quotient is used as a part of the fragment identification code, and the corresponding remainder can be used as a part of the index identification code.
[0051] The SNR is 6 bits in total and can be fully represented using 20 bits of binary as part of the index identification code.
[0052] Among them, the computing system based on Bitmap storage can store up to 32 bits of binary identification code, and the 6-bit decimal SNR can be fully represented by 20 bits when converted into binary, and the high bits that are insufficient are filled with 0.
[0053] The remainder after the division operation of the last four digits of TAC can be converted into binary and can be represented by 10 bits. The maximum decimal number that can be represented by 10 bits of binary is 1024. Therefore, when the last four digits of TAC are divided, the maximum divisor can be 1025. Preferably, 1000 is used as the divisor in the embodiment of the present application.
[0054] After the FAC is divided, the remainder is converted into binary and can be represented by 2 bits. The maximum decimal number that can be represented by 2 bits of binary is 3. Therefore, when the FAC is divided, the maximum divisor can be 4. Preferably, 4 is used as the divisor in the embodiment of the present application.
[0055] For example, for the IMEI of 869456039964691, the remainder of 4 for "03" is 3, which is converted into binary "11" as the 31st-32nd bits of the 32-bit index identification code; the remainder of 1000 for "9456" is 456, which is converted into binary "111001000", and "0111001000" is used as the 21st-30th bits of the 32-bit index identification code; "996469" is converted into binary "11110011010001110101" as the 1st-20th bits of the 32-bit index identification code. The final 32-bit index identification code is "11011100100011110011010001110101".
[0056] For example, for the IMEI of 869456039964691, the remainder of 1000 for "9456" is 456, which is converted into binary "111001000", and "0111001000" is used as the 23rd to 32nd bits of the 32-bit index identification code; the remainder of 4 for "03" is 3, which is converted into binary "11" as the 21st to 22nd bits of the 32-bit index identification code; "996469" is converted into binary "11110011010001110101" as the 1st to 20th bits of the 32-bit index identification code. The final 32-bit index identification code is "01110010001111110011010001110101".
[0057] For example, for the IMEI of 869456039964691, the remainder of 1000 for "9456" is 456, which is converted into binary "111001000", and "0111001000" is used as the 23rd to 32nd bits of the 32-bit index identification code; "996469" is converted into binary "11110011010001110101" as the 3rd to 22nd bits of the 32-bit index identification code; the remainder of 4 for "03" is 3, which is converted into binary "11" as the 1st to 2nd bits of the 32-bit index identification code. The final 32-bit index identification code is "01110010001111001101000111010111".
[0058] For example, for the IMEI of 869456039964691, the remainder of 4 for "03" is 3, which is converted into binary "11" as the 31st-32nd bits of the 32-bit index identification code; "996469" is converted into binary "11110011010001110101" as the 11th-30th bits of the 32-bit index identification code; the remainder of 1000 for "9456" is 456, which is converted into binary "111001000", and "0111001000" is used as the 1st-10th bits of the 32-bit index identification code. The final 32-bit index identification code is "1111110011010001110101010111001000".
[0059] It can be imagined that when the last four digits of TAC are divided, the remainder is converted into binary to obtain code 1, the remainder after FAC division is converted into binary to obtain code 2, and SNR is converted into binary to obtain code 3. After the number of bits of any two codes in the index identification code is fixed, there is no limit on the number of bits of the third code in the index identification code.
[0060] For example, the first 2 bits of the index identification code are code 2, and the last 10 bits are code 1. If the high bits are not enough, 0 is added. Then the middle bits represent code 3, and the number of bits corresponding to code 3 is less than or equal to 20 bits.
[0061] For example, the first 2 bits of the index identification code are code 2, and the last 20 bits are code 3. If the high bits are not enough, 0 is added. Then the middle bits represent code 1, and the number of bits corresponding to code 1 is less than or equal to 10 bits.
[0062] What is obtained at this time is an index identification code represented in binary format, which can also be subjected to unsigned integer shaping to make the range of numbers corresponding to the IMEI that can be represented larger.
[0063] Step 203: Store the slice identification code and the index identification code.
[0064] Specifically, after the slice identification code and the index identification code of the IMEI are determined, the slice information and the index information of the IMEI are obtained, and the slice identification code and the index identification code are stored.
[0065] In a computing system based on Bitmap storage, the corresponding storage location can be quickly found according to the slice identification code and index identification code corresponding to each IMEI.
[0066] At the same time, for IMEIs with the same slice identification code, different IMEIs can be determined from different index identification codes in the slices.
[0067] The data sharding storage method provided in the embodiment of the present application obtains a sharding identification code through the type allocation code and the final assembly location code of the international mobile equipment identity code, obtains an index serial number through the type allocation code, the final assembly location code and the serial number of the international mobile equipment identity code, splits the characteristics of the IMEI itself, and stores them in the form of sharding serial numbers and index serial numbers for distributed storage. There is no need to additionally generate and maintain the forward and reverse mapping relationship between the IMEI and the Index ID. At the same time, the storage location corresponding to each IMEI can be quickly found, thereby reducing storage resources and system complexity and improving system performance.
[0068] Optionally, the determining the slice identification code corresponding to the IMEI according to the type allocation code and the final assembly location code of the International Mobile Equipment Identity IMEI includes:
[0069] Determine a first quotient value of the last four digits of the type allocation code divided by the first number;
[0070] determining a second quotient of the final assembly location code divided by a second number;
[0071] The slice identification code is determined according to the first quotient value and the second quotient value.
[0072] Specifically, the slice identification code is determined by TAC and FAC corresponding to IMEI, and the different components of the slice identification code are obtained by dividing TAC and FAC respectively, thereby finally achieving the slice of the full IMEI.
[0073] The first two digits of TAC are the identifier of the allocating agency, which can also be called the country code. In actual business operations, the same country manages the IMEIs it authorizes to allocate. Therefore, the country code has little effect on distinguishing in the fragmented sequence number. When fragmenting the mobile device identification code of the same country, the country code can be left unprocessed.
[0074] The last four digits of TAC are divided to determine the first quotient. Due to the limitation of the number of digits of the 32-bit index identification code, the remainder obtained by dividing the last four digits of TAC can be represented by 10 digits at most after being converted into binary. Therefore, when the last four digits of TAC are divided, the maximum first digit can be 1025. When the first digit is too small, the corresponding fragmentation code will increase, and too many fragments will increase the complexity of the system.
[0075] Preferably, the first number may be 1000, and the value corresponding to the first quotient is 1-9, which is represented by 1 bit in the slice identification code.
[0076] Perform a division operation on FAC to determine the second quotient value. FAC represents the place of production. Assuming that a manufacturer has 4 places of production, then FAC is 01-04, the second digit is 4, and the remainder is 0-3, which can be fully represented by 2 bits of binary. To be compatible with more places of production, the second quotient value is represented by 2 bits in the fragment identification code, and 0 is added when the high bit is insufficient. Due to the limitation of the number of bits of the 32-bit index identification code, the remainder obtained after the division operation of FAC can be converted into binary and can be represented by a maximum of 2 bits, so the maximum second digit can be 4, and the corresponding maximum remainder is 3. The second digit can be 1, 2, 3, or 4.
[0077] The position of the first quotient value, the second quotient value and the country code in the slice identification code is not limited in this application. For example, for the IMEI of 869456039964691, the quotient value of "03" is 4, the first quotient value is 0, and it is represented by "00" in the slice identification code; the quotient value of "9456" is 1000, the first quotient value is 9; the country code is "86". Then the slice identification code can be "90086", "98600", "00869", "00986", "86900", "86009", "009" and "900".
[0078] The data sharding storage method provided in the embodiment of the present application determines the corresponding sharding identification code through the last four digits of the TAC and FAC of the IMEI, provides a sharding solution, does not need to generate and maintain the mapping relationship between the IMEI and the Index ID, saves storage resources, and can obtain the shard where the IMEI is located through the sharding identification code, thereby quickly obtaining feature or tag data information through the concurrent reading capability of a remote dictionary service (Remote Dictionary Server, Redis) cluster, thereby improving system performance.
[0079] Optionally, the determining the slice identification code corresponding to the IMEI according to the type allocation code and the final assembly location code of the International Mobile Equipment Identity IMEI includes:
[0080] Determine a first quotient value of the last four digits of the type allocation code divided by the first number;
[0081] determining a second quotient of the final assembly location code divided by a second number;
[0082] The slice identification code is determined according to the first quotient value, the second quotient value and first two bits of the type allocation code.
[0083] Specifically, the fragmentation identification code is determined by the TAC and FAC corresponding to the IMEI. The quotient is determined by dividing the last four digits of the TAC and the FAC respectively, and then the first two digits of the TAC are added to obtain the different components of the fragmentation identification code, thereby finally achieving fragmentation of the full IMEI.
[0084] The first two digits of TAC are the identification of the allocation agency, which can also be called the country code. In actual business operations, the same country manages the IMEIs it authorizes to allocate. If the country codes corresponding to the IMEIs in the database are not exactly the same, the country code can be used as part of the fragment identification code to further distinguish the IMEIs. If the country codes are the same, the country code as part of the fragment identification code will not increase the number of fragments of the full IMEI.
[0085] The data sharding storage method provided in the embodiment of the present application determines the corresponding sharding identification code through the last four digits of the TAC of the IMEI, the first two digits of the TAC and the FAC, and provides a sharding solution. There is no need to generate and maintain the mapping relationship between the IMEI and the Index ID, which saves storage resources. The shard where the IMEI is located can be obtained through the sharding identification code, so as to quickly obtain the characteristics or label data information through the concurrent reading capability of the Remote Dictionary Server (Redis) cluster, thereby improving the system performance.
[0086] Optionally, determining the index identification code corresponding to the IMEI according to the type allocation code, the final assembly location code and the serial number of the IMEI includes:
[0087] determining a first remainder of dividing the last four digits of the type allocation code by the first digit;
[0088] determining a second remainder of dividing the final assembly location code by the second number;
[0089] The index identification code is determined according to the first remainder, the second remainder and the sequence number.
[0090] Specifically, the Index ID is determined based on the TAC, FAC and SNR corresponding to the IMEI. The remainder is determined by dividing the last four digits of the TAC and the FAC, and then the SNR is added to obtain the different components of the Index ID.
[0091] For different IMEIs, their corresponding shard identification codes may be the same, so it is also necessary to distinguish the data in the shard to obtain the corresponding storage location of each IMEI in the distributed system. Taking a computing system based on Bitmap storage as an example, different Bitmaps in each shard correspond to different IMEIs.
[0092] The last four digits of the type allocation code are divided to determine the first remainder. After the TAC is divided, the quotient is used as part of the slice identification code, and the remainder is used as part of the index identification code, so as to ensure the consistency between the IMEI and the index identification code and the slice identification code. The first remainder is converted into a binary representation as part of the index identification code.
[0093] The final assembly location code is divided to determine the second remainder. After the FAC is divided, the quotient is used as part of the slice identification code, and the remainder is used as part of the index identification code, so that the consistency between the IMEI and the index identification code and the slice identification code can be ensured. The second remainder is converted into a binary representation as part of the index identification code.
[0094] For different IMEIs, their TAC and FAC may be the same, so it is inaccurate to determine the index identification code based only on FAC and TAC. It is also necessary to combine SNR to ensure that each IMEI has its unique corresponding set of fragment identification codes and index identification codes.
[0095] The embodiment of the present application does not limit the corresponding positions of the first remainder, the second remainder and the SNR in the index identification code. For example, for the IMEI of 869456039964691, the remainder of 1000 for "9456" is 456, which is converted to binary "111001000" and represented by "0111001000" in the 32-bit index identification code; the remainder of 4 for "03" is 3, which is converted to binary "11"; the SNR is "996469", which is converted to binary "11110011010001110101". The index identification code can be: “11111001000011110011010001110101”, “0111001000111110011010001110101”, “1111001101000111010101110111001000”, “1111001101000111010101011100100011”, “1111001101000111010101011100100011” and “11011100100011110011010001110101”.
[0096] It is conceivable that, for the first remainder, the second remainder and the SNR, after the number of bits of any two of them encoded in the index identification code is fixed, there is no restriction on the number of bits of the third one encoded in the index identification code.
[0097] For example, when the fixed SNR is the first 20 bits of the index identification code, the second remainder is the last 2 bits of the index identification code. For the IMEI of 869456039964691, the remainder of 1000 for "9456" is 456, which is converted to binary "111001000"; the remainder of 4 for "03" is 3, which is converted to binary "11"; the SNR is "996469", which is converted to binary "11110011010001110101". Then the index identification code is "1111001101000111010111100100011", with a total of 32 bits.
[0098] For IMEI 869003039964691, the remainder of 1000 for "9003" is 3, which is converted to binary "11"; the remainder of 4 for "03" is 3, which is converted to binary "11"; SNR is "996469", which is converted to binary "11110011010001110101". The index identification code is "111100110100011101011111", which is 24 bits in total.
[0099] For example, when the fixed second remainder is the first 2 digits of the index identification code, the first remainder is the last 10 digits of the index identification code. For the IMEI of 869456039964691, the remainder of 1000 for "9456" is 456, which is converted to binary "111001000"; the remainder of 4 for "03" is 3, which is converted to binary "11"; the SNR is "996469", which is converted to binary "11110011010001110101". Then the index identification code is "1111110011010001110101010111001000", with a total of 32 digits.
[0100] For IMEI 8694560300321191, the remainder of 1000 for "9456" is 456, which is converted to binary "111001000"; the remainder of 4 for "03" is 3, which is converted to binary "11"; SNR is "003211", which is converted to binary "110010001011". The index identification code is "111100100010110111001000", a total of 24 bits.
[0101] The data sharding storage method provided in the embodiment of the present application determines the corresponding index identification code through the last four digits of the TAC, FAC and SNR of the IMEI, and distinguishes different IMEIs through the index identification code when the shard identification codes are the same, so as to realize rapid positioning of each IMEI in the system. At the same time, since there is a one-to-one correspondence between a group of index identification codes, shard identification codes and IMEIs, there is no need to generate and maintain the forward and reverse mapping relationship between the IMEI and the index identification code, nor is there any need to consider the consistency between the mappings, which saves storage costs and mapping overhead and reduces the complexity of the system.
[0102] Optionally, determining the index identification code according to the first remainder, the second remainder and the sequence number includes:
[0103] Determine a first part of the index identification code according to the first remainder; the first part includes 10 bits;
[0104] Determine a second part of the index identification code according to the second remainder; the second part includes 2 bits;
[0105] The third part of the index identification code is determined according to the serial number; the third part includes 20 bits.
[0106] Specifically, the index identification code is determined according to the first remainder, the second remainder and the SNR. In the 32-bit index identification code, the first remainder occupies 10 bits, the second remainder occupies 2 bits, and the SNR occupies 20 bits.
[0107] For computing systems based on Bitmap storage or BSI structure storage, the data that can be stored and calculated can support 32-bit binary data operation at most, that is, the index identification code is at most 32 bits. SNR has 6 bits in total and can be fully represented by 20 bits of binary. FAC has 2 bits in total. When limiting the division operation of FAC, the maximum divisor is 4, so the second remainder can be fully represented by 2 bits of binary.
[0108] For the last four digits of TAC, after the division operation, the remainder is at most 4 digits. For the 4-digit decimal conversion to binary, considering the limit of the number of digits of the index identification code, the number of digits of the first remainder in the index identification code is limited to 10 digits at most. The maximum decimal number that can be represented by 10-bit binary is 1024, so when the last four digits of TAC are divided, the maximum divisor can be 1025.
[0109] The embodiments of the present application do not limit the positions of the first remainder, the second remainder and the SNR in the 32-bit index identification code.
[0110] For example, for the IMEI of 869456039964691, the remainder of 1000 for "9456" is 456, which is converted to binary "111001000"; the remainder of 4 for "03" is 3, which is converted to binary "11"; the SNR is "996469", which is converted to binary "11110011010001110101". The index identification code can be “01110010001111110011010001110101”, “11011100100011110011010001110101”, “1111001101000111010101011100100011”, “1111001101000111010101110111001000”, “0111001000111100110100011101010111” or “1111110011010001110101010111001000”, all of which are 32 bits.
[0111] The data sharding storage method provided in the embodiment of the present application determines the corresponding index identification code through the last four digits of the TAC, FAC and SNR of the IMEI, and fixes the length of the index identification code. When the sharding identification codes are the same, different IMEIs are distinguished by the index identification code, so that each IMEI can be quickly located in the system. At the same time, since there is a one-to-one correspondence between each group of index identification codes, sharding identification codes and IMEIs, there is no need to generate and maintain the forward and reverse mapping relationship between the IMEI and the index identification code, and there is no need to consider the consistency between the mappings, which saves storage costs and mapping overhead and reduces the complexity of the system.
[0112] Optionally, after storing the shard identification code and the index identification code, the method further includes:
[0113] The IMEI is restored according to the slice identification code and the index identification code.
[0114] Specifically, each IMEI corresponds to a unique set of fragment identification codes and index identification codes, so any set of fragment identification codes and index identification codes can be restored to the corresponding IMEI.
[0115] After the generation rules of the fragment identification code and the index identification code are fixed, there is a one-to-one correspondence between each group of fragment identification codes and index identification codes and the IMEI.
[0116] A specific embodiment is used to illustrate this below. Figure 3 This is a second flow chart of the data sharding storage method provided in the embodiment of the present application, such as Figure 3As shown, an embodiment of the present application provides a data sharding storage method, which is illustrated by taking IMEI as 869456039964691.
[0117] The TAC part is 6 digits in total. The first two digits of the country code "86" are not processed and are used as the last two digits of the fragment identification code. The last four digits "9456" are divided by 1000 to get the quotient 9 as the first digit of the fragment identification code, and the remainder 456 is converted to binary "111001000" as the 21st to 30th digits of the index identification code. If the high digits are insufficient, 0 is added.
[0118] The FAC part is 2 bits in total, which is "03". Divided by 4, the quotient is 0 as the 2nd-3rd bits of the fragment identification code. If the high bits are insufficient, 0 is added to get the remainder 03, which is converted to binary "11" as the 31st-32nd bits of the index identification code.
[0119] The SNR part is 6 bits in total, represented by 20-bit binary "11110011010001110101", which are used as the 1st to 20th bits of the index identification code.
[0120] The CD part is 1 digit in total and is obtained from the first 14 digits using the modulo 10 algorithm. It does not need to be reflected in the fragment identification code and index identification code.
[0121] Determine that the fragment identification code corresponding to IMEI: 869456039964691 is "90086", the index identification code is "11011100100011110011010001110101", and the index identification code is obtained by unsigned integer to "3700372597".
[0122] The corresponding IMEI is restored through the above-mentioned fragment identification code and index identification code.
[0123] The first digit of the 5-digit fragment identification code represents the quotient of the last four digits of TAC divided by 1000, the second and third digits represent the quotient of FAC divided by 4, and the last two digits are the country code. Therefore, the third digit of TAC is "9", and the first and second digits are "86".
[0124] The 31st and 32nd bits of the 32-bit index identification code are the remainder of FAC divided by 4, the 21st and 30th bits are the remainder of the last four bits of TAC divided by 1000, and the 1st and 20th bits are SNR. Therefore, FAC is "03", the 4th and 6th bits of TAC are "456", and SNR is "996469". CD is obtained by checking the first 14 bits using the modulo 10 algorithm.
[0125] The IMEI can be restored to 869456039964691.
[0126] The specific restoration algorithm pseudo code is as follows:
[0127] int facCardinal=Integer.parseInt(shardId.substring(0,1));
[0128] int tacCardinal=Integer.parseInt(shardId.substring(1,3));
[0129] String nation=shardId.substring(3,5);
[0130] long fac=(id>>30)+4*tacCardinal;
[0131] long tac=(id>>20&0b1111111111)+(1000*facCardinal).
[0132] The data sharding storage method provided in the embodiment of the present application determines the corresponding sharding identification code and index identification code by splitting the characteristics of the IMEI itself. Each IMEI and the corresponding sharding identification code and index identification code are uniquely corresponding. The corresponding IMEI can be restored through a group of sharding identification codes and index identification codes, thereby realizing accurate and rapid positioning of the IMEI in the storage and computing system without the need to generate and maintain the forward and reverse mapping relationship between the IMEI and the Index ID, saving storage costs and enhancing system performance.
[0133] Optionally, restoring the IMEI according to the slice identification code and the index identification code includes:
[0134] Determining a first portion of the type assignment code and a first portion of the final assembly location code based on the slice identification code;
[0135] determining a second portion of the type assignment code and a second portion of the final assembly location code based on the index identification code;
[0136] determining the serial number according to the index identification code;
[0137] The IMEI is generated based on the first and second parts of the type allocation code, the first and second parts of the final assembly location code, and the serial number.
[0138] Specifically, each IMEI corresponds to a unique set of fragment identification codes and index identification codes, so any set of fragment identification codes and index identification codes can be restored to the corresponding IMEI.
[0139] After the generation rules of the shard identification code and the index identification code are fixed, each group of shard identification code and index identification code has a one-to-one correspondence with the IMEI. The process of restoring the IMEI is the reverse process of generating the shard identification code and the index identification code.
[0140] The data sharding storage method provided in the embodiment of the present application can restore the corresponding IMEI through a group of sharding identification codes and index identification codes, thereby realizing accurate and rapid positioning of the IMEI in the storage and computing system without the need to generate and maintain the forward and reverse mapping relationship between the IMEI and the Index ID, thereby saving storage costs and enhancing system performance.
[0141] It should be noted that the data sharding storage method provided in the embodiment of the present application can be executed by a data sharding storage device, or by a control module in the data sharding storage device for executing the data sharding storage method. In the embodiment of the present application, the data sharding storage method provided in the embodiment of the present application is described by taking the data sharding storage device executing the data sharding storage method as an example.
[0142] Figure 4 is a schematic diagram of the structure of the data sharding storage device provided in the embodiment of the present application, such as Figure 4 As shown, the data shard storage device provided in the embodiment of the present application includes a first determination module 401, a second determination module 402 and a storage module 403, wherein:
[0143] The first determination module 401 is used to determine the fragment identification code corresponding to the International Mobile Equipment Identity IMEI according to the type allocation code and the final assembly location code of the IMEI;
[0144] A second determination module 402 is used to determine the index identification code corresponding to the IMEI according to the type allocation code, the final assembly location code and the serial number of the IMEI;
[0145] The storage module 403 is used to store the slice identification code and the index identification code.
[0146] Optionally, the first determination module includes a first determination submodule, a second determination submodule and a third determination submodule;
[0147] The first determination submodule is used to determine a first quotient value of the last four digits of the type allocation code divided by the first number;
[0148] The second determination submodule is used to determine a second quotient value of the final assembly location code divided by a second number;
[0149] The third determining submodule is used to determine the slice identification code according to the first quotient value and the second quotient value.
[0150] Optionally, the first determining module includes a fourth determining submodule, a fifth determining submodule and a sixth determining submodule;
[0151] The fourth determination submodule is used to determine a first quotient value of the last four digits of the type allocation code divided by the first number;
[0152] The fifth determination submodule is used to determine a second quotient value of the final assembly location code divided by a second number;
[0153] The sixth determination submodule is used to determine the fragment identification code according to the first quotient value, the second quotient value and first two bits of the type allocation code.
[0154] Optionally, the second determining module includes a seventh determining submodule, an eighth determining submodule and a ninth determining submodule;
[0155] The seventh determination submodule is used to determine a first remainder when the last four digits of the type allocation code are divided by the first number;
[0156] The eighth determination submodule is used to determine a second remainder of the final assembly location code divided by the second number;
[0157] The ninth determination submodule is used to determine the index identification code according to the first remainder, the second remainder and the sequence number.
[0158] Optionally, the ninth determining submodule includes a first determining unit, a second determining unit and a third determining unit;
[0159] The first determining unit is used to determine a first part of the index identification code according to the first remainder; the first part includes 10 bits;
[0160] The second determination unit is used to determine the second part of the index identification code according to the second remainder; the second part includes 2 bits;
[0161] The third determination unit is used to determine the third part of the index identification code according to the serial number; the third part includes 20 bits.
[0162] Optionally, the device further comprises a restoration module;
[0163] The restoration module is used to restore the IMEI according to the slice identification code and the index identification code.
[0164] Optionally, the restoration module includes a tenth determination submodule, an eleventh determination submodule, a twelfth determination submodule and a generation submodule;
[0165] The tenth determination submodule is used to determine the first part of the type allocation code and the first part of the final assembly location code according to the fragment identification code;
[0166] The eleventh determination submodule is used to determine the second part of the type allocation code and the second part of the final assembly location code according to the index identification code;
[0167] The twelfth determination submodule is used to determine the sequence number according to the index identification code;
[0168] The generating submodule is used to generate the IMEI according to the first part and the second part of the type allocation code, the first part and the second part of the final assembly location code, and the serial number.
[0169] Specifically, the above-mentioned data sharding storage device provided in the embodiment of the present application can implement all the method steps implemented in the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects that are the same as those in the method embodiment will not be described in detail here.
[0170] The data slicing storage device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0171] The data sharding storage device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0172] The data sharding storage device provided in the embodiment of the present application can achieve Figures 2 to 3 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0173] Optionally, an embodiment of the present application also provides an electronic device, including a processor, a memory, and a program or instruction stored in the memory and executable on the processor. When the program or instruction is executed by the processor, each process of the above-mentioned message shielding method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0174] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0175] Figure 5 is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application, such as Figure 5 As shown, the electronic device 500 includes but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, and a processor 510 and other components.
[0176] Those skilled in the art will appreciate that the electronic device 500 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 510 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0177] It should be understood that in the embodiment of the present application, the input unit 504 may include a graphics processor (Graphics Processing Unit, GPU) 5041 and a microphone 5042, and the graphics processor 5041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 506 may include a display panel 5061, and the display panel 5061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 507 includes a touch panel 5071 and other input devices 5072. The touch panel 5071 is also called a touch screen. The touch panel 5071 may include two parts: a touch detection device and a touch controller. Other input devices 5072 may include but are not limited to a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 509 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 510 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, the user interface, and the application program, etc., and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 510.
[0178] The processor 510 is used to determine the slice identification code corresponding to the International Mobile Equipment Identity code IMEI according to the type allocation code and the final assembly location code;
[0179] The processor 510 is configured to determine an index identification code corresponding to the IMEI according to the type allocation code, the final assembly location code and the serial number of the IMEI;
[0180] The memory 509 stores the slice identification code and the index identification code.
[0181] Optionally, the processor 510 is further configured to determine a first quotient of the last four digits of the type allocation code divided by a first number; determine a second quotient of the final assembly location code divided by a second number; and determine the fragment identification code according to the first quotient and the second quotient.
[0182] Optionally, the processor 510 is further used to determine a first quotient value of the last four digits of the type allocation code divided by a first number; determine a second quotient value of the final assembly location code divided by a second number; and determine the fragment identification code based on the first quotient value, the second quotient value and the first two digits of the type allocation code.
[0183] Optionally, the processor 510 is further used to determine a first remainder when the last four digits of the type allocation code are divided by the first number; determine a second remainder when the final assembly location code is divided by the second number; and determine the index identification code based on the first remainder, the second remainder and the serial number.
[0184] Optionally, the processor 510 is also used to determine the first part of the index identification code based on the first remainder; the first part includes 10 bits; determine the second part of the index identification code based on the second remainder; the second part includes 2 bits; determine the third part of the index identification code based on the serial number; the third part includes 20 bits.
[0185] Optionally, the processor 510 is further configured to restore the IMEI according to the slice identification code and the index identification code.
[0186] Optionally, the processor 510 is further used to determine the first part of the type assignment code and the first part of the final assembly location code according to the fragment identification code; determine the second part of the type assignment code and the second part of the final assembly location code according to the index identification code; determine the serial number according to the index identification code; and generate the IMEI according to the first and second parts of the type assignment code, the first and second parts of the final assembly location code, and the serial number.
[0187] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned data sharding storage method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0188] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0189] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned data sharding storage method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0190] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0191] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0192] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0193] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A data sharding storage method, It is characterized in that include: Determine the slice identification code corresponding to the International Mobile Equipment Identity IMEI according to the type allocation code and the final assembly location code; Determine an index identification code corresponding to the IMEI according to the type allocation code, the final assembly location code and the serial number of the IMEI; The shard identifier and the index identifier are stored.
2. The data sharding storage method according to claim 1, It is characterized in that The determining the slice identification code corresponding to the International Mobile Equipment Identity IMEI according to the type allocation code and the final assembly location code of the IMEI comprises: Determine a first quotient value of the last four digits of the type allocation code divided by the first number; determining a second quotient of the final assembly location code divided by a second number; The slice identification code is determined according to the first quotient value and the second quotient value.
3. The data sharding storage method according to claim 1, It is characterized in that The determining the slice identification code corresponding to the International Mobile Equipment Identity IMEI according to the type allocation code and the final assembly location code of the IMEI comprises: Determine a first quotient value of the last four digits of the type allocation code divided by the first number; determining a second quotient of the final assembly location code divided by a second number; The slice identification code is determined according to the first quotient value, the second quotient value and first two bits of the type allocation code.
4. The data sharding storage method according to any one of claims 2 to 3, It is characterized in that The step of determining the index identification code corresponding to the IMEI according to the type allocation code, the final assembly location code and the serial number of the IMEI comprises: determining a first remainder of dividing the last four digits of the type allocation code by the first digit; determining a second remainder of dividing the final assembly location code by the second number; The index identification code is determined according to the first remainder, the second remainder and the sequence number.
5. The data sharding storage method according to claim 4, It is characterized in that The determining the index identification code according to the first remainder, the second remainder and the sequence number comprises: Determine a first part of the index identification code according to the first remainder; the first part includes 10 bits; Determine a second part of the index identification code according to the second remainder; the second part includes 2 bits; The third part of the index identification code is determined according to the serial number; the third part includes 20 bits.
6. The data sharding storage method according to claim 1, It is characterized in that After storing the slice identification code and the index identification code, the method further includes: The IMEI is restored according to the slice identification code and the index identification code.
7. The data sharding storage method according to claim 6, It is characterized in that The restoring the IMEI according to the slice identification code and the index identification code includes: Determining a first portion of the type assignment code and a first portion of the final assembly location code based on the slice identification code; determining a second portion of the type assignment code and a second portion of the final assembly location code based on the index identification code; determining the serial number according to the index identification code; The IMEI is generated based on the first and second parts of the type allocation code, the first and second parts of the final assembly location code, and the serial number.
8. A data sharding storage device, It is characterized in that include: A first determination module is used to determine a fragment identification code corresponding to an International Mobile Equipment Identity code IMEI according to a type allocation code and a final assembly location code; A second determination module is used to determine the index identification code corresponding to the IMEI according to the type allocation code, the final assembly site code and the serial number of the IMEI; A storage module is used to store the slice identification code and the index identification code.
9. An electronic device, It is characterized in that It includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the data sharding storage method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that The readable storage medium stores programs or instructions, and when the programs or instructions are executed by the processor, the steps of the data sharding storage method as described in any one of claims 1 to 7 are implemented.
