百度智能云

All Product Document

          Object Storage

          Set Recycle Bin

          Application Scenarios

          When developers store and manage data in BOS, they usually hope to have better solutions in the following scenarios based on higher requirements of data reliability:

          • If relevant data is deleted by mistake, we hope there is a way to retrieve the data;
          • When a bucket is authorized to multiple users through ACL, and users are given write privilege, it is hoped to avoid malicious deletion of data in the bucket by these users

          Method of Application

          Based on the above scenario, BOS provides the recycle bin function, so as to improve the data reliability of BOS, besides, the bucket Owner and the users with full control privilege can configure the bucket with recycle bin related configuration. According to the development practice, methods as API and console can be adopted:

          • Open the recycle bin function through PuTrash Interface
          • Shut down the recycle bin function through DeleteTrash Interface View status of current recycle bin GetTrash Interface Operate Recycle Bin through Console

            1.When the bucket turns on the Recycle Bin function, the user can find the deleted data in the bucket in the Recycle Bin directory of the bucket. The path of Recycle Bin defaults to bucket/.trash/ 2.If you need to recover the data in the Recycle Bin, just rename the file in the Recycle Bin and remove the .trash/path from its file name. 3.If you need to completely clear the data in the Recycle Bin, you just delete a file under the .trash/path again.

          At the same time, based on the second situation in the above application scenario, you can also combine Recycle Bin capabilities with bucket ACL, for example, to configure the following ACL for a certain user who needs Write privilege in BucketA:

          {
            "id": "policy_3563bce24f2049629f4e0b6bf7a2775d",
            "version": "v1",
            "grantee": [
                          {
                              "id": "b124deeaf6f641c9ac27700b41a350a8"
                          }
                      ],
            "accessControlList": [
              {
                "service": "bce:bos",
                "region": "bj",
                "resource": [
                  "BucketA"
                ],
                "effect": "Allow",
                "permission": [
                  WRITE"
                ]
              },
              {
                "service": "bce:bos",
                "region": "bj",
                "resource": [
                  "BucketA/.trash/"
                ],
                "effect": "Deny",
                "permission": [
                  "DeleteObject"
                ]
              }
            ]
          }

          Through the above ACL, the user can write and delete bucket, but cannot completely delete the data in the Recycle Bin for the second time.

          Note

          1. When the bucket has turned on the Recycle Bin function and set the Recycle Bin path to .trash/, then delete the file A in the bucket (the original file path is bucket/test/A), then change the path of the file A into Bucke/.trash/test/A, and you turn off the Recycle Bin of the bucket, then the reserved path of the file A in the bucket remains bucket/.trash/test/A. Therefore, you are reminded to remove similar garbage files as needed after turning off the Recycle Bin function.
          2. When bucket has turned on the Recycle Bin function and set the Recycle Bin path to .trash/, the deleted files will enter the bucket/.trash/directory, then you change the Recycle Bin file path to .trashX/, and the Recycle Bin files before the path change will remain in the original location, that is, under the bucket/.trash/path, while the deleted files will enter the bucket/.trashX/path. Therefore, you are reminded to move the original files in the Recycle Bin as needed when changing the path of the Recycle Bin.
          3. When archive type files are deleted, archive type files will not enter the recycle bin and will be deleted directly.

          Charge Mode

          • BOS recycle bin does not charge additional fees. Files in the recycle bin are also regarded as part of the data in bucket, and capacity fees are charged according to their storage types.
          • No capacity charge will be charged when the documents in the recycle bin are completely cleared.
          Previous
          Basic Operations of Object
          Next
          Server Encryption