A storage bucket management method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202211292913.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-21
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2042-10-21
AI Technical Summary
[0002]传统的对象存储S3(英文全称:Amazon Simple Storage Service,中文全称:亚马逊简单存储服务)协议在删除仅有分片上传对象的存储桶时,会先删除存储桶内已有分片,然后删除存储桶,但是正在上传中的分片不会被删掉,导致产生垃圾数据,占用存储空间,增加用户的存储成本
[0042]通过以上方案可知,本申请提供的一种存储桶管理方法,包括:当接收到目标存储桶的删除命令时,判断所述目标存储桶是否存在正在上传的分片;若否,则删除所述目标存储桶。
Smart Images

Figure CN115599299B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a bucket management method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] When deleting a bucket containing only uploaded objects, the traditional S3 (Amazon Simple Storage Service) protocol first deletes the existing fragments in the bucket and then deletes the bucket. However, fragments that are currently being uploaded are not deleted, resulting in the generation of junk data, which consumes storage space and increases the user's storage costs.
[0003] Therefore, how to avoid generating junk data when deleting a storage bucket is a technical problem that needs to be solved by those skilled in the art. Summary of the Invention
[0004] The purpose of this application is to provide a bucket management method, apparatus, electronic device, and computer-readable storage medium that avoids generating junk data when deleting buckets and reduces storage costs.
[0005] To achieve the above objectives, this application provides a bucket management method, comprising:
[0006] When a delete command is received for the target bucket, it is determined whether there are any fragments being uploaded in the target bucket;
[0007] If not, then delete the target storage bucket.
[0008] The step of determining whether the target storage bucket contains a fragment that is currently being uploaded includes:
[0009] Determine whether the number of shards contained in the target storage bucket has increased;
[0010] If so, it is determined that the target storage bucket contains a fragment that is being uploaded;
[0011] If not, it is determined that the target storage bucket does not have any fragments being uploaded.
[0012] Specifically, before determining whether there are currently uploaded fragments in the target storage bucket when a deletion command is received, the method further includes:
[0013] Initialize the upload fragment count field; wherein, the upload fragment count field is used to record whether there are fragments being uploaded in the target storage bucket.
[0014] After initializing the upload fragment count field, the following is also included:
[0015] When the client uploads a fragment to the target storage bucket, the uploaded fragment count field is incremented by one;
[0016] When there are fragments that have been uploaded successfully or interrupted, the upload fragment count field is decremented by one.
[0017] The step of determining whether the target storage bucket contains a fragment that is currently being uploaded includes:
[0018] Determine whether the uploaded fragment count field is zero;
[0019] If so, then it is determined that the target storage bucket does not have any fragments being uploaded;
[0020] If not, it is determined that the target storage bucket contains a fragment that is being uploaded.
[0021] Before deleting the target storage bucket, the process also includes:
[0022] Delete all fragments in the target bucket.
[0023] After determining whether the target storage bucket has any fragments being uploaded, the method further includes:
[0024] If the target storage bucket has fragments that are being uploaded, a message indicating that the target storage bucket is busy is sent.
[0025] To achieve the above objectives, this application provides a storage bucket management device, comprising:
[0026] The judgment module is used to determine whether there are any fragments being uploaded in the target storage bucket when a deletion command is received from the target storage bucket;
[0027] The deletion module is used to delete the target storage bucket when there are no fragments being uploaded.
[0028] Specifically, the judgment module is used to: determine whether the number of shards contained in the target storage bucket has increased; if yes, then determine that the target storage bucket has shards being uploaded; if no, then determine that the target storage bucket does not have shards being uploaded.
[0029] This also includes:
[0030] An initialization module is used to initialize the upload fragment count field; wherein, the upload fragment count field is used to record whether there are fragments being uploaded in the target storage bucket.
[0031] This also includes:
[0032] An additional module is added to increment the upload fragment count field by one when the client uploads a fragment to the target storage bucket.
[0033] The reduction module is used to reduce the upload fragment count field by one when there are fragments that have been uploaded successfully or interrupted.
[0034] Specifically, the judgment module is used to: determine whether the uploaded fragment count field is zero; if yes, determine that the target storage bucket does not have any fragments being uploaded; if no, determine that the target storage bucket has fragments being uploaded.
[0035] Specifically, the deletion module is used to delete all fragments in the target storage bucket and delete the target storage bucket when there are no fragments being uploaded in the target storage bucket.
[0036] This also includes:
[0037] The sending module is used to send a busy notification message to the target storage bucket when there are fragments being uploaded.
[0038] To achieve the above objectives, this application provides an electronic device, comprising:
[0039] Memory, used to store computer programs;
[0040] A processor is used to implement the steps of the bucket management method described above when executing the computer program.
[0041] To achieve the above objectives, this application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the bucket management method described above.
[0042] As can be seen from the above scheme, the storage bucket management method provided in this application includes: when a deletion command for a target storage bucket is received, determining whether the target storage bucket has any fragments being uploaded; if not, deleting the target storage bucket.
[0043] The bucket management method provided in this application, when deleting a bucket containing only fragment upload objects, first checks if any fragments are being added. If fragments are being added, a message is displayed indicating that the bucket is busy and deletion is not allowed; otherwise, existing fragments are deleted before deleting the bucket. Therefore, the bucket management method provided in this application, by adding a detection mechanism to restrict bucket deletion, ensures that no junk data is generated after deleting a bucket containing only fragment upload objects, thus reducing storage costs. This application also discloses a bucket management device, an electronic device, and a computer-readable storage medium, which can achieve the same technical effects.
[0044] It should be understood that the above general description and the following detailed description are merely exemplary and do not limit this application. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. The drawings are used to provide a further understanding of this disclosure and constitute a part of the specification. They are used together with the following detailed description to explain this disclosure, but do not constitute a limitation of this disclosure. In the drawings:
[0046] Figure 1 This is a flowchart illustrating a bucket management method according to an exemplary embodiment;
[0047] Figure 2 This is a flowchart illustrating another bucket management method according to an exemplary embodiment;
[0048] Figure 3 This is a structural diagram illustrating a storage bucket management device according to an exemplary embodiment;
[0049] Figure 4 This is a structural diagram of an electronic device according to an exemplary embodiment. Detailed Implementation
[0050] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Furthermore, in the embodiments of this application, "first," "second," etc., are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0051] When deleting a bucket containing only uploaded fragments, the traditional S3 object storage protocol first deletes the fragments already in the bucket and then deletes the bucket. However, fragments that are currently being uploaded are not deleted, resulting in garbage data, occupying storage space, and increasing the user's storage costs.
[0052] Therefore, in this application, when deleting a bucket containing only fragmented upload objects, it first checks if any fragments are being added. If fragments are being added, it indicates that the bucket is busy and deletion is not allowed; if no fragments are being added, it deletes the existing fragments and then deletes the bucket. By adding a detection mechanism to restrict bucket deletion, this application ensures that no junk data is generated after deleting a bucket containing only fragmented upload objects, thus reducing storage costs.
[0053] This application discloses a storage bucket management method that avoids generating junk data when deleting storage buckets and reduces storage costs.
[0054] See Figure 1 A flowchart illustrating a bucket management method according to an exemplary embodiment, such as... Figure 1 As shown, it includes:
[0055] S101: When a delete command is received for the target storage bucket, determine whether there are any fragments being uploaded in the target storage bucket; if yes, proceed to S102; if no, proceed to S103.
[0056] In this embodiment, the execution entity is a controller that manages storage buckets. This controller can be used to create and delete storage buckets, as well as to manage other storage buckets. No specific limitations are specified here.
[0057] In practice, when a client uploads a large object to a storage bucket, it first performs a sharding operation on the object, and then uploads the shards to the storage bucket one by one.
[0058] For a storage bucket containing only fragment upload objects, directly deleting the storage bucket would result in the fragments currently being uploaded not being deleted, thus generating garbage data. Therefore, in this embodiment, when it is necessary to delete a target storage bucket, which is a storage bucket containing only fragment upload objects, the process first determines whether there are fragments currently being uploaded in the target storage bucket. If yes, proceed to S102; otherwise, proceed to S103.
[0059] As a feasible implementation, determining whether the target storage bucket has a fragment being uploaded includes: determining whether the number of fragments contained in the target storage bucket has increased; if yes, then determining that the target storage bucket has a fragment being uploaded; if no, then determining that the target storage bucket does not have a fragment being uploaded.
[0060] In practice, if the number of fragments in the target bucket increases, it indicates that there are fragments being uploaded in the target bucket. If the number of fragments in the target bucket remains unchanged, it indicates that there are no fragments being uploaded in the target bucket.
[0061] As another feasible implementation, before determining whether there are currently uploaded fragments in the target storage bucket when a deletion command is received, the method further includes: initializing an upload fragment count field; wherein, the upload fragment count field is used to record whether there are currently uploaded fragments in the target storage bucket; when the client uploads a fragment to the target storage bucket, the upload fragment count field is incremented by one; when there are fragments whose uploads have been completed or interrupted, the upload fragment count field is decremented by one. Determining whether there are currently uploaded fragments in the target storage bucket includes: determining whether the upload fragment count field is zero; if yes, then it is determined that there are no currently uploaded fragments in the target storage bucket; if no, then it is determined that there are currently uploaded fragments in the target storage bucket.
[0062] In practice, the controller initializes an upload fragment count field for each bucket. This upload fragment count field is used to record whether there are any fragments being uploaded in the corresponding bucket. If the upload fragment count field is equal to zero, it means that there are no fragments being uploaded in the corresponding bucket. If the upload fragment count field is greater than zero, it means that there are fragments being uploaded in the corresponding bucket. The value of the upload fragment count field represents the number of fragments being uploaded in the corresponding bucket.
[0063] When a client uploads a large object to a storage bucket, it first performs a fragmentation operation on the object, and then uploads the fragments one by one to the storage bucket. When a fragment of the client starts uploading, the corresponding fragment upload count field for that storage bucket is incremented by one; when a fragment upload in that storage bucket is completed or interrupted, the corresponding fragment upload count field is decremented by one. For the target storage bucket, when a fragment of the client starts uploading to the target storage bucket, the corresponding fragment upload count field for the target storage bucket is incremented by one; when a fragment upload is completed or interrupted, the corresponding fragment upload count field for the target storage bucket is decremented by one.
[0064] When a delete command is received for the target bucket, it is determined that the upload fragment count field of the target bucket is equal to zero. If the upload fragment count field of the target bucket is equal to zero, it means that there are no fragments being uploaded in the target bucket. If the upload fragment count field of the target bucket is greater than zero, it means that there are fragments being uploaded in the target bucket.
[0065] In other words, this embodiment adds a detection mechanism to restrict the deletion of storage buckets before deletion. The detection object is whether there are currently uploaded fragments in the storage bucket. If so, the deletion of the storage bucket is restricted, so as to avoid generating garbage data when the currently uploaded fragments are not deleted when the storage bucket is deleted, thereby reducing storage costs.
[0066] S102: Send a message indicating that the target storage bucket is busy;
[0067] In this step, if there is data being uploaded in the target bucket, a message will be displayed indicating that the target bucket is busy and deletion of the target bucket is not allowed.
[0068] S103: Delete the target storage bucket.
[0069] In this step, if there is no data being uploaded in the target bucket, the target bucket is deleted.
[0070] As a preferred embodiment, before deleting the target bucket, the method further includes deleting all fragments in the target bucket. In specific implementations, the target bucket is deleted after deleting all fragments to avoid garbage data generated by fragments already existing in the target bucket.
[0071] The bucket management method provided in this application, when deleting a bucket containing only fragment upload objects, first checks if any fragments are being added. If fragments are being added, it indicates that the bucket is busy and deletion is not allowed; if no fragments are being added, it deletes the existing fragments and then deletes the bucket. Therefore, the bucket management method provided in this application, by adding a detection mechanism to restrict bucket deletion, ensures that no garbage data is generated after deleting a bucket containing only fragment upload objects, thus reducing storage costs.
[0072] This application discloses a storage bucket management method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically:
[0073] See Figure 2 A flowchart illustrating another bucket management method according to an exemplary embodiment, such as... Figure 2 As shown, it includes:
[0074] S201: Initialize the upload fragment count field; wherein, the upload fragment count field is used to record whether there are fragments being uploaded in the target storage bucket;
[0075] In this embodiment, the execution entity is a controller that manages storage buckets. This controller can be used to create and delete storage buckets, as well as to manage other storage buckets. No specific limitations are specified here.
[0076] In practice, the controller initializes an upload fragment count field for each bucket. This upload fragment count field is used to record whether there are any fragments being uploaded in the corresponding bucket. If the upload fragment count field is equal to zero, it means that there are no fragments being uploaded in the corresponding bucket. If the upload fragment count field is greater than zero, it means that there are fragments being uploaded in the corresponding bucket. The value of the upload fragment count field represents the number of fragments being uploaded in the corresponding bucket.
[0077] S202: When the client uploads a fragment to the target storage bucket, increment the uploaded fragment count field by one;
[0078] S203: When there are fragments that have been uploaded or have been interrupted, decrement the upload fragment count field by one;
[0079] In practice, when a client uploads a large object to a storage bucket, it first performs a fragmentation operation on the object, and then uploads the fragments one by one to the storage bucket. When a fragment of the client starts uploading, the corresponding fragment upload count field for that storage bucket is incremented by one; when a fragment upload in that storage bucket is completed or interrupted, the corresponding fragment upload count field is decremented by one.
[0080] For the target bucket, when a client starts uploading a fragment to the target bucket, the corresponding upload fragment count field of the target bucket is incremented by one; when a fragment upload is completed or interrupted, the corresponding upload fragment count field of the target bucket is decremented by one.
[0081] S204: When a delete command for the target storage bucket is received, determine whether the upload fragment count field is zero; if yes, proceed to S205; if no, proceed to S206.
[0082] For a storage bucket containing only fragment upload objects, directly deleting the storage bucket would result in the fragments currently being uploaded not being deleted, thus generating garbage data. Therefore, in this embodiment, when it is necessary to delete a target storage bucket, which is a storage bucket containing only fragment upload objects, the process first determines whether there are fragments currently being uploaded in the target storage bucket. If yes, proceed to S206; otherwise, proceed to S205.
[0083] In practice, when a delete command is received for the target bucket, it is determined that the upload fragment count field of the target bucket is equal to zero. If the upload fragment count field of the target bucket is equal to zero, it means that there are no fragments being uploaded in the target bucket, and the process proceeds to S205. If the upload fragment count field of the target bucket is greater than zero, it means that there are fragments being uploaded in the target bucket, and the process proceeds to S206.
[0084] S205: Delete the target storage bucket;
[0085] In this step, the target bucket is deleted when there is no data being uploaded in the target bucket. As a preferred embodiment, before deleting the target bucket, the process further includes deleting all fragments in the target bucket. In specific implementations, the target bucket is deleted after deleting all fragments to avoid garbage data generated by fragments already existing in the target bucket.
[0086] S206: Send a message indicating that the target storage bucket is busy.
[0087] In this step, if there is data being uploaded in the target bucket, a message will be displayed indicating that the target bucket is busy and deletion of the target bucket is not allowed.
[0088] The bucket management method provided in this application, when deleting a bucket containing only fragment upload objects, first checks if any fragments are being added. If fragments are being added, it indicates that the bucket is busy and deletion is not allowed; if no fragments are being added, it deletes the existing fragments and then deletes the bucket. Therefore, the bucket management method provided in this application, by adding a detection mechanism to restrict bucket deletion, ensures that no garbage data is generated after deleting a bucket containing only fragment upload objects, thus reducing storage costs.
[0089] The following describes an application embodiment provided by this application, which adds a multi_part_count field to record whether there are any fragments being uploaded. When uploading a large object object1 to bucket1, the value of multi_part_count is incremented by 1 when a fragment begins uploading; the value of multi_part_count is decremented by 1 when a fragment upload is completed or interrupted.
[0090] The process of deleting a storage bucket includes the following steps:
[0091] Step 1: Check if the multi_part_count value of the storage bucket is 0;
[0092] Step 2: If the value of multi_part_count is 0, delete the bucket after deleting the existing fragments in the bucket;
[0093] Step 3: If the multi_part_count value is not 0, a message will be displayed indicating that the bucket is busy and deletion is not allowed.
[0094] The following describes a bucket management device provided in an embodiment of this application. The bucket management device described below and the bucket management method described above can be referred to each other.
[0095] See Figure 3 A structural diagram of a storage bucket management device according to an exemplary embodiment is shown, as follows: Figure 3 As shown, it includes:
[0096] The judgment module 301 is used to determine whether there are any fragments being uploaded in the target storage bucket when a deletion command is received from the target storage bucket;
[0097] In this embodiment, the execution entity is a controller that manages storage buckets. This controller can be used to create and delete storage buckets, as well as to manage other storage buckets. No specific limitations are specified here.
[0098] In practice, when a client uploads a large object to a storage bucket, it first performs a sharding operation on the object, and then uploads the shards to the storage bucket one by one.
[0099] For a storage bucket containing only fragment upload objects, directly deleting the storage bucket would result in the fragments currently being uploaded not being deleted, thus generating garbage data. Therefore, in this embodiment, when it is necessary to delete a target storage bucket, which is a storage bucket containing only fragment upload objects, the process first determines whether there are fragments currently being uploaded in the target storage bucket. If not, the workflow of the deletion module 302 is initiated.
[0100] In other words, this embodiment adds a detection mechanism to restrict the deletion of storage buckets before deletion. The detection object is whether there are currently uploaded fragments in the storage bucket. If so, the deletion of the storage bucket is restricted, so as to avoid generating garbage data when the currently uploaded fragments are not deleted when the storage bucket is deleted, thereby reducing storage costs.
[0101] The deletion module 302 is used to delete the target storage bucket when there is no fragment being uploaded in the target storage bucket.
[0102] In practice, if the target bucket does not contain any data being uploaded, the target bucket is deleted.
[0103] The bucket management device provided in this application embodiment checks whether any fragments are being added before deleting a bucket containing only fragment upload objects. If fragments are being added, the device indicates that the bucket is busy and deletion is not allowed; otherwise, it deletes the existing fragments and then deletes the bucket. Therefore, the bucket management device provided in this application embodiment, by adding a detection mechanism to restrict bucket deletion, ensures that no junk data is generated after deleting a bucket containing only fragment upload objects, thus reducing storage costs.
[0104] Based on the above embodiments, as a preferred implementation, the judgment module 301 is specifically used to: determine whether the number of shards contained in the target storage bucket has increased; if yes, then determine that the target storage bucket has shards being uploaded; if no, then determine that the target storage bucket does not have shards being uploaded.
[0105] In practice, if the number of fragments in the target bucket increases, it indicates that there are fragments being uploaded in the target bucket. If the number of fragments in the target bucket remains unchanged, it indicates that there are no fragments being uploaded in the target bucket.
[0106] Based on the above embodiments, as a preferred embodiment, it further includes:
[0107] An initialization module is used to initialize the upload fragment count field; wherein, the upload fragment count field is used to record whether there are fragments being uploaded in the target storage bucket.
[0108] In practice, the controller initializes an upload fragment count field for each bucket. This upload fragment count field is used to record whether there are any fragments being uploaded in the corresponding bucket. If the upload fragment count field is equal to zero, it means that there are no fragments being uploaded in the corresponding bucket. If the upload fragment count field is greater than zero, it means that there are fragments being uploaded in the corresponding bucket. The value of the upload fragment count field represents the number of fragments being uploaded in the corresponding bucket.
[0109] Based on the above embodiments, as a preferred embodiment, it further includes:
[0110] An additional module is added to increment the upload fragment count field by one when the client uploads a fragment to the target storage bucket.
[0111] The reduction module is used to reduce the upload fragment count field by one when there are fragments that have been uploaded successfully or interrupted.
[0112] In practice, when a client uploads a large object to a storage bucket, it first performs a fragmentation operation on the object, and then uploads the fragments one by one to the storage bucket. When a fragment of the client starts uploading, the corresponding fragment upload count field for that storage bucket is incremented by one; when a fragment upload in that storage bucket is completed or interrupted, the corresponding fragment upload count field is decremented by one.
[0113] For the target bucket, when a client starts uploading a fragment to the target bucket, the corresponding upload fragment count field of the target bucket is incremented by one; when a fragment upload is completed or interrupted, the corresponding upload fragment count field of the target bucket is decremented by one.
[0114] Based on the above embodiments, as a preferred implementation, the judgment module 301 is specifically used to: determine whether the uploaded fragment count field is zero; if yes, then determine that the target storage bucket does not have any fragments being uploaded; if no, then determine that the target storage bucket has fragments being uploaded.
[0115] In practice, when a delete command is received for the target bucket, it is determined that the upload fragment count field of the target bucket is equal to zero. If the upload fragment count field of the target bucket is equal to zero, it means that there are no fragments being uploaded in the target bucket. If the upload fragment count field of the target bucket is greater than zero, it means that there are fragments being uploaded in the target bucket.
[0116] Based on the above embodiments, as a preferred implementation, the deletion module 302 is specifically used to delete all fragments in the target storage bucket and delete the target storage bucket when there are no fragments being uploaded in the target storage bucket.
[0117] In practice, the target bucket is deleted after deleting all fragments in the target bucket to avoid garbage data generated by fragments that already exist in the target bucket.
[0118] Based on the above embodiments, as a preferred embodiment, it further includes:
[0119] The sending module is used to send a busy notification message to the target storage bucket when there are fragments being uploaded.
[0120] In practice, when there is data being uploaded in the target storage bucket, the workflow of the sending module is initiated, indicating that the target storage bucket is busy and deletion of the target storage bucket is not allowed.
[0121] The bucket management device provided in this application embodiment checks whether any fragments are being added before deleting a bucket containing only fragment upload objects. If fragments are being added, the device indicates that the bucket is busy and deletion is not allowed; otherwise, it deletes the existing fragments and then deletes the bucket. Therefore, the bucket management device provided in this application embodiment, by adding a detection mechanism to restrict bucket deletion, ensures that no junk data is generated after deleting a bucket containing only fragment upload objects, thus reducing storage costs.
[0122] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0123] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiments of this application, the embodiments of this application also provide an electronic device. Figure 4 This is a structural diagram of an electronic device according to an exemplary embodiment, such as... Figure 4 As shown, the electronic device includes:
[0124] Communication interface 1 enables information exchange with other devices, such as network devices;
[0125] Processor 2 is connected to communication interface 1 to enable information exchange with other devices and, when running a computer program, executes the bucket management method provided by one or more of the above-mentioned technical solutions. The computer program is stored on memory 3.
[0126] Of course, in practical applications, the various components in an electronic device are coupled together through bus system 4. It can be understood that bus system 4 is used to achieve communication and connection between these components. In addition to the data bus, bus system 4 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 4 The general will label all buses as Bus System 4.
[0127] The memory 3 in this embodiment is used to store various types of data to support the operation of the electronic device. Examples of such data include any computer program used to operate on the electronic device.
[0128] It is understood that memory 3 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); magnetic surface memory can be disk storage or magnetic tape storage. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memory 3 described in the embodiments of this application is intended to include, but is not limited to, these and any other suitable types of memory.
[0129] The methods disclosed in the embodiments of this application can be applied to processor 2, or implemented by processor 2. Processor 2 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 2 or by instructions in the form of software. The processor 2 may be a general-purpose processor, DSP, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 2 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in memory 3. Processor 2 reads the program in memory 3 and completes the steps of the aforementioned method in combination with its hardware.
[0130] When processor 2 executes the program, it implements the corresponding processes in the various methods of the embodiments of this application. For the sake of brevity, these will not be described in detail here.
[0131] The electronic device provided in this application, when deleting a storage bucket containing only fragment upload objects, first checks if any fragments are being added. If fragments are being added, it indicates that the storage bucket is busy and deletion is not allowed; if no fragments are being added, it deletes the existing fragments and then deletes the storage bucket. Therefore, the electronic device provided in this application, by adding a detection mechanism to restrict storage bucket deletion, ensures that no junk data is generated after deleting a storage bucket containing only fragment upload objects, thus reducing storage costs.
[0132] In an exemplary embodiment, this application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, such as a memory 3 that stores a computer program, which can be executed by a processor 2 to complete the steps described in the aforementioned method. The computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disc, or CD-ROM.
[0133] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.
[0134] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.
[0135] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A storage bucket management method, characterized in that, include: Initialize the upload fragment count field for the target bucket; wherein, the target bucket is a bucket containing only fragment upload objects, the upload fragment count field is used to record whether there are fragments being uploaded in the target bucket, and the value of the upload fragment count field represents the number of fragments being uploaded in the target bucket; When the client uploads a fragment to the target storage bucket, the uploaded fragment count field is incremented by one; When there are fragments that have been uploaded successfully or interrupted, the upload fragment count field is decremented by one; When a delete command is received for the target storage bucket, it is determined whether there are any fragments being uploaded in the target storage bucket; If so, the target bucket cannot be deleted; If not, delete all fragments in the target bucket and delete the target bucket. The step of determining whether the target storage bucket contains a fragment that is currently being uploaded includes: Determine whether the uploaded fragment count field is zero; If so, then it is determined that the target storage bucket does not have any fragments being uploaded; If not, it is determined that the target storage bucket contains a fragment that is being uploaded.
2. The storage bucket management method according to claim 1, characterized in that, The step of determining whether the target storage bucket contains a fragment that is being uploaded includes: Determine whether the number of shards contained in the target storage bucket has increased; If so, it is determined that the target storage bucket contains a fragment that is being uploaded; If not, it is determined that the target storage bucket does not have any fragments being uploaded.
3. The storage bucket management method according to claim 1, characterized in that, After determining whether the target storage bucket contains any fragments that are being uploaded, the process further includes: If the target storage bucket has fragments that are being uploaded, a message indicating that the target storage bucket is busy is sent.
4. A storage bucket management device, characterized in that, include: An initialization module is used to initialize an upload fragment count field for a target storage bucket; wherein, the target storage bucket is a storage bucket containing only fragment upload objects, and the upload fragment count field is used to record whether there are fragments being uploaded in the target storage bucket, and the value of the upload fragment count field represents the number of fragments being uploaded in the target storage bucket; An additional module is added to increment the upload fragment count field by one when the client uploads a fragment to the target storage bucket. The reduction module is used to reduce the upload fragment count field by one when there are fragments that have been uploaded or interrupted. The judgment module is used to determine whether there are any fragments being uploaded in the target storage bucket when a deletion command is received from the target storage bucket; if so, the deletion of the target storage bucket is not allowed; if not, the deletion module's workflow is started. The deletion module is used to delete all fragments in the target storage bucket and delete the target storage bucket. Specifically, the judgment module is used to: determine whether the uploaded fragment count field is zero; if yes, determine that the target storage bucket does not have any fragments being uploaded; if no, determine that the target storage bucket has fragments being uploaded.
5. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the bucket management method as described in any one of claims 1 to 3 when executing the computer program.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the bucket management method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Cross-domain bucket deletion method and system, terminal and storage medium
CN114442947A