MCPcopy Index your code
hub / github.com/kopia/kopia / getUpdateState

Method getUpdateState

cli/update_check.go:71–84  ·  view source on GitHub ↗

getUpdateState reads the update state file if available.

()

Source from the content-addressed store, hash-verified

69
70// getUpdateState reads the update state file if available.
71func (c *App) getUpdateState() (*updateState, error) {
72 f, err := os.Open(c.updateStateFilename())
73 if err != nil {
74 return nil, errors.Wrap(err, "unable to open update state file")
75 }
76 defer f.Close() //nolint:errcheck
77
78 us := &updateState{}
79 if err := json.NewDecoder(f).Decode(us); err != nil {
80 return nil, errors.Wrap(err, "unable to parse update state")
81 }
82
83 return us, nil
84}
85
86// maybeInitializeUpdateCheck optionally writes update state file with initial update
87// set 24 hours from now.

Callers 1

maybeCheckForUpdatesMethod · 0.95

Calls 3

updateStateFilenameMethod · 0.95
OpenMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected