allow dynamically changing max_object_versions per object (#19265)

This commit is contained in:
Harshavardhana
2024-03-14 18:07:19 -07:00
committed by GitHub
parent 485298b680
commit 93fb7d62d8
4 changed files with 42 additions and 21 deletions

View File

@@ -55,6 +55,7 @@ type apiConfig struct {
gzipObjects bool
rootAccess bool
syncEvents bool
objectMaxVersions int
}
const (
@@ -186,6 +187,7 @@ func (t *apiConfig) init(cfg api.Config, setDriveCounts []int) {
t.gzipObjects = cfg.GzipObjects
t.rootAccess = cfg.RootAccess
t.syncEvents = cfg.SyncEvents
t.objectMaxVersions = cfg.ObjectMaxVersions
}
func (t *apiConfig) odirectEnabled() bool {
@@ -386,3 +388,15 @@ func (t *apiConfig) isSyncEventsEnabled() bool {
return t.syncEvents
}
func (t *apiConfig) getObjectMaxVersions() int {
t.mu.RLock()
defer t.mu.RUnlock()
if t.objectMaxVersions <= 0 {
// defaults to 'maxObjectVersions' when unset.
return maxObjectVersions
}
return t.objectMaxVersions
}