Skip to content

Commit 74ddb08

Browse files
authored
Merge pull request #93 from snprajwal/stats-const
fix(crit/stats): add const for dump and restore
2 parents c54aaf7 + be1c695 commit 74ddb08

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

crit/stats.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import (
77
"github.com/checkpoint-restore/go-criu/v6/crit/images"
88
)
99

10+
const (
11+
StatsDump = "stats-dump"
12+
StatsRestore = "stats-restore"
13+
)
14+
1015
// Helper function to load stats file into Go struct
1116
func getStats(path string) (*images.StatsEntry, error) {
1217
c := New(path, "", "", false, false)
@@ -26,7 +31,7 @@ func getStats(path string) (*images.StatsEntry, error) {
2631
// GetDumpStats returns the dump statistics of a checkpoint.
2732
// dir is the path to the directory with the checkpoint images.
2833
func GetDumpStats(dir string) (*images.DumpStatsEntry, error) {
29-
stats, err := getStats(filepath.Join(dir, "stats-dump"))
34+
stats, err := getStats(filepath.Join(dir, StatsDump))
3035
if err != nil {
3136
return nil, err
3237
}
@@ -37,7 +42,7 @@ func GetDumpStats(dir string) (*images.DumpStatsEntry, error) {
3742
// GetRestoreStats returns the restore statistics of a checkpoint.
3843
// dir is the path to the directory with the checkpoint images.
3944
func GetRestoreStats(dir string) (*images.RestoreStatsEntry, error) {
40-
stats, err := getStats(filepath.Join(dir, "stats-restore"))
45+
stats, err := getStats(filepath.Join(dir, StatsRestore))
4146
if err != nil {
4247
return nil, err
4348
}

0 commit comments

Comments
 (0)