Skip to content

Commit 5a98518

Browse files
Revert "Add header for lifecycle config expiry to ignore replication (#1999)"
This reverts commit 2a9a820.
1 parent 2a9a820 commit 5a98518

File tree

4 files changed

+14
-27
lines changed

4 files changed

+14
-27
lines changed

api-bucket-lifecycle.go

+12-19
Original file line numberDiff line numberDiff line change
@@ -41,36 +41,30 @@ func (c *Client) SetBucketLifecycle(ctx context.Context, bucketName string, conf
4141
if config.Empty() {
4242
return c.removeBucketLifecycle(ctx, bucketName)
4343
}
44-
expAfterRepl := config.ExpireAfterReplication
45-
config.ExpireAfterReplication = ""
44+
4645
buf, err := xml.Marshal(config)
4746
if err != nil {
4847
return err
4948
}
5049

5150
// Save the updated lifecycle.
52-
return c.putBucketLifecycle(ctx, bucketName, buf, expAfterRepl)
51+
return c.putBucketLifecycle(ctx, bucketName, buf)
5352
}
5453

5554
// Saves a new bucket lifecycle.
56-
func (c *Client) putBucketLifecycle(ctx context.Context, bucketName string, buf []byte, expAfterRepl string) error {
55+
func (c *Client) putBucketLifecycle(ctx context.Context, bucketName string, buf []byte) error {
5756
// Get resources properly escaped and lined up before
5857
// using them in http request.
5958
urlValues := make(url.Values)
6059
urlValues.Set("lifecycle", "")
61-
var cheaders http.Header
62-
if expAfterRepl != "" {
63-
cheaders = make(http.Header)
64-
cheaders.Set(minioLifecycleExpiryAfterReplication, expAfterRepl)
65-
}
60+
6661
// Content-length is mandatory for put lifecycle request
6762
reqMetadata := requestMetadata{
6863
bucketName: bucketName,
6964
queryValues: urlValues,
7065
contentBody: bytes.NewReader(buf),
7166
contentLength: int64(len(buf)),
7267
contentMD5Base64: sumMD5Base64(buf),
73-
customHeader: cheaders,
7468
}
7569

7670
// Execute PUT to upload a new bucket lifecycle.
@@ -120,7 +114,7 @@ func (c *Client) GetBucketLifecycleWithInfo(ctx context.Context, bucketName stri
120114
return nil, time.Time{}, err
121115
}
122116

123-
bucketLifecycle, updatedAt, expAfterRepl, err := c.getBucketLifecycle(ctx, bucketName)
117+
bucketLifecycle, updatedAt, err := c.getBucketLifecycle(ctx, bucketName)
124118
if err != nil {
125119
return nil, time.Time{}, err
126120
}
@@ -129,12 +123,11 @@ func (c *Client) GetBucketLifecycleWithInfo(ctx context.Context, bucketName stri
129123
if err = xml.Unmarshal(bucketLifecycle, config); err != nil {
130124
return nil, time.Time{}, err
131125
}
132-
config.ExpireAfterReplication = expAfterRepl
133126
return config, updatedAt, nil
134127
}
135128

136129
// Request server for current bucket lifecycle.
137-
func (c *Client) getBucketLifecycle(ctx context.Context, bucketName string) ([]byte, time.Time, string, error) {
130+
func (c *Client) getBucketLifecycle(ctx context.Context, bucketName string) ([]byte, time.Time, error) {
138131
// Get resources properly escaped and lined up before
139132
// using them in http request.
140133
urlValues := make(url.Values)
@@ -149,28 +142,28 @@ func (c *Client) getBucketLifecycle(ctx context.Context, bucketName string) ([]b
149142

150143
defer closeResponse(resp)
151144
if err != nil {
152-
return nil, time.Time{}, "", err
145+
return nil, time.Time{}, err
153146
}
154147

155148
if resp != nil {
156149
if resp.StatusCode != http.StatusOK {
157-
return nil, time.Time{}, "", httpRespToErrorResponse(resp, bucketName, "")
150+
return nil, time.Time{}, httpRespToErrorResponse(resp, bucketName, "")
158151
}
159152
}
160153

161154
lcBytes, err := io.ReadAll(resp.Body)
162155
if err != nil {
163-
return nil, time.Time{}, "", err
156+
return nil, time.Time{}, err
164157
}
165158

166159
const minIOLifecycleCfgUpdatedAt = "X-Minio-LifecycleConfig-UpdatedAt"
167160
var updatedAt time.Time
168161
if timeStr := resp.Header.Get(minIOLifecycleCfgUpdatedAt); timeStr != "" {
169162
updatedAt, err = time.Parse(iso8601DateFormat, timeStr)
170163
if err != nil {
171-
return nil, time.Time{}, "", err
164+
return nil, time.Time{}, err
172165
}
173166
}
174-
expAfterRepl := resp.Header.Get(minioLifecycleExpiryAfterReplication)
175-
return lcBytes, updatedAt, expAfterRepl, nil
167+
168+
return lcBytes, updatedAt, nil
176169
}

api-put-object.go

-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ const (
4545
ReplicationStatusFailed ReplicationStatus = "FAILED"
4646
// ReplicationStatusReplica indicates object is a replica of a source
4747
ReplicationStatusReplica ReplicationStatus = "REPLICA"
48-
// ReplicationStatusReplicaEdge indicates object is a replica of a edge source
49-
ReplicationStatusReplicaEdge ReplicationStatus = "REPLICA-EDGE"
5048
)
5149

5250
// Empty returns true if no replication status set.

constants.go

-3
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,4 @@ const (
127127
minioTgtReplicationReady = "X-Minio-Replication-Ready"
128128
// Header asks if delete marker replication request can be sent by source now.
129129
isMinioTgtReplicationReady = "X-Minio-Check-Replication-Ready"
130-
131-
// Header indicating if ilm expiry ignores replication status
132-
minioLifecycleExpiryAfterReplication = "X-Minio-Lifecycle-Expiry-After-Replication"
133130
)

pkg/lifecycle/lifecycle.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,8 @@ type Rule struct {
496496

497497
// Configuration is a collection of Rule objects.
498498
type Configuration struct {
499-
XMLName xml.Name `xml:"LifecycleConfiguration,omitempty" json:"-"`
500-
Rules []Rule `xml:"Rule"`
501-
ExpireAfterReplication string `xml:"-" json:"-"`
499+
XMLName xml.Name `xml:"LifecycleConfiguration,omitempty" json:"-"`
500+
Rules []Rule `xml:"Rule"`
502501
}
503502

504503
// Empty check if lifecycle configuration is empty

0 commit comments

Comments
 (0)