mirror of
https://github.com/octoleo/restic.git
synced 2024-11-02 11:46:36 +00:00
Move Snapshots struct and policy to other files
This commit is contained in:
parent
47282abfa4
commit
5a34799554
@ -172,6 +172,24 @@ func (sn *Snapshot) SamePaths(paths []string) bool {
|
||||
return sn.HasPaths(paths)
|
||||
}
|
||||
|
||||
// Snapshots is a list of snapshots.
|
||||
type Snapshots []*Snapshot
|
||||
|
||||
// Len returns the number of snapshots in sn.
|
||||
func (sn Snapshots) Len() int {
|
||||
return len(sn)
|
||||
}
|
||||
|
||||
// Less returns true iff the ith snapshot has been made after the jth.
|
||||
func (sn Snapshots) Less(i, j int) bool {
|
||||
return sn[i].Time.After(sn[j].Time)
|
||||
}
|
||||
|
||||
// Swap exchanges the two snapshots.
|
||||
func (sn Snapshots) Swap(i, j int) {
|
||||
sn[i], sn[j] = sn[j], sn[i]
|
||||
}
|
||||
|
||||
// ErrNoSnapshotFound is returned when no snapshot for the given criteria could be found.
|
||||
var ErrNoSnapshotFound = errors.New("no snapshot found")
|
||||
|
||||
|
@ -6,24 +6,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Snapshots is a list of snapshots.
|
||||
type Snapshots []*Snapshot
|
||||
|
||||
// Len returns the number of snapshots in sn.
|
||||
func (sn Snapshots) Len() int {
|
||||
return len(sn)
|
||||
}
|
||||
|
||||
// Less returns true iff the ith snapshot has been made after the jth.
|
||||
func (sn Snapshots) Less(i, j int) bool {
|
||||
return sn[i].Time.After(sn[j].Time)
|
||||
}
|
||||
|
||||
// Swap exchanges the two snapshots.
|
||||
func (sn Snapshots) Swap(i, j int) {
|
||||
sn[i], sn[j] = sn[j], sn[i]
|
||||
}
|
||||
|
||||
// ExpirePolicy configures which snapshots should be automatically removed.
|
||||
type ExpirePolicy struct {
|
||||
Last int // keep the last n snapshots
|
Loading…
Reference in New Issue
Block a user