Files
esctl/pkg/cfg/ilm.go

77 lines
2.0 KiB
Go

/*
Copyright © 2026 Thomas von Dein
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cfg
type Ilm struct {
Description string
HotMinAge string
HotRolloverMaxAge string
HotRolloverMaxPrimaryShardSize string
HotRolloverMaxDocs int64
HotReadonly bool
WarmMinAge string
WarmForceMerge int
WarmShrinkShards int
WarmPriority int
ColdMinAge string
ColdSearchableSnapshotRepo string
ColdForceMerge int
ColdPriority int
FrozenMinAge string
FrozenSearchableSnapshotRepo string
DeleteMinAge string
DeleteSearchableSnapshots bool
MinAge, FromPhase, Within string // forecast
Tree bool
}
func (cfg *Ilm) HaveHot() bool {
return cfg.HotMinAge != "" ||
cfg.HotRolloverMaxAge != "" ||
cfg.HotRolloverMaxDocs > 0 ||
cfg.HotRolloverMaxPrimaryShardSize != "" ||
cfg.HotReadonly
}
func (cfg *Ilm) HaveWarm() bool {
return cfg.WarmMinAge != "" ||
cfg.WarmForceMerge > 0 ||
cfg.WarmShrinkShards > 0 ||
cfg.WarmPriority > 0
}
func (cfg *Ilm) HaveCold() bool {
return cfg.ColdMinAge != "" ||
cfg.ColdSearchableSnapshotRepo != "" ||
cfg.ColdForceMerge > 0 ||
cfg.ColdPriority > 0
}
func (cfg *Ilm) HaveFrozen() bool {
return cfg.FrozenMinAge != ""
}
func (cfg *Ilm) HaveDelete() bool {
return cfg.DeleteSearchableSnapshots || cfg.DeleteMinAge != ""
}