Documentation
¶
Index ¶
- type AppliedConfig
- type AppliedReminderConfig
- type AppliedRetryConfig
- type AppliedTaskConfig
- type ReminderState
- type ReminderStatus
- type State
- func (s *State) DeleteReminderState(name string)
- func (s *State) DeleteTaskState(name string)
- func (s *State) GetAppliedConfig() *AppliedConfig
- func (s *State) GetAppliedReminder(name string) (AppliedReminderConfig, bool)
- func (s *State) GetAppliedTask(name string) (AppliedTaskConfig, bool)
- func (s *State) GetEmbedVersion() int
- func (s *State) GetReminderState(name string) ReminderState
- func (s *State) GetTaskState(name string) TaskState
- func (s *State) Pending() int
- func (s *State) Save() error
- func (s *State) SetAppliedConfig(ac *AppliedConfig)
- func (s *State) SetEmbedVersion(v int)
- func (s *State) SetReminderState(name string, rs ReminderState)
- func (s *State) SetTaskState(name string, ts TaskState)
- type TaskState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppliedConfig ¶
type AppliedConfig struct {
Tasks map[string]AppliedTaskConfig `json:"tasks"`
Reminders map[string]AppliedReminderConfig `json:"reminders"`
}
AppliedConfig stores the config as it was when `orbit apply` was last run. This is the source of truth for _run, _notify, and all non-apply commands.
type AppliedReminderConfig ¶
type AppliedReminderConfig struct {
Command string `json:"command,omitempty"`
Schedule string `json:"schedule"`
Message string `json:"message"`
Snooze string `json:"snooze,omitempty"`
Check string `json:"check,omitempty"`
}
AppliedReminderConfig is the applied (saved) version of a reminder's configuration.
type AppliedRetryConfig ¶
AppliedRetryConfig is the applied version of retry settings.
func (AppliedRetryConfig) ToRetryConfig ¶
func (r AppliedRetryConfig) ToRetryConfig() config.RetryConfig
ToRetryConfig converts an applied retry config back to a config.RetryConfig.
type AppliedTaskConfig ¶
type AppliedTaskConfig struct {
Command string `json:"command"`
Schedule string `json:"schedule"`
OnMissed config.OnMissedPolicy `json:"on_missed"`
Retry AppliedRetryConfig `json:"retry"`
}
AppliedTaskConfig is the applied (saved) version of a task's configuration.
type ReminderState ¶
type ReminderState struct {
State ReminderStatus `json:"state"`
FiredAt time.Time `json:"fired_at"`
SnoozedUntil *time.Time `json:"snoozed_until,omitempty"`
OverdueCount int `json:"overdue_count"`
LastCheckExitCode *int `json:"last_check_exit_code,omitempty"`
LastCheckAt time.Time `json:"last_check_at"`
Disabled bool `json:"disabled,omitempty"`
}
ReminderState tracks the state of a reminder.
type ReminderStatus ¶
type ReminderStatus string
ReminderStatus represents the current state of a reminder.
const ( StatePending ReminderStatus = "pending" StateAcknowledged ReminderStatus = "acknowledged" StateSnoozed ReminderStatus = "snoozed" )
Reminder state constants.
func (ReminderStatus) String ¶
func (rs ReminderStatus) String() string
type State ¶
type State struct {
// contains filtered or unexported fields
}
State represents the orbit state store.
func NewState ¶
NewState creates a new state instance, loading existing state from disk if available.
func (*State) DeleteReminderState ¶
DeleteReminderState removes a reminder's state entry.
func (*State) DeleteTaskState ¶
DeleteTaskState removes a task's state entry.
func (*State) GetAppliedConfig ¶
func (s *State) GetAppliedConfig() *AppliedConfig
GetAppliedConfig returns the applied configuration, or nil if none has been applied yet.
func (*State) GetAppliedReminder ¶
func (s *State) GetAppliedReminder(name string) (AppliedReminderConfig, bool)
GetAppliedReminder returns the applied config for a reminder, and whether it exists.
func (*State) GetAppliedTask ¶
func (s *State) GetAppliedTask(name string) (AppliedTaskConfig, bool)
GetAppliedTask returns the applied config for a task, and whether it exists.
func (*State) GetEmbedVersion ¶
GetEmbedVersion returns the stored embed version.
func (*State) GetReminderState ¶
func (s *State) GetReminderState(name string) ReminderState
GetReminderState returns the state for a reminder.
func (*State) GetTaskState ¶
GetTaskState returns the state for a task.
func (*State) Pending ¶
Pending returns the current count of pending reminders, computed from the map.
func (*State) Save ¶
Save writes the state to disk atomically and updates the sentinel file. It uses flock to prevent concurrent orbit processes from clobbering each other.
func (*State) SetAppliedConfig ¶
func (s *State) SetAppliedConfig(ac *AppliedConfig)
SetAppliedConfig stores the applied configuration. This is called by `orbit apply`.
func (*State) SetEmbedVersion ¶
SetEmbedVersion updates the stored embed version.
func (*State) SetReminderState ¶
func (s *State) SetReminderState(name string, rs ReminderState)
SetReminderState updates the state for a reminder.
func (*State) SetTaskState ¶
SetTaskState updates the state for a task.
type TaskState ¶
type TaskState struct {
LastRun time.Time `json:"last_run"`
LastExitCode int `json:"last_exit_code"`
LastDurationMs int64 `json:"last_duration_ms"`
ConsecutiveFailures int `json:"consecutive_failures"`
RetryAttempt int `json:"retry_attempt"`
Disabled bool `json:"disabled,omitempty"`
}
TaskState tracks the state of a task.