Skip to content

Commit

Permalink
simplify get all log filepaths and add cmt
Browse files Browse the repository at this point in the history
  • Loading branch information
tedim52 committed Oct 22, 2024
1 parent 8f83284 commit 85012df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,17 +264,18 @@ func (manager *LogFileManager) createSymlinkLogFile(targetLogFilePath, symlinkLo
return nil
}

// if [enclaveUuid] is empty, gets log file paths from all enclaves
func (manager *LogFileManager) getAllLogFilePaths(enclaveUuid string) ([]string, error) {
var paths []string
walkFunc := func(path string, info fs.FileInfo, err error) error {
if enclaveUuid != emptyEnclaveUuid {
if strings.Contains(path, enclaveUuid) && !info.IsDir() {
paths = append(paths, path)
}
} else {
if !info.IsDir() {
paths = append(paths, path)
}
if err != nil {
return err
}
if info.IsDir() {
return nil
}
if enclaveUuid == emptyEnclaveUuid || strings.Contains(path, enclaveUuid) {
paths = append(paths, path)
}
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ package persistent_volume_helpers

import "time"

const (
hoursInWeek = 7 * 24
)

func ConvertWeeksToDuration(weeks int) time.Duration {
hoursInWeek := 7 * 24
return time.Duration(weeks*hoursInWeek) * time.Hour
}

0 comments on commit 85012df

Please sign in to comment.