mirror of
https://github.com/octoleo/restic.git
synced 2024-11-02 11:46:36 +00:00
Add ExpirePolicy.Empty()
This commit is contained in:
parent
bf47dba1c4
commit
71f7f4f543
@ -67,7 +67,13 @@ type ExpirePolicy struct {
|
||||
// Sum returns the maximum number of snapshots to be kept according to this
|
||||
// policy.
|
||||
func (e ExpirePolicy) Sum() int {
|
||||
return e.Last + e.Daily + e.Weekly + e.Monthly + e.Yearly
|
||||
return e.Last + e.Hourly + e.Daily + e.Weekly + e.Monthly + e.Yearly
|
||||
}
|
||||
|
||||
// Empty returns true iff no policy has been configured (all values zero).
|
||||
func (e ExpirePolicy) Empty() bool {
|
||||
empty := ExpirePolicy{}
|
||||
return e == empty
|
||||
}
|
||||
|
||||
// filter is used to split a list of snapshots into those to keep and those to
|
||||
@ -175,8 +181,7 @@ func (f *filter) finish() {
|
||||
func ApplyPolicy(list Snapshots, p ExpirePolicy) (keep, remove Snapshots) {
|
||||
sort.Sort(list)
|
||||
|
||||
empty := ExpirePolicy{}
|
||||
if p == empty {
|
||||
if p.Empty() {
|
||||
return list, remove
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user