Documentation ¶
Overview ¶
Package state implements state for debugging.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultState is the default state. DefaultState = State{ Channels: make(map[string]*ChannelState), } )
Functions ¶
This section is empty.
Types ¶
type ChannelState ¶
type ChannelState struct { DownloadState DownloadState `json:"state"` Extra map[string]interface{} `json:"extra,omitempty"` Errors []DownloadError `json:"errors_log"` }
ChannelState represents the state of a channel.
type DownloadError ¶ added in v0.5.1
DownloadError represents an error during a download.
type DownloadState ¶
type DownloadState int
DownloadState represents the state of a download.
const ( // DownloadStateUnspecified is used when the download state is unspecified. DownloadStateUnspecified DownloadState = iota // DownloadStateIdle is used when the download is idle. DownloadStateIdle // DownloadStatePreparingFiles is used when the download is preparing files. DownloadStatePreparingFiles // DownloadStateDownloading is used when the download is downloading. DownloadStateDownloading // DownloadStatePostProcessing is used when the download is post processing. DownloadStatePostProcessing // DownloadStateFinished is used when the download is finished. DownloadStateFinished // DownloadStateCanceled is used when the download is canceled. DownloadStateCanceled )
func DownloadStateFromString ¶
func DownloadStateFromString(s string) DownloadState
DownloadStateFromString returns a DownloadState from a string.
func (DownloadState) MarshalJSON ¶
func (d DownloadState) MarshalJSON() ([]byte, error)
MarshalJSON marshals a DownloadState into a string.
func (DownloadState) String ¶
func (d DownloadState) String() string
String returns a string representation of a DownloadState.
func (*DownloadState) UnmarshalJSON ¶
func (d *DownloadState) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals a string into a DownloadState.
type State ¶
type State struct { Channels map[string]*ChannelState `json:"channels"` // contains filtered or unexported fields }
State represents the state of the program.
func (*State) GetChannelState ¶ added in v1.2.0
func (s *State) GetChannelState(name string) DownloadState
GetChannelState returns the state for a channel.
func (*State) SetChannelError ¶ added in v1.2.0
SetChannelError sets an error for a channel.
func (*State) SetChannelState ¶ added in v1.2.0
func (s *State) SetChannelState(name string, state DownloadState, extra map[string]interface{})
SetChannelState sets the state for a channel.
Click to show internal directories.
Click to hide internal directories.