From 4d3db7f057e6dc8df39131361c2bc505e329a3d2 Mon Sep 17 00:00:00 2001 From: Poorna Krishnamoorthy Date: Thu, 13 Oct 2022 12:31:37 -0700 Subject: [PATCH] stat: Return additional header for deletemarker replication that indicates whether target is ready to receive deletemarker. --- api-datatypes.go | 3 ++- api-stat.go | 6 ++++-- constants.go | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/api-datatypes.go b/api-datatypes.go index 4f5296ab1..d6795a024 100644 --- a/api-datatypes.go +++ b/api-datatypes.go @@ -147,7 +147,8 @@ type ObjectInfo struct { // - FAILED // - REPLICA (on the destination) ReplicationStatus string `xml:"ReplicationStatus"` - + // set to true if delete marker has backing object version on target, and eligible to replicate + ReplicationReady bool // Lifecycle expiry-date and ruleID associated with the expiry // not to be confused with `Expires` HTTP header. Expiration time.Time diff --git a/api-stat.go b/api-stat.go index 6deb5f5dc..5201939ab 100644 --- a/api-stat.go +++ b/api-stat.go @@ -90,6 +90,7 @@ func (c *Client) StatObject(ctx context.Context, bucketName, objectName string, if resp != nil { deleteMarker := resp.Header.Get(amzDeleteMarker) == "true" + replicationReady := resp.Header.Get(minioTgtReplicationReady) == "true" if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusPartialContent { if resp.StatusCode == http.StatusMethodNotAllowed && opts.VersionID != "" && deleteMarker { errResp := ErrorResponse{ @@ -105,8 +106,9 @@ func (c *Client) StatObject(ctx context.Context, bucketName, objectName string, }, errResp } return ObjectInfo{ - VersionID: resp.Header.Get(amzVersionID), - IsDeleteMarker: deleteMarker, + VersionID: resp.Header.Get(amzVersionID), + IsDeleteMarker: deleteMarker, + ReplicationReady: replicationReady, // whether delete marker can be replicated }, httpRespToErrorResponse(resp, bucketName, objectName) } } diff --git a/constants.go b/constants.go index dee83b870..2584c97cf 100644 --- a/constants.go +++ b/constants.go @@ -96,6 +96,7 @@ const ( minIOBucketReplicationObjectRetentionTimestamp = "X-Minio-Source-Replication-Retention-Timestamp" // Header indicates last legalhold update time on source minIOBucketReplicationObjectLegalHoldTimestamp = "X-Minio-Source-Replication-LegalHold-Timestamp" - - minIOForceDelete = "x-minio-force-delete" + minIOForceDelete = "x-minio-force-delete" + // Header indicates delete marker replication request can be sent by source now. + minioTgtReplicationReady = "X-Minio-Replication-Ready" )