simplify bucket metadata lookups for versioning/object locking (#17253)

This commit is contained in:
Harshavardhana
2023-05-22 12:05:14 -07:00
committed by GitHub
parent b1b00a5055
commit fc03be7891
5 changed files with 21 additions and 8 deletions

View File

@@ -119,6 +119,16 @@ func newBucketMetadata(name string) BucketMetadata {
}
}
// Versioning returns true if versioning is enabled
func (b BucketMetadata) Versioning() bool {
return b.LockEnabled || (b.versioningConfig != nil && b.versioningConfig.Enabled()) || (b.objectLockConfig != nil && b.objectLockConfig.Enabled())
}
// ObjectLocking returns true if object locking is enabled
func (b BucketMetadata) ObjectLocking() bool {
return b.LockEnabled || (b.objectLockConfig != nil && b.objectLockConfig.Enabled())
}
// SetCreatedAt preserves the CreatedAt time for bucket across sites in site replication. It defaults to
// creation time of bucket on this cluster in all other cases.
func (b *BucketMetadata) SetCreatedAt(createdAt time.Time) {