Chung-En Lee created HDDS-16491:
-----------------------------------

             Summary: Implement PutObjectLegalHold
                 Key: HDDS-16491
                 URL: https://issues.apache.org/jira/browse/HDDS-16491
             Project: Apache Ozone
          Issue Type: Sub-task
            Reporter: Chung-En Lee


Implement the S3 {{PutObjectLegalHold}} operation to apply or remove a legal 
hold ({{{}ON{}}} or {{{}OFF{}}}) on individual keys in an Object-Lock-enabled 
bucket. This task covers S3 Gateway REST parsing, OM RPC messages, Ranger 
authorization, and OM HA write execution.

{*}1. S3 Gateway ({{{}hadoop-ozone/s3gateway{}}}){*}:
 * Add route handler for {{{}PUT /\{bucket}/\{key}?legal-hold{}}}.

 * Parse the incoming {{LegalHold}} XML payload:

 ** Extract {{Status}} (must be {{ON}} or {{{}OFF{}}}).

 * Validate the payload format and map malformed bodies to standard S3 errors 
(e.g., {{{}MalformedXML{}}}, {{{}InvalidArgument{}}}).

 * Forward the request to Ozone Manager via client protocol.

{*}2. Protobuf Protocol ({{{}OmClientProtocol.proto{}}}){*}:
 * Add client RPC messages:

 ** {{SetObjectLegalHoldRequest}} (contains {{{}volumeName{}}}, 
{{{}bucketName{}}}, {{{}keyName{}}}, and {{{}bool legalHold{}}}).

 ** {{{}SetObjectLegalHoldResponse{}}}.

 * Register the new request type in OM request dispatching pipeline.

{*}3. {{OMKeySetLegalHoldRequest}}{*}:
 * {*}{{preExecute}}{*}:

 ** Authorize the caller against Ranger action {{PutObjectLegalHold}} 
(requiring key-level {{WRITE}} permission).

 ** Validate payload parameters (ensure boolean status is explicitly provided).

 * {*}{{validateAndUpdateCache}}{*}:

 ** Acquire key write lock.

 ** Verify the target bucket exists and has {{{}objectLockEnabled == true{}}}; 
reject with {{InvalidRequest}} if Object Lock is not enabled on the bucket.

 ** Lookup target key in {{{}KeyTable{}}}. If absent, throw {{KEY_NOT_FOUND}} 
(mapped to S3 {{{}404 NoSuchKey{}}}).

 ** Update {{OmKeyInfo.legalHold}} ({{{}true{}}} for {{{}ON{}}}, {{false}} for 
{{{}OFF{}}}).

 ** Commit the updated {{OmKeyInfo}} to {{KeyTable}} cache and RocksDB.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to