Merge pull request #1876 from restic/forget-explain

forget: Add --explain
This commit is contained in:
Alexander Neumann
2018-08-25 21:48:44 +02:00
45 changed files with 12275 additions and 3579 deletions
+56 -11
View File
@@ -6,6 +6,8 @@ import (
"sort"
"strings"
"time"
"github.com/restic/restic/internal/debug"
)
// ExpirePolicy configures which snapshots should be automatically removed.
@@ -125,41 +127,70 @@ func findLatestTimestamp(list Snapshots) time.Time {
return latest
}
// KeepReason specifies why a particular snapshot was kept, and the counters at
// that point in the policy evaluation.
type KeepReason struct {
Snapshot *Snapshot `json:"snapshot"`
// description text which criteria match, e.g. "daily", "monthly"
Matches []string `json:"matches"`
// the counters after evaluating the current snapshot
Counters struct {
Last int `json:"last,omitempty"`
Hourly int `json:"hourly,omitempty"`
Daily int `json:"daily,omitempty"`
Weekly int `json:"weekly,omitempty"`
Monthly int `json:"monthly,omitempty"`
Yearly int `json:"yearly,omitempty"`
} `json:"counters"`
}
// ApplyPolicy returns the snapshots from list that are to be kept and removed
// according to the policy p. list is sorted in the process.
func ApplyPolicy(list Snapshots, p ExpirePolicy) (keep, remove Snapshots) {
// according to the policy p. list is sorted in the process. reasons contains
// the reasons to keep each snapshot, it is in the same order as keep.
func ApplyPolicy(list Snapshots, p ExpirePolicy) (keep, remove Snapshots, reasons []KeepReason) {
sort.Sort(list)
if p.Empty() {
return list, remove
for _, sn := range list {
reasons = append(reasons, KeepReason{
Snapshot: sn,
Matches: []string{"policy is empty"},
})
}
return list, remove, reasons
}
if len(list) == 0 {
return list, remove
return list, nil, nil
}
var buckets = [6]struct {
Count int
bucker func(d time.Time, nr int) int
Last int
reason string
}{
{p.Last, always, -1},
{p.Hourly, ymdh, -1},
{p.Daily, ymd, -1},
{p.Weekly, yw, -1},
{p.Monthly, ym, -1},
{p.Yearly, y, -1},
{p.Last, always, -1, "last snapshot"},
{p.Hourly, ymdh, -1, "hourly snapshot"},
{p.Daily, ymd, -1, "daily snapshot"},
{p.Weekly, yw, -1, "weekly snapshot"},
{p.Monthly, ym, -1, "monthly snapshot"},
{p.Yearly, y, -1, "yearly snapshot"},
}
latest := findLatestTimestamp(list)
for nr, cur := range list {
var keepSnap bool
var keepSnapReasons []string
// Tags are handled specially as they are not counted.
for _, l := range p.Tags {
if cur.HasTags(l) {
keepSnap = true
keepSnapReasons = append(keepSnapReasons, fmt.Sprintf("has tags %v", l))
}
}
@@ -168,6 +199,7 @@ func ApplyPolicy(list Snapshots, p ExpirePolicy) (keep, remove Snapshots) {
t := latest.AddDate(-p.Within.Years, -p.Within.Months, -p.Within.Days)
if cur.Time.After(t) {
keepSnap = true
keepSnapReasons = append(keepSnapReasons, fmt.Sprintf("within %v", p.Within))
}
}
@@ -176,19 +208,32 @@ func ApplyPolicy(list Snapshots, p ExpirePolicy) (keep, remove Snapshots) {
if b.Count > 0 {
val := b.bucker(cur.Time, nr)
if val != b.Last {
debug.Log("keep %v %v, bucker %v, val %v\n", cur.Time, cur.id.Str(), i, val)
keepSnap = true
buckets[i].Last = val
buckets[i].Count--
keepSnapReasons = append(keepSnapReasons, b.reason)
}
}
}
if keepSnap {
keep = append(keep, cur)
kr := KeepReason{
Snapshot: cur,
Matches: keepSnapReasons,
}
kr.Counters.Last = buckets[0].Count
kr.Counters.Hourly = buckets[1].Count
kr.Counters.Daily = buckets[2].Count
kr.Counters.Weekly = buckets[3].Count
kr.Counters.Monthly = buckets[4].Count
kr.Counters.Yearly = buckets[5].Count
reasons = append(reasons, kr)
} else {
remove = append(remove, cur)
}
}
return keep, remove
return keep, remove, reasons
}
+51 -28
View File
@@ -5,10 +5,11 @@ import (
"fmt"
"io/ioutil"
"path/filepath"
"reflect"
"testing"
"time"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/restic/restic/internal/restic"
)
@@ -52,6 +53,43 @@ func TestExpireSnapshotOps(t *testing.T) {
}
}
// ApplyPolicyResult is used to marshal/unmarshal the golden files for
// TestApplyPolicy.
type ApplyPolicyResult struct {
Keep restic.Snapshots `json:"keep"`
Reasons []restic.KeepReason `json:"reasons,omitempty"`
}
func loadGoldenFile(t testing.TB, filename string) (res ApplyPolicyResult) {
buf, err := ioutil.ReadFile(filename)
if err != nil {
t.Fatalf("error loading golden file %v: %v", filename, err)
}
err = json.Unmarshal(buf, &res)
if err != nil {
t.Fatalf("error unmarshalling golden file %v: %v", filename, err)
}
return res
}
func saveGoldenFile(t testing.TB, filename string, keep restic.Snapshots, reasons []restic.KeepReason) {
res := ApplyPolicyResult{
Keep: keep,
Reasons: reasons,
}
buf, err := json.MarshalIndent(res, "", " ")
if err != nil {
t.Fatalf("error marshaling result: %v", err)
}
if err = ioutil.WriteFile(filename, buf, 0644); err != nil {
t.Fatalf("unable to update golden file: %v", err)
}
}
func TestApplyPolicy(t *testing.T) {
var testExpireSnapshots = restic.Snapshots{
{Time: parseTimeUTC("2014-09-01 10:20:30")},
@@ -191,10 +229,8 @@ func TestApplyPolicy(t *testing.T) {
for i, p := range tests {
t.Run("", func(t *testing.T) {
keep, remove := restic.ApplyPolicy(testExpireSnapshots, p)
t.Logf("returned keep %v, remove %v (of %v) expired snapshots for policy %v",
len(keep), len(remove), len(testExpireSnapshots), p)
keep, remove, reasons := restic.ApplyPolicy(testExpireSnapshots, p)
if len(keep)+len(remove) != len(testExpireSnapshots) {
t.Errorf("len(keep)+len(remove) = %d != len(testExpireSnapshots) = %d",
@@ -206,39 +242,26 @@ func TestApplyPolicy(t *testing.T) {
p.Sum(), len(keep))
}
for _, sn := range keep {
t.Logf(" keep snapshot at %v %s", sn.Time, sn.Tags)
}
for _, sn := range remove {
t.Logf(" forget snapshot at %v %s", sn.Time, sn.Tags)
if len(keep) != len(reasons) {
t.Errorf("got %d keep reasons for %d snapshots to keep, these must be equal", len(reasons), len(keep))
}
goldenFilename := filepath.Join("testdata", fmt.Sprintf("policy_keep_snapshots_%d", i))
if *updateGoldenFiles {
buf, err := json.MarshalIndent(keep, "", " ")
if err != nil {
t.Fatalf("error marshaling result: %v", err)
}
if err = ioutil.WriteFile(goldenFilename, buf, 0644); err != nil {
t.Fatalf("unable to update golden file: %v", err)
}
saveGoldenFile(t, goldenFilename, keep, reasons)
}
buf, err := ioutil.ReadFile(goldenFilename)
if err != nil {
t.Fatalf("error loading golden file %v: %v", goldenFilename, err)
want := loadGoldenFile(t, goldenFilename)
cmpOpts := cmpopts.IgnoreUnexported(restic.Snapshot{})
if !cmp.Equal(want.Keep, keep, cmpOpts) {
t.Error(cmp.Diff(want.Keep, keep, cmpOpts))
}
var want restic.Snapshots
err = json.Unmarshal(buf, &want)
if err != nil {
t.Fatalf("error unmarshalling golden file %v: %v", goldenFilename, err)
}
if !reflect.DeepEqual(keep, want) {
t.Fatalf("wrong result, want:\n %v\ngot:\n %v", want, keep)
if !cmp.Equal(want.Reasons, reasons, cmpOpts) {
t.Error(cmp.Diff(want.Reasons, reasons, cmpOpts))
}
})
}
File diff suppressed because it is too large Load Diff
+184 -52
View File
@@ -1,52 +1,184 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 9
}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 8
}
},
{
"snapshot": {
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 7
}
},
{
"snapshot": {
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 6
}
},
{
"snapshot": {
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 5
}
},
{
"snapshot": {
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 4
}
},
{
"snapshot": {
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 3
}
},
{
"snapshot": {
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 2
}
},
{
"snapshot": {
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 1
}
},
{
"snapshot": {
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {}
}
]
}
+187 -52
View File
@@ -1,52 +1,187 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot",
"daily snapshot"
],
"counters": {
"last": 1,
"daily": 9
}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot",
"daily snapshot"
],
"counters": {
"daily": 8
}
},
{
"snapshot": {
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 7
}
},
{
"snapshot": {
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 6
}
},
{
"snapshot": {
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 5
}
},
{
"snapshot": {
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 4
}
},
{
"snapshot": {
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 3
}
},
{
"snapshot": {
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 2
}
},
{
"snapshot": {
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 1
}
},
{
"snapshot": {
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {}
}
]
}
+40 -12
View File
@@ -1,12 +1,40 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"weekly snapshot"
],
"counters": {
"weekly": 1
}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"weekly snapshot"
],
"counters": {}
}
]
}
+76 -22
View File
@@ -1,22 +1,76 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"weekly snapshot"
],
"counters": {
"weekly": 3
}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"weekly snapshot"
],
"counters": {
"weekly": 2
}
},
{
"snapshot": {
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"weekly snapshot"
],
"counters": {
"weekly": 1
}
},
{
"snapshot": {
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"weekly snapshot"
],
"counters": {}
}
]
}
+81 -22
View File
@@ -1,22 +1,81 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot",
"weekly snapshot"
],
"counters": {
"daily": 2,
"weekly": 3
}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot",
"weekly snapshot"
],
"counters": {
"daily": 1,
"weekly": 2
}
},
{
"snapshot": {
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot",
"weekly snapshot"
],
"counters": {
"weekly": 1
}
},
{
"snapshot": {
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"weekly snapshot"
],
"counters": {}
}
]
}
+112 -32
View File
@@ -1,32 +1,112 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-09-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-08-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2014-11-22T10:20:30Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-09-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-08-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2014-11-22T10:20:30Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"monthly snapshot"
],
"counters": {
"monthly": 5
}
},
{
"snapshot": {
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"monthly snapshot"
],
"counters": {
"monthly": 4
}
},
{
"snapshot": {
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"monthly snapshot"
],
"counters": {
"monthly": 3
}
},
{
"snapshot": {
"time": "2015-09-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"monthly snapshot"
],
"counters": {
"monthly": 2
}
},
{
"snapshot": {
"time": "2015-08-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"monthly snapshot"
],
"counters": {
"monthly": 1
}
},
{
"snapshot": {
"time": "2014-11-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"monthly snapshot"
],
"counters": {}
}
]
}
+135 -37
View File
@@ -1,37 +1,135 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-09-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-08-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2014-11-22T10:20:30Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-09-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-08-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2014-11-22T10:20:30Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot",
"weekly snapshot",
"monthly snapshot"
],
"counters": {
"daily": 1,
"weekly": 1,
"monthly": 5
}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot",
"weekly snapshot"
],
"counters": {
"monthly": 5
}
},
{
"snapshot": {
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"monthly snapshot"
],
"counters": {
"monthly": 4
}
},
{
"snapshot": {
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"monthly snapshot"
],
"counters": {
"monthly": 3
}
},
{
"snapshot": {
"time": "2015-09-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"monthly snapshot"
],
"counters": {
"monthly": 2
}
},
{
"snapshot": {
"time": "2015-08-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"monthly snapshot"
],
"counters": {
"monthly": 1
}
},
{
"snapshot": {
"time": "2014-11-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"monthly snapshot"
],
"counters": {}
}
]
}
+60 -17
View File
@@ -1,17 +1,60 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2014-11-22T10:20:30Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2014-11-22T10:20:30Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"yearly snapshot"
],
"counters": {
"yearly": 9
}
},
{
"snapshot": {
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"yearly snapshot"
],
"counters": {
"yearly": 8
}
},
{
"snapshot": {
"time": "2014-11-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"yearly snapshot"
],
"counters": {
"yearly": 7
}
}
]
}
+206 -52
View File
@@ -1,52 +1,206 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2014-11-22T10:20:30Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2014-11-22T10:20:30Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot",
"weekly snapshot",
"monthly snapshot",
"yearly snapshot"
],
"counters": {
"daily": 6,
"weekly": 1,
"monthly": 2,
"yearly": 9
}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot",
"weekly snapshot"
],
"counters": {
"daily": 5,
"monthly": 2,
"yearly": 9
}
},
{
"snapshot": {
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 4,
"monthly": 2,
"yearly": 9
}
},
{
"snapshot": {
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 3,
"monthly": 2,
"yearly": 9
}
},
{
"snapshot": {
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 2,
"monthly": 2,
"yearly": 9
}
},
{
"snapshot": {
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 1,
"monthly": 2,
"yearly": 9
}
},
{
"snapshot": {
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"monthly": 2,
"yearly": 9
}
},
{
"snapshot": {
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"monthly snapshot",
"yearly snapshot"
],
"counters": {
"monthly": 1,
"yearly": 8
}
},
{
"snapshot": {
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"monthly snapshot"
],
"counters": {
"yearly": 8
}
},
{
"snapshot": {
"time": "2014-11-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"yearly snapshot"
],
"counters": {
"yearly": 7
}
}
]
}
+416 -153
View File
@@ -1,153 +1,416 @@
[
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": [
"path1",
"path2"
],
"tags": [
"foo",
"bar"
]
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2014-11-15T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2014-11-13T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-11-12T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-11-10T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-11-08T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-20T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-11T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-10T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-09T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-08T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-06T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-05T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-02T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-01T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
}
]
{
"keep": [
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": [
"path1",
"path2"
],
"tags": [
"foo",
"bar"
]
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2014-11-15T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2014-11-13T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-11-12T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-11-10T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-11-08T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-20T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-11T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-10T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-09T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-08T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-06T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-05T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-02T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-01T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
}
],
"reasons": [
{
"snapshot": {
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": [
"path1",
"path2"
],
"tags": [
"foo",
"bar"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-11-15T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-11-13T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-11-12T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-11-10T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-11-08T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-20T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-11T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-10T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-09T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-08T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-06T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-05T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-02T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-01T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
}
]
}
+108 -41
View File
@@ -1,41 +1,108 @@
[
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": [
"path1",
"path2"
],
"tags": [
"foo",
"bar"
]
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2014-11-15T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
}
]
{
"keep": [
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": [
"path1",
"path2"
],
"tags": [
"foo",
"bar"
]
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2014-11-15T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
}
],
"reasons": [
{
"snapshot": {
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": [
"path1",
"path2"
],
"tags": [
"foo",
"bar"
]
},
"matches": [
"has tags [foo, bar]"
],
"counters": {}
},
{
"snapshot": {
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
"matches": [
"has tags [foo, bar]"
],
"counters": {}
},
{
"snapshot": {
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
"matches": [
"has tags [foo, bar]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-11-15T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
"matches": [
"has tags [foo, bar]"
],
"counters": {}
}
]
}
+274 -77
View File
@@ -1,77 +1,274 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:28:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:24:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T11:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T10:23:03Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:28:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:24:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T11:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T10:23:03Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 14
}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 13
}
},
{
"snapshot": {
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 12
}
},
{
"snapshot": {
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 11
}
},
{
"snapshot": {
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 10
}
},
{
"snapshot": {
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 9
}
},
{
"snapshot": {
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 8
}
},
{
"snapshot": {
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 7
}
},
{
"snapshot": {
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 6
}
},
{
"snapshot": {
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 5
}
},
{
"snapshot": {
"time": "2016-01-04T12:28:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 4
}
},
{
"snapshot": {
"time": "2016-01-04T12:24:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 3
}
},
{
"snapshot": {
"time": "2016-01-04T12:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 2
}
},
{
"snapshot": {
"time": "2016-01-04T11:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 1
}
},
{
"snapshot": {
"time": "2016-01-04T10:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {}
}
]
}
+442 -161
View File
@@ -1,161 +1,442 @@
[
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": [
"path1",
"path2"
],
"tags": [
"foo",
"bar"
]
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2014-11-15T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2014-11-13T10:20:30.1Z",
"tree": null,
"paths": null,
"tags": [
"bar"
]
},
{
"time": "2014-11-13T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-11-12T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-11-10T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-11-08T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-20T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-11T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-10T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-09T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-08T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-06T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-05T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-02T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-01T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
}
]
{
"keep": [
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": [
"path1",
"path2"
],
"tags": [
"foo",
"bar"
]
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2014-11-15T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
{
"time": "2014-11-13T10:20:30.1Z",
"tree": null,
"paths": null,
"tags": [
"bar"
]
},
{
"time": "2014-11-13T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-11-12T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-11-10T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-11-08T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-20T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-11T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-10T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-09T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-08T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-06T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-05T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-02T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
{
"time": "2014-10-01T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
}
],
"reasons": [
{
"snapshot": {
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": [
"path1",
"path2"
],
"tags": [
"foo",
"bar"
]
},
"matches": [
"has tags [foo]",
"has tags [bar]"
],
"counters": {}
},
{
"snapshot": {
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
"matches": [
"has tags [foo]",
"has tags [bar]"
],
"counters": {}
},
{
"snapshot": {
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
"matches": [
"has tags [foo]",
"has tags [bar]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-11-15T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo",
"bar"
]
},
"matches": [
"has tags [foo]",
"has tags [bar]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-11-13T10:20:30.1Z",
"tree": null,
"paths": null,
"tags": [
"bar"
]
},
"matches": [
"has tags [bar]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-11-13T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-11-12T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-11-10T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-11-08T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-22T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-20T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-11T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-10T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-09T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-08T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-06T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-05T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-02T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
},
{
"snapshot": {
"time": "2014-10-01T10:20:30Z",
"tree": null,
"paths": null,
"tags": [
"foo"
]
},
"matches": [
"has tags [foo]"
],
"counters": {}
}
]
}
+22 -7
View File
@@ -1,7 +1,22 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1d"
],
"counters": {}
}
]
}
+22 -7
View File
@@ -1,7 +1,22 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 2d"
],
"counters": {}
}
]
}
+54 -17
View File
@@ -1,17 +1,54 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 7d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 7d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 7d"
],
"counters": {}
}
]
}
+310 -97
View File
@@ -1,97 +1,310 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:28:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:24:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T11:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T10:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T01:03:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T01:02:03Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:28:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:24:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T11:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T10:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T01:03:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T01:02:03Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-04T12:28:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-04T12:24:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-04T12:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-04T11:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-04T10:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-01T01:03:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-01T01:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m"
],
"counters": {}
}
]
}
+310 -97
View File
@@ -1,97 +1,310 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:28:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:24:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T11:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T10:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T01:03:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T01:02:03Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:28:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:24:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T11:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T10:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T01:03:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T01:02:03Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-04T12:28:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-04T12:24:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-04T12:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-04T11:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-04T10:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-01T01:03:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
},
{
"snapshot": {
"time": "2016-01-01T01:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"within 1m14d"
],
"counters": {}
}
]
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+364 -102
View File
@@ -1,102 +1,364 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T11:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T10:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T01:03:03Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-21T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-20T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-18T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-15T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-13T10:20:30.1Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T11:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T10:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T01:03:03Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-21T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-20T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-18T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-15T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-13T10:20:30.1Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 19
}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 18
}
},
{
"snapshot": {
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 17
}
},
{
"snapshot": {
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 16
}
},
{
"snapshot": {
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 15
}
},
{
"snapshot": {
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 14
}
},
{
"snapshot": {
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 13
}
},
{
"snapshot": {
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 12
}
},
{
"snapshot": {
"time": "2016-01-04T12:30:03Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 11
}
},
{
"snapshot": {
"time": "2016-01-04T11:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 10
}
},
{
"snapshot": {
"time": "2016-01-04T10:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 9
}
},
{
"snapshot": {
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 8
}
},
{
"snapshot": {
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 7
}
},
{
"snapshot": {
"time": "2016-01-01T01:03:03Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 6
}
},
{
"snapshot": {
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 5
}
},
{
"snapshot": {
"time": "2015-11-21T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 4
}
},
{
"snapshot": {
"time": "2015-11-20T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 3
}
},
{
"snapshot": {
"time": "2015-11-18T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 2
}
},
{
"snapshot": {
"time": "2015-11-15T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {
"hourly": 1
}
},
{
"snapshot": {
"time": "2015-11-13T10:20:30.1Z",
"tree": null,
"paths": null
},
"matches": [
"hourly snapshot"
],
"counters": {}
}
]
}
+58 -17
View File
@@ -1,17 +1,58 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 2
}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 1
}
},
{
"snapshot": {
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {}
}
]
}
+184 -52
View File
@@ -1,52 +1,184 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 9
}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 8
}
},
{
"snapshot": {
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 7
}
},
{
"snapshot": {
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 6
}
},
{
"snapshot": {
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 5
}
},
{
"snapshot": {
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 4
}
},
{
"snapshot": {
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 3
}
},
{
"snapshot": {
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 2
}
},
{
"snapshot": {
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 1
}
},
{
"snapshot": {
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {}
}
]
}
+544 -152
View File
@@ -1,152 +1,544 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-21T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-20T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-18T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-15T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-13T10:20:30.1Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-12T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-10T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-08T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-20T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-11T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-10T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-09T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-08T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-06T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-05T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-02T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-01T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-09-22T10:20:30Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-21T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-20T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-18T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-15T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-13T10:20:30.1Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-12T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-10T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-11-08T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-20T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-11T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-10T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-09T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-08T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-06T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-05T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-02T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-10-01T10:20:30Z",
"tree": null,
"paths": null
},
{
"time": "2015-09-22T10:20:30Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 29
}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 28
}
},
{
"snapshot": {
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 27
}
},
{
"snapshot": {
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 26
}
},
{
"snapshot": {
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 25
}
},
{
"snapshot": {
"time": "2016-01-06T08:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 24
}
},
{
"snapshot": {
"time": "2016-01-05T09:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 23
}
},
{
"snapshot": {
"time": "2016-01-04T16:23:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 22
}
},
{
"snapshot": {
"time": "2016-01-03T07:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 21
}
},
{
"snapshot": {
"time": "2016-01-01T07:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 20
}
},
{
"snapshot": {
"time": "2015-11-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 19
}
},
{
"snapshot": {
"time": "2015-11-21T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 18
}
},
{
"snapshot": {
"time": "2015-11-20T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 17
}
},
{
"snapshot": {
"time": "2015-11-18T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 16
}
},
{
"snapshot": {
"time": "2015-11-15T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 15
}
},
{
"snapshot": {
"time": "2015-11-13T10:20:30.1Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 14
}
},
{
"snapshot": {
"time": "2015-11-12T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 13
}
},
{
"snapshot": {
"time": "2015-11-10T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 12
}
},
{
"snapshot": {
"time": "2015-11-08T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 11
}
},
{
"snapshot": {
"time": "2015-10-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 10
}
},
{
"snapshot": {
"time": "2015-10-20T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 9
}
},
{
"snapshot": {
"time": "2015-10-11T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 8
}
},
{
"snapshot": {
"time": "2015-10-10T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 7
}
},
{
"snapshot": {
"time": "2015-10-09T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 6
}
},
{
"snapshot": {
"time": "2015-10-08T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 5
}
},
{
"snapshot": {
"time": "2015-10-06T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 4
}
},
{
"snapshot": {
"time": "2015-10-05T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 3
}
},
{
"snapshot": {
"time": "2015-10-02T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 2
}
},
{
"snapshot": {
"time": "2015-10-01T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {
"daily": 1
}
},
{
"snapshot": {
"time": "2015-09-22T10:20:30Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {}
}
]
}
+120 -32
View File
@@ -1,32 +1,120 @@
[
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
}
]
{
"keep": [
{
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
{
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
}
],
"reasons": [
{
"snapshot": {
"time": "2016-01-18T12:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot",
"daily snapshot"
],
"counters": {
"last": 4,
"daily": 4
}
},
{
"snapshot": {
"time": "2016-01-12T21:08:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot",
"daily snapshot"
],
"counters": {
"last": 3,
"daily": 3
}
},
{
"snapshot": {
"time": "2016-01-12T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot"
],
"counters": {
"last": 2,
"daily": 3
}
},
{
"snapshot": {
"time": "2016-01-09T21:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot",
"daily snapshot"
],
"counters": {
"last": 1,
"daily": 2
}
},
{
"snapshot": {
"time": "2016-01-08T20:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"last snapshot",
"daily snapshot"
],
"counters": {
"daily": 1
}
},
{
"snapshot": {
"time": "2016-01-07T10:02:03Z",
"tree": null,
"paths": null
},
"matches": [
"daily snapshot"
],
"counters": {}
}
]
}
+206
View File
@@ -0,0 +1,206 @@
package table
import (
"bytes"
"io"
"strings"
"text/template"
)
// Table contains data for a table to be printed.
type Table struct {
columns []string
templates []*template.Template
data []interface{}
footer []string
CellSeparator string
PrintHeader func(io.Writer, string) error
PrintSeparator func(io.Writer, string) error
PrintData func(io.Writer, int, string) error
PrintFooter func(io.Writer, string) error
}
var funcmap = template.FuncMap{
"join": strings.Join,
}
// New initializes a new Table
func New() *Table {
p := func(w io.Writer, s string) error {
_, err := w.Write(append([]byte(s), '\n'))
return err
}
return &Table{
CellSeparator: " ",
PrintHeader: p,
PrintSeparator: p,
PrintData: func(w io.Writer, _ int, s string) error {
return p(w, s)
},
PrintFooter: p,
}
}
// AddColumn adds a new header field with the header and format, which is
// expected to be template string compatible with text/template. When compiling
// the format fails, AddColumn panics.
func (t *Table) AddColumn(header, format string) {
t.columns = append(t.columns, header)
tmpl, err := template.New("template for " + header).Funcs(funcmap).Parse(format)
if err != nil {
panic(err)
}
t.templates = append(t.templates, tmpl)
}
// AddRow adds a new row to the table, which is filled with data.
func (t *Table) AddRow(data interface{}) {
t.data = append(t.data, data)
}
// AddFooter prints line after the table
func (t *Table) AddFooter(line string) {
t.footer = append(t.footer, line)
}
func printLine(w io.Writer, print func(io.Writer, string) error, sep string, data []string, widths []int) error {
var fields [][]string
maxLines := 1
for _, d := range data {
lines := strings.Split(d, "\n")
if len(lines) > maxLines {
maxLines = len(lines)
}
fields = append(fields, lines)
}
for i := 0; i < maxLines; i++ {
var s string
for fieldNum, lines := range fields {
var v string
if i < len(lines) {
v += lines[i]
}
// apply padding
pad := widths[fieldNum] - len(v)
if pad > 0 {
v += strings.Repeat(" ", pad)
}
if fieldNum > 0 {
v = sep + v
}
s += v
}
err := print(w, strings.TrimRight(s, " "))
if err != nil {
return err
}
}
return nil
}
// Write prints the table to w.
func (t *Table) Write(w io.Writer) error {
columns := len(t.templates)
if columns == 0 {
return nil
}
// collect all data fields from all columns
lines := make([][]string, 0, len(t.data))
buf := bytes.NewBuffer(nil)
for _, data := range t.data {
row := make([]string, 0, len(t.templates))
for _, tmpl := range t.templates {
err := tmpl.Execute(buf, data)
if err != nil {
return err
}
row = append(row, string(buf.Bytes()))
buf.Reset()
}
lines = append(lines, row)
}
// find max width for each cell
columnWidths := make([]int, columns)
for i, desc := range t.columns {
for _, line := range strings.Split(desc, "\n") {
if columnWidths[i] < len(line) {
columnWidths[i] = len(desc)
}
}
}
for _, line := range lines {
for i, content := range line {
for _, l := range strings.Split(content, "\n") {
if columnWidths[i] < len(l) {
columnWidths[i] = len(l)
}
}
}
}
// calculate the total width of the table
totalWidth := 0
for _, width := range columnWidths {
totalWidth += width
}
totalWidth += (columns - 1) * len(t.CellSeparator)
// write header
if len(t.columns) > 0 {
err := printLine(w, t.PrintHeader, t.CellSeparator, t.columns, columnWidths)
if err != nil {
return err
}
// draw separation line
err = t.PrintSeparator(w, strings.Repeat("-", totalWidth))
if err != nil {
return err
}
}
// write all the lines
for i, line := range lines {
print := func(w io.Writer, s string) error {
return t.PrintData(w, i, s)
}
err := printLine(w, print, t.CellSeparator, line, columnWidths)
if err != nil {
return err
}
}
// draw separation line
err := t.PrintSeparator(w, strings.Repeat("-", totalWidth))
if err != nil {
return err
}
if len(t.footer) > 0 {
// write the footer
for _, line := range t.footer {
err := t.PrintFooter(w, line)
if err != nil {
return err
}
}
}
return nil
}
+162
View File
@@ -0,0 +1,162 @@
package table
import (
"bytes"
"strings"
"testing"
)
func TestTable(t *testing.T) {
var tests = []struct {
create func(t testing.TB) *Table
output string
}{
{
func(t testing.TB) *Table {
return New()
},
"",
},
{
func(t testing.TB) *Table {
table := New()
table.AddColumn("first column", "data: {{.First}}")
table.AddRow(struct{ First string }{"first data field"})
return table
},
`
first column
----------------------
data: first data field
----------------------
`,
},
{
func(t testing.TB) *Table {
table := New()
table.AddColumn(" first column ", "data: {{.First}}")
table.AddRow(struct{ First string }{"d"})
return table
},
`
first column
----------------
data: d
----------------
`,
},
{
func(t testing.TB) *Table {
table := New()
table.AddColumn("first column", "data: {{.First}}")
table.AddRow(struct{ First string }{"first data field"})
table.AddRow(struct{ First string }{"second data field"})
table.AddFooter("footer1")
table.AddFooter("footer2")
return table
},
`
first column
-----------------------
data: first data field
data: second data field
-----------------------
footer1
footer2
`,
},
{
func(t testing.TB) *Table {
table := New()
table.AddColumn(" first name", `{{printf "%12s" .FirstName}}`)
table.AddColumn("last name", "{{.LastName}}")
table.AddRow(struct{ FirstName, LastName string }{"firstname", "lastname"})
table.AddRow(struct{ FirstName, LastName string }{"John", "Doe"})
table.AddRow(struct{ FirstName, LastName string }{"Johann", "van den Berjen"})
return table
},
`
first name last name
----------------------------
firstname lastname
John Doe
Johann van den Berjen
----------------------------
`,
},
{
func(t testing.TB) *Table {
table := New()
table.AddColumn("host name", `{{.Host}}`)
table.AddColumn("time", `{{.Time}}`)
table.AddColumn("zz", "xxx")
table.AddColumn("tags", `{{join .Tags ","}}`)
table.AddColumn("dirs", `{{join .Dirs ","}}`)
type data struct {
Host string
Time string
Tags, Dirs []string
}
table.AddRow(data{"foo", "2018-08-19 22:22:22", []string{"work"}, []string{"/home/user/work"}})
table.AddRow(data{"foo", "2018-08-19 22:22:22", []string{"other"}, []string{"/home/user/other"}})
table.AddRow(data{"foo", "2018-08-19 22:22:22", []string{"other"}, []string{"/home/user/other"}})
return table
},
`
host name time zz tags dirs
------------------------------------------------------------
foo 2018-08-19 22:22:22 xxx work /home/user/work
foo 2018-08-19 22:22:22 xxx other /home/user/other
foo 2018-08-19 22:22:22 xxx other /home/user/other
------------------------------------------------------------
`,
},
{
func(t testing.TB) *Table {
table := New()
table.AddColumn("host name", `{{.Host}}`)
table.AddColumn("time", `{{.Time}}`)
table.AddColumn("zz", "xxx")
table.AddColumn("tags", `{{join .Tags "\n"}}`)
table.AddColumn("dirs", `{{join .Dirs "\n"}}`)
type data struct {
Host string
Time string
Tags, Dirs []string
}
table.AddRow(data{"foo", "2018-08-19 22:22:22", []string{"work", "go"}, []string{"/home/user/work", "/home/user/go"}})
table.AddRow(data{"foo", "2018-08-19 22:22:22", []string{"other"}, []string{"/home/user/other"}})
table.AddRow(data{"foo", "2018-08-19 22:22:22", []string{"other", "bar"}, []string{"/home/user/other"}})
return table
},
`
host name time zz tags dirs
------------------------------------------------------------
foo 2018-08-19 22:22:22 xxx work /home/user/work
go /home/user/go
foo 2018-08-19 22:22:22 xxx other /home/user/other
foo 2018-08-19 22:22:22 xxx other /home/user/other
bar
------------------------------------------------------------
`,
},
}
for _, test := range tests {
t.Run("", func(t *testing.T) {
table := test.create(t)
buf := bytes.NewBuffer(nil)
err := table.Write(buf)
if err != nil {
t.Fatal(err)
}
want := strings.TrimLeft(test.output, "\n")
if string(buf.Bytes()) != want {
t.Errorf("wrong output\n---- want ---\n%s\n---- got ---\n%s\n-------\n", want, buf.Bytes())
}
})
}
}