Documentation
¶
Index ¶
- Variables
- func AreABRootTransactionsLocked() bool
- func CheckConnection() bool
- func ConfirmWindow(title string, body string) bool
- func CreateVsoTable(writer io.Writer) *tablewriter.Table
- func DeleteTaskByUnitName(name string) error
- func GetBatteryStats() (bool, bool, bool)
- func GetCPUTemp() int
- func GetPico() (*core.SubSystem, error)
- func HasUpdates() (bool, error)
- func IsCPUUnderHighUsage() (bool, int)
- func IsInternetUnderHighUsage() (bool, int)
- func IsLaptop() bool
- func IsMemoryUnderHighUsage() (bool, int)
- func IsMeteredConnection() bool
- func IsNetworkUp() bool
- func ItsBeen(last time.Time, duration string) bool
- func ItsTime(targetTime string) bool
- func ListTasksJson() (string, error)
- func ListUnitTasks() ([]string, error)
- func NeedUpdate() bool
- func PicoDelete() error
- func PicoExists() bool
- func PicoExport(app string, binary string) error
- func PicoInit() error
- func PicoUnexport(app string, binary string) error
- func PicoUpgrade() error
- func RootCheck(display bool) bool
- func RotateTasks(event string, silent bool) error
- func RunTaskByUnitName(name string) error
- func RunUpgradeCheck() error
- func RunUpgradeCheckJSON() (bool, error)
- func SendNotification(title, body string) error
- func SmartUpdate() bool
- func TaskHasRun(name string) bool
- func TaskHasRunFail(name string) bool
- func TaskHasRunSuccess(name string) bool
- func TasksInit() error
- func TryUpdate(force bool) error
- type CommonChecks
- type Task
- func (t *Task) Delete() error
- func (t *Task) Dependencies() []Task
- func (t *Task) IsRunning() bool
- func (t *Task) Relations() []Task
- func (t *Task) RemoveLastFailure() error
- func (t *Task) RemoveLastSuccess() error
- func (t *Task) RemoveRunning() error
- func (t *Task) Run() error
- func (t *Task) Save() error
- func (t *Task) SaveLastFailure() error
- func (t *Task) SaveLastSuccess() error
- func (t *Task) SaveRunning() error
- func (t *Task) ShouldRun(cChecks *CommonChecks, event string) bool
- func (t *Task) Target() string
- func (t *Task) Unit() string
- func (t *Task) WasFailure() bool
- func (t *Task) WasSuccessful() bool
- type TaskJson
Constants ¶
This section is empty.
Variables ¶
var ( TasksLocation = "/.config/vso/tasks" CurrentQueue = []Task{} )
var ProcessPath string
Functions ¶
func AreABRootTransactionsLocked ¶
func AreABRootTransactionsLocked() bool
AreABRootTransactionsLocked checks if there are any abroot transactions currently running
func CheckConnection ¶
func CheckConnection() bool
func ConfirmWindow ¶
func CreateVsoTable ¶
func CreateVsoTable(writer io.Writer) *tablewriter.Table
func DeleteTaskByUnitName ¶
DeleteTaskByUnitName deletes a task
func GetBatteryStats ¶
GetBatteryStats gets the battery stats
func HasUpdates ¶
HasUpdates checks if the system has updates available
func IsCPUUnderHighUsage ¶
IsCPUUnderHighUsage checks if the CPU is being used (false if exceeds 50%)
func IsInternetUnderHighUsage ¶
IsInternetUnderHighUsage checks if the internet is being used (false if exceeds 500kb/s)
func IsLaptop ¶
func IsLaptop() bool
IsLaptop checks if the system is a laptop by looking for the chassis type
func IsMemoryUnderHighUsage ¶
IsMemoryUnderHighUsage checks if the memory is being used (false if exceeds 50%)
func IsMeteredConnection ¶
func IsMeteredConnection() bool
IsMeteredConnection checks if the connection is metered
func ListTasksJson ¶
ListTasksJson lists all tasks with detailed information in JSON format
func NeedUpdate ¶
func NeedUpdate() bool
NeedUpdate checks if the system needs to be updated according to the latest update log compared to the VSO configuation
func PicoDelete ¶
func PicoDelete() error
func PicoExists ¶
func PicoExists() bool
func PicoExport ¶
func PicoUnexport ¶
func PicoUpgrade ¶
func PicoUpgrade() error
func RotateTasks ¶
RotateTasks checks if no other rotators are running, then performs initial checks and starts rotating every 5 seconds
func RunUpgradeCheck ¶
func RunUpgradeCheck() error
RunUpgradeCheck asks ABRoot to check for updates and passes its output to stdout
func RunUpgradeCheckJSON ¶
RunUpgradeCheckJSON asks ABRoot to check for updates and return a JSON-formatted result
func SendNotification ¶
func SmartUpdate ¶
func SmartUpdate() bool
SmartUpdate checks if the device is currently being used, then returns true if the device is not being used
func TaskHasRun ¶
TaskHasRun checks if a task has run in the current queue
func TaskHasRunFail ¶
TaskHasRunFail checks if a task has run unsuccessfully in the current queue
func TaskHasRunSuccess ¶
TaskHasRunSuccess checks if a task has run successfully in the current queue
Types ¶
type CommonChecks ¶
type CommonChecks struct {
Network bool
Battery bool
LowBattery bool
FullBattery bool
IsLaptop bool
HighInternetUsage bool
InternetUsage int
MeteredConnection bool
HighMemoryUsage bool
MemoryUsage int
HighCPUUsage bool
CPUUsage int
CPUTemp int
}
func GetCommonChecks ¶
func GetCommonChecks() *CommonChecks
GetCommonChecks checks network and battery
type Task ¶
type Task struct {
Name string
Slug string
Description string
NeedConfirm bool
Command string
AfterTask string
AfterTaskSuccess string
AfterTaskFailure string
Every string
At string
//OnBoot bool
OnNetwork bool
OnDisconnect bool
OnBattery bool
OnLowBattery bool
OnCharge bool
OnFullBattery bool
OnConditionCommand string
OnProcess string
OnInternetUsage int
OnHighInternetUsage bool
OnMemoryUsage int
OnHighMemoryUsage bool
OnCPUUsage int
OnHighCPUUsage bool
OnCPUTemp int
OnDeviceConnected string
OnDeviceDisconnected string
LastExecution time.Time
LastExecutionOutput string
}
func ListTasksDetailed ¶
ListTasksDetailed lists all tasks with detailed information
func LoadTaskByUnitName ¶
LoadTaskByUnitName loads a task
func (*Task) Dependencies ¶
Dependencies returns a list of Task which the current one depends on
func (*Task) RemoveLastFailure ¶
RemoveLastFailure removes the last failure of a task in /tmp
func (*Task) RemoveLastSuccess ¶
RemoveLastSuccess removes the last success of a task in /tmp
func (*Task) RemoveRunning ¶
RemoveRunning removes the running state of a task in /tmp
func (*Task) SaveLastFailure ¶
SaveLastFailure saves the last failure of a task in /tmp
func (*Task) SaveLastSuccess ¶
SaveLastSuccess saves the last success of a task in /tmp
func (*Task) SaveRunning ¶
SaveRunning saves the running state of a task in /tmp
func (*Task) ShouldRun ¶
func (t *Task) ShouldRun(cChecks *CommonChecks, event string) bool
ShouldRun checks if a task respect the assigned event/condition
func (*Task) WasFailure ¶
WasFailure checks if a task was a failure
func (*Task) WasSuccessful ¶
WasSuccessful checks if a task was successful