Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process Restic stats output #263

Merged
merged 7 commits into from
Sep 19, 2019
Merged

Process Restic stats output #263

merged 7 commits into from
Sep 19, 2019

Conversation

DeepikaDixit
Copy link
Contributor

@DeepikaDixit DeepikaDixit commented Sep 5, 2019

Change Overview

Process Restic stats output to get file count and size

Pull request type

Please check the type of change your PR introduces:

  • Work in Progress
  • Refactoring (no functional changes, no api changes)
  • Trival/Minor
  • Bugfix
  • Feature
  • Documentation

Issues

Test Plan

  • Manual
  • Unit test
restic stats 7e17e764
repository c6746ff5 opened successfully, password is correct
found 2 old cache directories in /Users/deepikadixit/Library/Caches/restic, pass --cleanup-cache to remove them
scanning...
Stats for 7e17e764 in restore-size mode:
  Total File Count:   9
        Total Size:   10.322 KiB
  • E2E

Copy link
Contributor

@pavannd1 pavannd1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to merge after minor update.

pkg/restic/restic.go Outdated Show resolved Hide resolved
Copy link
Contributor

@tdmanv tdmanv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please avoid recompiling the expressions in the while loops - it's a relatively expensive computation


// SnapshotStatsModeFromStatsLog gets the Stats mode from Stats Command log
func SnapshotStatsModeFromStatsLog(output string) string {
logs := regexp.MustCompile("[\n]").Split(output, -1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason you didn't use https://golang.org/pkg/strings/#Split ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was trying to be consistent with other funcs in same file.

pkg/restic/restic.go Show resolved Hide resolved
pkg/restic/restic.go Outdated Show resolved Hide resolved
@mergify mergify bot merged commit 527612e into master Sep 19, 2019
@DeepikaDixit DeepikaDixit deleted the restic-stats-regex branch September 19, 2019 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants