Documentation ¶
Index ¶
- Variables
- func GetWorkingDirectory() string
- type Application
- func (a *Application) GuideViewerCallback(path string)
- func (a *Application) InitiateProtocol()
- func (a *Application) Log(s string)
- func (a *Application) OrderToInitiateProtocol()
- func (a *Application) PauseProtocol()
- func (a *Application) ResumeProtocol()
- func (a *Application) StartPeriodicTicks(deltaTime int)
- type DownloadControl
- type DownloadStatus
- type LoggedMsg
- type Logs
- type Resource
- type ResourceInformation
- type ResourceList
- type TickMsg
- type UrlGetter
Constants ¶
This section is empty.
Variables ¶
View Source
var FillerResource = Resource{ Name: "tableFiller", Description: "tableFiller", Tier: 1, UrlGetter: &UrlGetter{}, FileName: "example.txt", InitiateDownload: func(path string, logFunction func(string), downloadStruct *Resource) error { return nil }, Info: ResourceInformation{}, Status: StatusQueued, Error: nil, }
Functions ¶
func GetWorkingDirectory ¶
func GetWorkingDirectory() string
Types ¶
type Application ¶
type Application struct { TeaProgram *tea.Program GuidesFolderPath string ProtocolInitiated bool ProtocolPaused bool ResourceList ResourceList LogFunction func(string) LogsContent Logs }
Everything that the entire application should keep track of
var CurrentApplicationInstance *Application
func (*Application) GuideViewerCallback ¶
func (a *Application) GuideViewerCallback(path string)
func (*Application) InitiateProtocol ¶
func (a *Application) InitiateProtocol()
Initiate every resource download TODO: Limit to N at a time and queue the rest
func (*Application) OrderToInitiateProtocol ¶
func (a *Application) OrderToInitiateProtocol()
func (*Application) PauseProtocol ¶
func (a *Application) PauseProtocol()
func (*Application) ResumeProtocol ¶
func (a *Application) ResumeProtocol()
func (*Application) StartPeriodicTicks ¶
func (a *Application) StartPeriodicTicks(deltaTime int)
type DownloadControl ¶
type DownloadControl int
const ( Start DownloadControl = iota // Synonymous with Continue Pause Cancel )
type DownloadStatus ¶
type DownloadStatus string
const ( StatusQueued DownloadStatus = "Queued" StatusDownloading DownloadStatus = "Downloading" StatusPaused DownloadStatus = "Paused" StatusCompleted DownloadStatus = "Completed" StatusFailed DownloadStatus = "Failed" StatusIdle DownloadStatus = "Idle" )
type Resource ¶
type Resource struct { Name string Description string Tier int AssociatedGuidePath guides.Guide // Relative path to the guides directory from the 'packaged' directory UrlGetter *UrlGetter FileName string Location string InitiateDownload func(path string, logFunction func(string), downloadStruct *Resource) error Info ResourceInformation Status DownloadStatus Error error ControlChannel chan DownloadControl // Channel for controlling the download CustomResource bool }
N number of Downloads downloading at a time Rest are queued Appears on the Downloads list
func (*Resource) EnterPressed ¶
func (r *Resource) EnterPressed()
func (*Resource) PauseResource ¶
func (r *Resource) PauseResource()
func (*Resource) ResumeResource ¶
func (r *Resource) ResumeResource()
func (*Resource) SpacePressed ¶
func (r *Resource) SpacePressed()
type ResourceInformation ¶
type ResourceInformation struct { Done float64 // Bytes downloaded so far Size float64 // Total size of the download in bytes Bandwidth float64 // Current download speed in bytes per second ETA uint64 // Estimated time remaining (formatted as a string, e.g., "10.5 seconds") StartTime time.Time // Time when the download started EndTime time.Time // Time when the download completed }
Download info to construct the UI
func (ResourceInformation) ProgressPercent ¶
func (d ResourceInformation) ProgressPercent() float64
type ResourceList ¶
func (*ResourceList) GetCoreProgress ¶
func (r *ResourceList) GetCoreProgress() float64
func (*ResourceList) GetOverallProgress ¶
func (r *ResourceList) GetOverallProgress() float64
func (*ResourceList) PauseAllResources ¶
func (r *ResourceList) PauseAllResources()
func (*ResourceList) ResumeAllResources ¶
func (r *ResourceList) ResumeAllResources()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.