Skip to content

Commit

Permalink
Add godoc
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator committed Nov 1, 2023
1 parent 02625e8 commit 5b1db16
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions internal/pkg/agent/application/upgrade/details/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ type Details struct {

// Metadata consists of metadata relating to a specific upgrade state
type Metadata struct {
ScheduledAt time.Time `json:"scheduled_at,omitempty" yaml:"scheduled_at,omitempty"`
DownloadPercent float64 `json:"download_percent,omitempty" yaml:"download_percent,omitempty"`
DownloadRate downloadRate `json:"download_rate,omitempty" yaml:"download_rate,omitempty"`
ScheduledAt time.Time `json:"scheduled_at,omitempty" yaml:"scheduled_at,omitempty"`

// DownloadPercent is the percentage of the artifact that has been
// downloaded. Minimum value is 0 and maximum value is 1.
DownloadPercent float64 `json:"download_percent,omitempty" yaml:"download_percent,omitempty"`

// DownloadRate is the rate, in bytes per second, at which the download
// is progressing.
DownloadRate downloadRate `json:"download_rate,omitempty" yaml:"download_rate,omitempty"`

// FailedState is the state an upgrade was in if/when it failed. Use the
// Fail() method of UpgradeDetails to correctly record details when
Expand Down Expand Up @@ -71,7 +77,7 @@ func (d *Details) SetState(s State) {
}

// SetDownloadProgress is a convenience method to set the download percent
// when the upgrade is in UPG_DOWNLOADING state.
// and download rate when the upgrade is in UPG_DOWNLOADING state.
func (d *Details) SetDownloadProgress(percent, rateBytesPerSecond float64) {
d.mu.Lock()
defer d.mu.Unlock()
Expand Down

0 comments on commit 5b1db16

Please sign in to comment.