Documentation
¶
Index ¶
- func CalculateNextInterval(rate int, period string) (time.Duration, error)
- func CalculateNextTrigger(rate int, period string) (time.Time, error)
- func IsRunning() (bool, int, error)
- func PIDPath() (string, error)
- func PeriodToDuration(period string) (time.Duration, error)
- func ReadPID() (int, error)
- func RemovePID() error
- func RemoveState() error
- func SaveState(state *State) error
- func StatePath() (string, error)
- func StopRunning() error
- func WritePID() error
- type Daemon
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateNextInterval ¶
CalculateNextInterval returns a random duration for the next trigger Based on rolling randomness: random value between 0.5x and 1.5x the average interval
func CalculateNextTrigger ¶
CalculateNextTrigger returns the time for the next entry trigger
func PeriodToDuration ¶
PeriodToDuration converts a rate period string to a time.Duration
Types ¶
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon manages autonomous journal entry generation
type State ¶
type State struct {
PID int `json:"pid"`
StartedAt time.Time `json:"started_at"`
NextTrigger time.Time `json:"next_trigger"`
EntriesGenerated int `json:"entries_generated"`
LastEntryAt time.Time `json:"last_entry_at,omitempty"`
LastPersona string `json:"last_persona,omitempty"`
}
State holds the daemon's runtime state
Click to show internal directories.
Click to hide internal directories.