Resource block storage method and device, electronic equipment and storage medium

By adopting the resource block storage method in the miniaturized device, the target file is divided into blocks and stored, which solves the problem of limited device storage space, achieves efficient storage and integrity of files, and ensures the reliability of the device under abnormal conditions.

CN118625992APending Publication Date: 2024-09-10XIAN UNIVIEW INFORMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310232006.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-10
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

The Flash storage space of miniaturized devices such as web cameras is limited, resulting in fewer control and other files that can be stored, making it impossible to effectively save and locate devices in abnormal conditions.

Method used

The resource block storage method is adopted to obtain the resource information of other carriers in the network, block the target file, and store the block sub-files in each carrier to ensure file integrity and save storage space.

Benefits of technology

It effectively saves storage space, increases the number of files that can be stored, ensures the integrity and reliability of target files, and avoids the problem of device inability to locate due to missing files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118625992A
    Figure CN118625992A
Patent Text Reader

Abstract

The invention provides a resource block storage method and device, electronic equipment and a storage medium, and relates to the technical field of computers, and the method comprises the steps: obtaining resource information sent by other carriers except the carriers in a network; under the condition that the file identifiers in the file information corresponding to the carriers in the network are the same, partitioning the target file based on the number of pre-stored blocks of the carriers and the resource information of the carriers to obtain at least two block sub-files; at least one block sub-file corresponding to each carrier is determined, and the at least one block sub-file corresponding to each carrier forms at least one target file; and sending the block information of the at least one block sub-file to other carriers. According to the invention, through block storage of the file, the storage space is saved, and the storage amount of the file is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a resource block storage method, device, electronic equipment and storage medium. Background Art

[0002] At present, in miniaturized devices such as IP Cameras (IPCs), Flash, as a non-volatile memory NVM (Non-Volatile Memory), can still store files such as controls in miniaturized devices after the power supply is turned off. Files such as controls are used to locate abnormalities through files such as controls when the miniaturized devices are in an abnormal state.

[0003] However, due to the small capacity of the Flash space in the device, the number of files such as controls that can be saved is small, resulting in many controls being unable to be saved. Summary of the invention

[0004] The present invention provides a resource block storage method, device, electronic device and storage medium, which are used to solve the defect of the prior art that the number of storable files is small, and saves storage space and increases the storage capacity of files through block storage of files.

[0005] The present invention provides a resource block storage method, which is applied to any carrier in a network, and includes:

[0006] Acquire resource information sent by other carriers in the network except the carrier, the resource information including file information of the target file and remaining space information of the other carriers;

[0007] When the file identifiers in the file information corresponding to each carrier in the network are the same, the target file is divided into blocks based on the number of pre-stored blocks of each carrier and the resource information of each carrier to obtain at least two block sub-files;

[0008] Determine at least one block sub-file corresponding to each carrier respectively, wherein the at least one block sub-file corresponding to each carrier constitutes at least one of the target files;

[0009] The block information of at least one of the block sub-files is sent to each of the other carriers, wherein the block information is used to instruct each of the other carriers to store the target file in blocks.

[0010] According to the resource block storage method provided by the present invention, the target file is divided into blocks based on the number of pre-stored blocks of each carrier and the resource information of each carrier to obtain at least two block sub-files, including:

[0011] Based on the number of carriers in the network, determine the number of the block sub-files and the block identifier of each of the block sub-files;

[0012] Based on the number of pre-stored blocks in each carrier and the number of the block sub-files, respectively determine the combination information of the block identifier of at least one block sub-file stored in each carrier, wherein the number of pre-stored blocks in each carrier is not greater than the number of the block sub-files;

[0013] Based on the resource information of each carrier and each of the combination information, the target file is divided into blocks to obtain at least two of the divided sub-files.

[0014] According to the resource block storage method provided by the present invention, the target file is divided into blocks based on the resource information of each carrier and each of the combination information to obtain at least two of the block sub-files, including:

[0015] Based on the remaining space information of each carrier, determining the space occupation ratio of at least one block sub-file corresponding to each of the combination information;

[0016] Determine the block size of each of the block sub-files based on the file size in the file information and the space occupation ratio of each of the block sub-files;

[0017] Determining a block starting point of each of the block sub-files based on a block size of each of the block sub-files;

[0018] Based on the block starting point of each of the block sub-files, the target file is divided into blocks to obtain at least two of the block sub-files.

[0019] According to the resource block storage method provided by the present invention, the method further includes:

[0020] The block information is determined based on the combination information corresponding to at least one block sub-file stored in each carrier and the block starting point of the at least one block sub-file.

[0021] According to the resource block storage method provided by the present invention, the method further includes:

[0022] When the number of carriers in the network is greater than or equal to a preset threshold, a target carrier with the smallest space saving rate in the network is determined based on the storage space of each carrier and the remaining space information. The target carrier is used for performing block storage of files based on the new carrier and the target carrier when a new carrier joins the network.

[0023] According to the resource block storage method provided by the present invention, the method further includes:

[0024] Periodically detecting whether each of the other carriers in the network is online;

[0025] In the case that at least one of the other carriers is offline, the target file is re-divided into blocks based on the online carriers in the network, and at least one divided sub-file corresponding to each online carrier is re-determined.

[0026] According to the resource block storage method provided by the present invention, the method further includes:

[0027] When it is detected that a new carrier has been added to the network, the target file is re-divided into blocks based on the current carriers in the network, and at least one divided sub-file corresponding to each current carrier is re-determined.

[0028] The present invention also provides a resource block storage device, which is applied to any carrier in a network, including:

[0029] An acquisition module, used to acquire resource information sent by other carriers in the network except the carrier, the resource information including file information of the target file and remaining space information of the other carriers;

[0030] A block division module, configured to divide the target file into blocks based on the number of pre-stored blocks of each carrier and the resource information of each carrier when the file identifiers in the file information corresponding to each carrier in the network are the same, so as to obtain at least two block sub-files;

[0031] A determination module, used to respectively determine at least one block sub-file corresponding to each carrier, wherein the at least one block sub-file corresponding to each carrier constitutes at least one of the target files;

[0032] The sending module is used to send the block information of at least one of the block sub-files to each of the other carriers, wherein the block information is used to instruct each of the other carriers to store the target file in blocks.

[0033] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any one of the resource block storage methods described above is implemented.

[0034] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the resource block storage method described above is implemented.

[0035] The resource block storage method, device, electronic device and storage medium provided by the present invention obtain resource information of other carriers in the network and verify that the target file in other carriers is the same as the target file in the current carrier, then divide the target file into blocks, and generate block information corresponding to each carrier after the block division, so that at least one corresponding block sub-file is stored in each carrier, and the at least one block sub-file stored in each carrier can be spliced ​​into at least one target file. Compared with storing a complete target file, the block storage of the target file saves the remaining space in each carrier in the network while ensuring the integrity of the target file. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0037] Figure 1 It is a flowchart of a resource block storage method provided by an embodiment of the present invention;

[0038] Figure 2 is an exemplary connection diagram of a carrier provided in an embodiment of the present invention;

[0039] Figure 3 This is one of the example network topology diagrams of the resource block storage method provided by the embodiment of the present invention;

[0040] Figure 4 This is one of the example flow diagrams of the resource block storage method provided by an embodiment of the present invention;

[0041] Figure 5 This is the second example network topology diagram of the resource block storage method provided by the embodiment of the present invention;

[0042] Figure 6 This is a second example flow diagram of the resource block storage method provided by an embodiment of the present invention;

[0043] Figure 7 This is the third example network topology diagram of the resource block storage method provided by the embodiment of the present invention;

[0044] Figure 8 is a schematic diagram of an example composition of a combination block provided by an embodiment of the present invention;

[0045] Fig. 9 This is a third example flow chart of the resource block storage method provided by an embodiment of the present invention;

[0046] Fig.10 is a schematic diagram of the structure of a resource block storage device provided by an embodiment of the present invention;

[0047] Fig.11 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] At present, the Flash space capacity in miniaturized devices is small, and there are fewer files such as controls that can be saved. Many abnormal problems are often unable to be located due to the lack of files such as controls. In the prior art, the patent with application number CN201811259880.9 discloses a block-level data deduplication storage system, which is used to be set on a storage node to receive data sent by a client. Each storage node can receive data sent by a client and back up the data to a container storage pool, or restore specified data from a container storage pool; the container storage pool is set on a disk device, and a data block sub-index and a container index are also installed on the disk device; the block-level data deduplication storage system adopts block compression technology to eliminate duplicate data blocks in the storage node cluster, and cluster new data blocks with similar content to the same storage node to save storage space. However, in the above patent, a unified container storage pool needs to be set up, the data is backed up to the container storage pool, and the deduplicated data is processed by storage nodes, and the effect of saving storage space is limited.

[0050] In view of the problem that there are few storable files, an embodiment of the present invention provides a resource block storage method, which is applied to any carrier in the network. Figure 1 is a schematic diagram of a resource block storage method provided by an embodiment of the present invention, such as Figure 1 As shown, the resource block storage method includes:

[0051] Step 110: Acquire resource information sent by other carriers in the network except the carrier, wherein the resource information includes file information of the target file and remaining space information of the other carriers.

[0052] Optionally, the above carrier or other carriers can be miniaturized devices, such as a network camera (IP Camera, IPC), which is provided with a Flash memory, which is a non-volatile memory NVM (Non-Volatile Memory), and can still maintain the information in the memory after the power supply of the miniaturized device is cut off. In addition, the above carrier can be a miniaturized device newly added to the network, or a device in the network that detects a change in the number of devices in the network for the first time.

[0053] Optionally, the carrier may first broadcast its own resource information to the network, including file information of the target file stored in the carrier and information about the remaining space in the carrier. After receiving the information broadcast by the carrier, other carriers in the network send their own resource information to the carrier in a unicast manner, so that the carrier can obtain the resource information sent by other carriers in the network except the carrier. For example, Figure 2 is an exemplary connection diagram of the carrier provided in the embodiment of the present invention, such as Figure 2 As shown, taking the carrier as a network camera IPC as an example, the IPC may include a periodic status query module, an information receiving and sending module, and a file block analysis module, wherein:

[0054] The periodic status query module is connected to the information transceiver module, which can periodically detect the online status of all IPCs in the network and save the block information and flash remaining space information corresponding to each IPC. The information transceiver module is connected to the file block analysis module, which is used to receive external information and send internal signaling. The file block analysis module is used to implement file block and reorganization. When the periodic status query module detects that the number of IPCs in the network has changed, it can send the resource information of the current IPC to the network through the information transceiver module. After receiving the broadcast message, other IPCs can send the resource information corresponding to each IPC to the current IPC in a unicast manner. After receiving the resource information of each IPC, the information transceiver module of the current IPC sends it to the file block analysis module of the current IPC to block and reorganize the same files stored in each IPC.

[0055] Optionally, the target file may be a control, algorithm, model or other file. Among them: the control is a component developed based on the web, which can realize functions that are difficult to realize using the web alone, and due to the performance of the browser, more complex functions can only be realized through the control. The file information of the target file may include the file identifier of the target file and the file size of the target file, and the file identifier may be the version information of the target file. The target file is stored in each carrier, and the version information can be used to further confirm whether the target files stored in each carrier are the same.

[0056] Step 120: When the file identifiers in the file information corresponding to each carrier in the network are the same, the target file is divided into blocks based on the number of pre-stored blocks of each carrier and the resource information of each carrier to obtain at least two block sub-files.

[0057] Specifically, after obtaining the resource information of other carriers, the file identifiers of the file information of the target files stored in the carrier and other carriers are compared. If the file identifiers are the same, the target file can be divided into blocks based on the resource information of each carrier, so that each carrier in the network no longer stores the complete target file, but instead stores at least one block sub-file, and the number of pre-stored blocks corresponding to each carrier is smaller than the number of blocks of the target file, that is, the storage space occupied by the block sub-files stored in each carrier is smaller than the storage space occupied by the complete target file, so that the unused remaining space in each carrier is expanded, and more target files can be stored compared to storing the complete target file.

[0058] Step 130: Determine at least one block sub-file corresponding to each carrier respectively, wherein the at least one block sub-file corresponding to each carrier constitutes at least one of the target files.

[0059] Specifically, in order to ensure the integrity of the target file within the network, in an embodiment of the present invention, after the target file is divided into blocks, each block sub-file needs to be allocated to determine at least one block sub-file corresponding to each carrier, that is, at least one block sub-file corresponding to each carrier is spliced ​​into at least one complete target file through communication within the network, thereby avoiding incomplete target files caused by storing the same block sub-files in each carrier.

[0060] Optionally, the number of pre-stored blocks corresponding to the above-mentioned carriers ranges from [1, N], where N is the number of blocks of the target file, that is, the number of block subfiles. At the same time, the number of pre-stored blocks corresponding to each carrier can be the same or different. For example, taking the carrier as a network camera IPC, the target file as a control, and the number of blocks of the control as 3 as an example, the number of pre-stored blocks corresponding to IPC1 can be 1, the number of pre-stored blocks corresponding to IPC2 can be 3, and the number of pre-stored blocks corresponding to IPC3 can be 2. Alternatively, the number of pre-stored blocks corresponding to IPC1, IPC2, and IPC3 are all 2.

[0061] Optionally, the fewer the number of sub-files stored in the above carriers, the greater the storage space saved. That is, when each carrier stores any sub-file of the target file and each sub-file can be spliced ​​into one target file, the greater the storage space saved, and vice versa. At the same time, in order to prevent the target file from being incomplete due to the loss of any carrier, the sub-files stored in each carrier can be spliced ​​into at least two target files.

[0062] Step 140: Send the block information of at least one of the block sub-files to each of the other carriers, wherein the block information is used to instruct each of the other carriers to store the target file in blocks.

[0063] Specifically, after determining the corresponding block information of each carrier, the block information can be sent to other carriers, so that other carriers can divide and reorganize the stored target file according to the block information. If the carrier itself has the corresponding block sub-file, it can be directly divided into blocks. If the carrier itself does not have the corresponding block sub-file, it can obtain the block sub-file from other carriers in the network based on the block information.

[0064] It should be noted that the above-mentioned block information stores information of block sub-files stored in all carriers in the network.

[0065] Optionally, the target file is divided into blocks based on the number of pre-stored blocks of each carrier and the resource information of each carrier to obtain at least two block sub-files, including:

[0066] Based on the number of carriers in the network, determine the number of the block sub-files and the block identifier of each of the block sub-files;

[0067] Based on the number of pre-stored blocks in each carrier and the number of the block sub-files, respectively determine the combination information of the block identifier of at least one block sub-file stored in each carrier, wherein the number of pre-stored blocks in each carrier is not greater than the number of the block sub-files;

[0068] Based on the resource information of each carrier and each of the combination information, the target file is divided into blocks to obtain at least two of the divided sub-files.

[0069] Specifically, after determining the number of pre-stored blocks corresponding to each carrier, first determine the number of block sub-files, that is, the number of blocks of the target file, through the number of carriers in the network, and further determine the block identifier of each block sub-file. Through the block identifier and the predetermined number of pre-stored blocks corresponding to each carrier, the block sub-files after the target file is segmented can be reorganized in advance to determine the combination information of at least one block sub-file corresponding to each carrier. Through the combined information and the resource information corresponding to each carrier, the block size of each block sub-file can be determined according to the ratio of the remaining space information of each carrier. That is, if the remaining space in the carrier is large, the block sub-files occupying the larger space can be stored in the carrier. On the contrary, the block sub-files occupying the smaller space are allocated to the carrier. At the same time, since the number of pre-stored blocks in each carrier is not greater than the number of block sub-files, when performing block storage, based on security considerations, carriers in key positions or with higher importance can store the complete target file, or the complete target file composed of the block sub-files, and carriers in other positions or with lower importance can store at least one block sub-file to save the remaining space of each carrier in the network.

[0070] Optionally, the target file is divided into blocks based on the resource information of each carrier and each of the combination information to obtain at least two of the divided sub-files, including:

[0071] Based on the remaining space information of each carrier, determining the space occupation ratio of at least one block sub-file corresponding to each of the combination information;

[0072] Determine the block size of each of the block sub-files based on the file size in the file information and the space occupation ratio of each of the block sub-files;

[0073] Determining a block starting point of each of the block sub-files based on a block size of each of the block sub-files;

[0074] Based on the block starting point of each of the block sub-files, the target file is divided into blocks to obtain at least two of the block sub-files.

[0075] Specifically, since there is at least one block sub-file stored in the carrier, based on the consideration of saving storage space for all carriers in the network, the space occupancy ratio corresponding to each combination information is determined based on the ratio of the remaining space information of each carrier. Combined with the fact that the sum of each block sub-file is equal to the size of the target file, the block size of each block sub-file can be determined separately, and the block starting point of each block sub-file can be further determined to facilitate the segmentation of the target file.

[0076] Optionally, the method further comprises:

[0077] The block information is determined based on the combination information corresponding to at least one block sub-file stored in each carrier and the block starting point of the at least one block sub-file.

[0078] For example, taking the carrier in the network as IPC, the number of IPCs as 3, and the target file as a control as an example, the block storage process of the target file includes the following steps:

[0079] Table 1 IPC1 information table

[0080] IP address Control block information Flash remaining space IPC1 Full Controlsz MB y1MB

[0081] 1. Figure 3 is one of the example network topology diagrams of the resource block storage method provided by the embodiment of the present invention, such as Figure 3 As shown, in the initial state, there is only a switch in the network, IPC1 joins the network, and IPC1 stores complete controls, and the remaining space size of IPC1 is y1MB. The information table in IPC1 is shown in Table 1.

[0082] 2. Figure 4 is one of the example flow charts of the resource block storage method provided by the embodiment of the present invention, such as Figure 4 As shown in the figure, after IPC2 joins the network, the process of control segmentation includes the following steps:

[0083] 1) Broadcast the resource information of IPC2 itself to the network, including the file size of the complete control, version information and the remaining space size of IPC2 y2MB.

[0084] 2) After receiving the broadcast message, IPC1 in the network updates the information table in IPC1 based on the resource information of IPC2 to obtain Table 2, and sends the resource information of IPC1 itself to IPC2 via unicast.

[0085] Table 2 IPC1 information table

[0086] IP address Control block information Flash remaining space IPC1 Full Controlsz MB y1MB IPC2 Full Controlsz MB y2MB

[0087] 3) After IPC2 receives the message sent by IPC1, it generates an information table that is exactly the same as Table 2 based on the received message information.

[0088] 4) The number of IPCs in the network is 2, and it can be determined that the number of blocks of the complete control is 2, and the block identifiers of different block sub-files are x1 and x2 respectively. Based on the remaining Flash space, x1:x2=y1:y2, and x1+x2=z can be obtained, and blocks x1=y1*z / (y1+y2) and x2=y2*z / (y1+y2) can be further determined. In order to avoid incomplete controls when IPC is abnormally lost, blocks x1 and x2 are stored in both IPC1 and IPC2.

[0089] 5) After dividing its complete control into blocks, IPC2 sends block information to IPC1, which carries the combination information (x1+x2) required by IPC1, the block starting point 0 of block x1, and the block starting point y1*z / (y1+y2) of block x2.

[0090] 6) Figure 5 This is the second example network topology diagram of the resource block storage method provided by the embodiment of the present invention. After the block is successfully divided, IPC1 sends the information of the successful block division to IPC2. At the same time, IPC1 and IPC2 update their respective information tables respectively, and obtain Table 3 and the following table. Figure 5 The network topology diagram is shown in the figure.

[0091] It should be noted that when one block is stored in each of the above-mentioned IPC1 and IPC2, and the complete control is divided into two blocks, the purpose of saving Flash storage space can be achieved. When two blocks are stored in each of the above-mentioned IPC1 and IPC2, and the complete control is divided into two blocks, the size of the Flash storage space in each IPC does not change before and after the block, and IPC1 and IPC2 may not be divided into blocks.

[0092] Table 3 IPC1 and IPC2 update information table

[0093] IP address Control block information Flash remaining space IPC1 Block x1, Block x2 y1MB IPC2 Block x2, Block x1 y2MB

[0094] 3. Figure 6 FIG. 2 is a second example flow chart of a resource block storage method provided by an embodiment of the present invention. Figure 6 As shown in the figure, after IPC3 joins the network, the process of control segmentation includes the following steps:

[0095] 1) IPC3 broadcasts its own resource information to the network, including the file size of the complete control, version information, and the remaining space size of IPC3 y3MB.

[0096] 2) After receiving the broadcast message, IPC1 and IPC2 in the network update their respective information tables based on the resource information of IPC3 to obtain Table 4, and send the resource information of IPC1 and IPC2 themselves to IPC3 via unicast.

[0097] Table 4 Update information of IPC1, IPC2 and IPC3

[0098]

[0099] 3) After IPC3 receives the messages sent by IPC1 and IPC2, it generates an information table that is exactly the same as Table 4 based on the received message information.

[0100] 4) The number of IPCs in the network is 3, so it can be determined that the number of blocks of the complete control is 3, and the block identifiers of different block subfiles are x3, x4 and x5 respectively. Considering the control storage integrity, the number of pre-stored blocks of each IPC is set to 2. It can be determined that the combination information of the blocks corresponding to IPC1 is x3 and x4, the combination information of the blocks corresponding to IPC2 is x4 and x5, and the combination information of the blocks corresponding to IPC3 is x5 and x3. Based on the remaining space of Flash, we can get (x3+x4): (x4+x5): (x5+x3)=y1:y2:y3, and x3+x4+x5=z. We can further determine that blocks x3=(y3+y1-y2)*z / (y1+y2+y3), x4=(y1+y2-y3)*z / (y1+y2+y3), and x5=(y2+y3-y1)*z / (y1+y2+y3).

[0101] 5) After IPC3 divides its own complete control into blocks, taking IPC1 as an example, it sends block information to IPC1, including the combination information (x3+x4) required by IPC1, the block starting point 0 of block x3, the block starting point (y3+y1-y2)*z / (y1+y2+y3) of block x4, and the block starting point [(y1+y2-y3)*z / (y1+y2+y3)]+[(y1+y2-y3)*z / (y1+y2+y3)] of block x5.

[0102] 6) Figure 7 This is a schematic diagram of the third example network topology of the resource block storage method provided by the embodiment of the present invention. After the block is successfully divided, IPC1 and IPC2 send the information of the successful block division to IPC3. At the same time, IPC1 and IPC2 update their respective information tables respectively, and obtain Table 5 and the following table. Figure 7 As shown in the network topology diagram. As can be seen from Table 5, the remaining Flash space of each IPC is expanded to store more controls.

[0103] Table 5 IPC1, IPC2, IPC3 update information table

[0104]

[0105] Optionally, the method further comprises:

[0106] When the number of carriers in the network is greater than or equal to a preset threshold, a target carrier with the smallest space saving rate in the network is determined based on the storage space of each carrier and the remaining space information. The target carrier is used for performing block storage of files based on the new carrier and the target carrier when a new carrier joins the network.

[0107] Specifically, when there are many carriers in the network, if the target files need to be re-blocked for all carriers in the network each time a new carrier is added, a large amount of resources will be consumed, and for individual carriers, the storage control components that can be saved by re-blocking and reallocation are limited. Therefore, in an embodiment of the present invention, if the number of carriers in the network is greater than or equal to a preset threshold, the target carrier with the smallest space saving rate in the network can be further determined based on the storage space and remaining space information of each carrier. After the new carrier joins the network, it is only necessary to re-block and allocate the target files for the target carrier and the new carrier, thereby avoiding the consumption of a large amount of resources and saving storage space for the carrier with a smaller space saving rate.

[0108] It should be noted that, in order to simplify the control logic, the preset threshold value can be determined by the number of carriers in the networking. In addition, it can also be determined after comprehensive consideration according to the file size of the target file, the number of existing carriers in the networking, the memory and power required for the scribbling segmentation, and the amount of resources saved after the redistribution. If each newly added carrier all needs to carry out the re-segmentation of the target file to all carriers in the networking, then because the file size is a constant, the memory and power required for the scribbling segmentation are a basic value plus a variation value that is proportional to the degree of variation of the segmentation content, and the degree of variation of the segmentation content is mainly affected by the ratio of the number of carriers added to the networking to the original number of carriers. Therefore, in some embodiments, whether to adopt the mode of redistributing the target carrier that only needs to save the minimum space rate in the networking can be determined by the central server after comprehensive calculation of multiple factors.

[0109] For example, Figure 8 is a schematic diagram of an example composition of the combined blocks provided in an embodiment of the present invention, such as Figure 8As shown in the figure, taking the preset threshold of 5 as an example, there are IPC1, IPC2, IPC3, IPC4 and IPC5 in the network. IPC1 stores block q1+block q2, IPC2 stores block q2+block q3, IPC3 stores block q3+block q4, IPC4 stores block q4+block q5, and IPC5 stores block q5+block q1. The number of IPCs in the network is 5. Therefore, based on the remaining space information and the storage of the carrier, Storage space is determined, and the carrier IPC4 with the smallest space saving rate is determined. After new carriers IPC6 and IPC7 are added to the network, blocks q4 and q5 stored in IPC4 are re-divided into three blocks and redistributed to IPC4, IPC6 and IPC7, so that blocks q45a and q45b are stored in IPC4, blocks q45b and q45c are stored in IPC6, and blocks q45c and q45a are stored in IPC7.

[0110] Optionally, the method further comprises:

[0111] Periodically detecting whether each of the other carriers in the network is online;

[0112] In the case that at least one of the other carriers is offline, the target file is re-divided into blocks based on the online carriers in the network, and at least one divided sub-file corresponding to each online carrier is re-determined.

[0113] Specifically, any carrier in the network can periodically detect the online status of each carrier in the network. If a carrier is offline, it can be detected that the carrier is the master and the target file is re-blocked. For example, Fig. 9 This is a third example flow chart of a resource block storage method provided by an embodiment of the present invention. Fig. 9 As shown, there are 3 IPCs in the network, and IPC2 detects that IPC3 is offline and IPC1 is online. At this time, IPC2 re-blocks the complete control to obtain block x6 and block x7, and after generating the block information, sends the block information to IPC1, so that IPC1 stores block x6 and block x7, and IPC2 stores block x7 and block x6, so that IPC1 and IPC2 update their respective information tables.

[0114] Optionally, the method further comprises:

[0115] When it is detected that a new carrier has been added to the network, the target file is re-divided into blocks based on the current carriers in the network, and at least one divided sub-file corresponding to each current carrier is re-determined.

[0116] Specifically, when a new carrier joins the network, the number of carriers in the network changes. The newly added miniaturized device, or the device in the network that detects the change in the number of devices in the network for the first time can re-divide and allocate the target files to save more remaining space and store more target files.

[0117] The resource block storage method provided by the present invention obtains resource information of other carriers in the network and verifies that the target file in other carriers is the same as the target file in the current carrier, then blocks the target file, and generates block information corresponding to each carrier after the block division, so that at least one corresponding block sub-file is stored in each carrier, and the at least one block sub-file stored in each carrier can be spliced ​​into at least one target file. Compared with storing a complete target file, the block storage of the target file saves the remaining space in each carrier in the network while ensuring the integrity of the target file.

[0118] The resource block storage device provided by the present invention is described below. The resource block storage device described below and the resource block storage method described above can be referred to each other.

[0119] The embodiment of the present invention also provides a resource block storage device, Fig.10 is a schematic diagram of the structure of a resource block storage device provided by an embodiment of the present invention, such as Fig.10 As shown, the resource block storage device 1000 is applied to any carrier in the network, including: an acquisition module 1010, a block module 1020, a determination module 1030 and a sending module 1040, wherein:

[0120] An acquisition module 1010 is used to acquire resource information sent by other carriers in the network except the carrier, wherein the resource information includes file information of the target file and remaining space information of the other carriers;

[0121] The block division module 1020 is used to divide the target file into blocks based on the number of pre-stored blocks of each carrier and the resource information of each carrier when the file identifiers in the file information corresponding to each carrier in the network are the same, so as to obtain at least two block sub-files;

[0122] A determination module 1030 is used to respectively determine at least one block sub-file corresponding to each carrier, wherein the at least one block sub-file corresponding to each carrier constitutes at least one of the target files;

[0123] The sending module 1040 is used to send the block information of at least one of the block sub-files to each of the other carriers, wherein the block information is used to instruct each of the other carriers to store the target file in blocks.

[0124] The resource block storage device provided by the present invention obtains resource information of other carriers in the network and verifies that the target file in other carriers is the same as the target file in the current carrier, then blocks the target file, and generates block information corresponding to each carrier after the block division, so that at least one corresponding block sub-file is stored in each carrier, and the at least one block sub-file stored in each carrier can be spliced ​​into at least one target file. Compared with storing a complete target file, the block storage of the target file saves the remaining space in each carrier in the network while ensuring the integrity of the target file.

[0125] Optionally, the block segmentation module 1020 is specifically configured to:

[0126] Based on the number of carriers in the network, determine the number of the block sub-files and the block identifier of each of the block sub-files;

[0127] Based on the number of pre-stored blocks in each carrier and the number of the block sub-files, respectively determine the combination information of the block identifier of at least one block sub-file stored in each carrier, wherein the number of pre-stored blocks in each carrier is not greater than the number of the block sub-files;

[0128] Based on the resource information of each carrier and each of the combination information, the target file is divided into blocks to obtain at least two of the divided sub-files.

[0129] Optionally, the block segmentation module 1020 is specifically configured to:

[0130] Based on the remaining space information of each carrier, determining the space occupation ratio of at least one block sub-file corresponding to each of the combination information;

[0131] Determine the block size of each of the block sub-files based on the file size in the file information and the space occupation ratio of each of the block sub-files;

[0132] Determining a block starting point of each of the block sub-files based on a block size of each of the block sub-files;

[0133] Based on the block starting point of each of the block sub-files, the target file is divided into blocks to obtain at least two of the block sub-files.

[0134] Optionally, the resource block storage device 1000 is further used for:

[0135] The block information is determined based on the combination information corresponding to at least one block sub-file stored in each carrier and the block starting point of the at least one block sub-file.

[0136] Optionally, the resource block storage device 1000 is further used for:

[0137] When the number of carriers in the network is greater than or equal to a preset threshold, a target carrier with the smallest space saving rate in the network is determined based on the storage space of each carrier and the remaining space information. The target carrier is used for performing block storage of files based on the new carrier and the target carrier when a new carrier joins the network.

[0138] Optionally, the resource block storage device 1000 is further used for:

[0139] Periodically detecting whether each of the other carriers in the network is online;

[0140] In the case that at least one of the other carriers is offline, the target file is re-divided into blocks based on the online carriers in the network, and at least one divided sub-file corresponding to each online carrier is re-determined.

[0141] Optionally, the resource block storage device 1000 is further used for:

[0142] When it is detected that a new carrier has been added to the network, the target file is re-divided into blocks based on the current carriers in the network, and at least one divided sub-file corresponding to each current carrier is re-determined.

[0143] Fig.11 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, such as Fig.11 As shown, the electronic device may include: a processor 1110, a communication interface 1120, a memory 1130 and a communication bus 1140, wherein the processor 1110, the communication interface 1120, and the memory 1130 communicate with each other through the communication bus 1140. The processor 1110 may call the logic instructions in the memory 1130 to execute the resource block storage method, which is applied to any carrier in the network, and the method includes:

[0144] Acquire resource information sent by other carriers in the network except the carrier, the resource information including file information of the target file and remaining space information of the other carriers;

[0145] When the file identifiers in the file information corresponding to each carrier in the network are the same, the target file is divided into blocks based on the number of pre-stored blocks of each carrier and the resource information of each carrier to obtain at least two block sub-files;

[0146] Determine at least one block sub-file corresponding to each carrier respectively, wherein the at least one block sub-file corresponding to each carrier constitutes at least one of the target files;

[0147] The block information of at least one of the block sub-files is sent to each of the other carriers, wherein the block information is used to instruct each of the other carriers to store the target file in blocks.

[0148] In addition, the logic instructions in the above-mentioned memory 1130 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0149] On the other hand, the present invention further provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the resource block storage method provided by the above methods, applied to any carrier in the network, the method includes:

[0150] Acquire resource information sent by other carriers in the network except the carrier, the resource information including file information of the target file and remaining space information of the other carriers;

[0151] When the file identifiers in the file information corresponding to each carrier in the network are the same, the target file is divided into blocks based on the number of pre-stored blocks of each carrier and the resource information of each carrier to obtain at least two block sub-files;

[0152] Determine at least one block sub-file corresponding to each carrier respectively, wherein the at least one block sub-file corresponding to each carrier constitutes at least one of the target files;

[0153] The block information of at least one of the block sub-files is sent to each of the other carriers, wherein the block information is used to instruct each of the other carriers to store the target file in blocks.

[0154] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the resource block storage method provided by the above methods, and is applied to any carrier in a network, the method comprising:

[0155] Acquire resource information sent by other carriers in the network except the carrier, the resource information including file information of the target file and remaining space information of the other carriers;

[0156] When the file identifiers in the file information corresponding to each carrier in the network are the same, the target file is divided into blocks based on the number of pre-stored blocks of each carrier and the resource information of each carrier to obtain at least two block sub-files;

[0157] Determine at least one block sub-file corresponding to each carrier respectively, wherein the at least one block sub-file corresponding to each carrier constitutes at least one of the target files;

[0158] The block information of at least one of the block sub-files is sent to each of the other carriers, wherein the block information is used to instruct each of the other carriers to store the target file in blocks.

[0159] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0160] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0161] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A resource block storage method, characterized in that: Applicable to any carrier in the network, including: Acquire resource information sent by other carriers in the network except the carrier, the resource information including file information of the target file and remaining space information of the other carriers; When the file identifiers in the file information corresponding to each carrier in the network are the same, the target file is divided into blocks based on the number of pre-stored blocks of each carrier and the resource information of each carrier to obtain at least two block sub-files; Determine at least one block sub-file corresponding to each carrier respectively, wherein the at least one block sub-file corresponding to each carrier constitutes at least one of the target files; The block information of at least one of the block sub-files is sent to each of the other carriers, wherein the block information is used to instruct each of the other carriers to store the target file in blocks.

2. The resource block storage method according to claim 1, characterized in that: The target file is divided into blocks based on the number of pre-stored blocks of each carrier and the resource information of each carrier to obtain at least two block sub-files, including: Based on the number of carriers in the network, determine the number of the block sub-files and the block identifier of each of the block sub-files; Based on the number of pre-stored blocks in each carrier and the number of the block sub-files, respectively determine the combination information of the block identifier of at least one block sub-file stored in each carrier, wherein the number of pre-stored blocks in each carrier is not greater than the number of the block sub-files; Based on the resource information of each carrier and each of the combination information, the target file is divided into blocks to obtain at least two of the divided sub-files.

3. The resource block storage method according to claim 2 is characterized in that: The target file is divided into blocks based on the resource information of each carrier and each combination information to obtain at least two block sub-files, including: Based on the remaining space information of each carrier, determining the space occupation ratio of at least one block sub-file corresponding to each of the combination information; Determine the block size of each of the block sub-files based on the file size in the file information and the space occupation ratio of each of the block sub-files; Determining a block starting point of each of the block sub-files based on a block size of each of the block sub-files; Based on the block starting point of each of the block sub-files, the target file is divided into blocks to obtain at least two of the block sub-files.

4. The resource block storage method according to claim 3 is characterized in that: The method further comprises: The block information is determined based on the combination information corresponding to at least one block sub-file stored in each carrier and the block starting point of the at least one block sub-file.

5. The resource block storage method according to any one of claims 1 to 3, characterized in that: The method further comprises: When the number of carriers in the network is greater than or equal to a preset threshold, a target carrier with the smallest space saving rate in the network is determined based on the storage space of each carrier and the remaining space information. The target carrier is used for performing block storage of files based on the new carrier and the target carrier when a new carrier joins the network.

6. The resource block storage method according to any one of claims 1 to 3, characterized in that: The method further comprises: Periodically detecting whether each of the other carriers in the network is online; In the case that at least one of the other carriers is offline, the target file is re-divided into blocks based on the online carriers in the network, and at least one divided sub-file corresponding to each online carrier is re-determined.

7. The resource block storage method according to any one of claims 1 to 3, characterized in that: The method further comprises: When it is detected that a new carrier has been added to the network, the target file is re-divided into blocks based on the current carriers in the network, and at least one divided sub-file corresponding to each current carrier is re-determined.

8. A resource block storage device, characterized in that: Applicable to any carrier in the network, including: An acquisition module, used to acquire resource information sent by other carriers in the network except the carrier, the resource information including file information of the target file and remaining space information of the other carriers; A block division module, configured to divide the target file into blocks based on the number of pre-stored blocks of each carrier and the resource information of each carrier when the file identifiers in the file information corresponding to each carrier in the network are the same, so as to obtain at least two block sub-files; A determination module, used to respectively determine at least one block sub-file corresponding to each carrier, wherein the at least one block sub-file corresponding to each carrier constitutes at least one of the target files; The sending module is used to send the block information of at least one of the block sub-files to each of the other carriers, wherein the block information is used to instruct each of the other carriers to store the target file in blocks.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the resource block storage method as described in any one of claims 1-7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the resource block storage method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Data query method, device and equipment based on database and data lake

    CN121210502A