You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.3 KiB

  1. // Copyright (c) 2015-2024 MinIO, Inc.
  2. //
  3. // This file is part of MinIO Object Storage stack
  4. //
  5. // This program is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU Affero General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // This program is distributed in the hope that it will be useful
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU Affero General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU Affero General Public License
  16. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. package cmd
  18. import (
  19. "sync"
  20. "github.com/minio/minio/internal/config/ilm"
  21. )
  22. var globalILMConfig = ilmConfig{
  23. cfg: ilm.Config{
  24. ExpirationWorkers: 100,
  25. TransitionWorkers: 100,
  26. },
  27. }
  28. type ilmConfig struct {
  29. mu sync.RWMutex
  30. cfg ilm.Config
  31. }
  32. func (c *ilmConfig) getExpirationWorkers() int {
  33. c.mu.RLock()
  34. defer c.mu.RUnlock()
  35. return c.cfg.ExpirationWorkers
  36. }
  37. func (c *ilmConfig) getTransitionWorkers() int {
  38. c.mu.RLock()
  39. defer c.mu.RUnlock()
  40. return c.cfg.TransitionWorkers
  41. }
  42. func (c *ilmConfig) update(cfg ilm.Config) {
  43. c.mu.Lock()
  44. defer c.mu.Unlock()
  45. c.cfg = cfg
  46. }