Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages persistent state with atomic saves.
func NewManager ¶
NewManager creates a new state manager for the given workspace.
func (*Manager) GetLastChannel ¶
GetLastChannel returns the last channel from the state.
func (*Manager) GetLastChatID ¶
GetLastChatID returns the last chat ID from the state.
func (*Manager) GetTimestamp ¶
GetTimestamp returns the timestamp of the last state update.
func (*Manager) SetLastChannel ¶
SetLastChannel atomically updates the last channel and saves the state. This method uses a temp file + rename pattern for atomic writes, ensuring that the state file is never corrupted even if the process crashes.
func (*Manager) SetLastChatID ¶
SetLastChatID atomically updates the last chat ID and saves the state.
type State ¶
type State struct {
// LastChannel is the last channel used for communication
LastChannel string `json:"last_channel,omitempty"`
// LastChatID is the last chat ID used for communication
LastChatID string `json:"last_chat_id,omitempty"`
// Timestamp is the last time this state was updated
Timestamp time.Time `json:"timestamp"`
}
State represents the persistent state for a workspace. It includes information about the last active channel/chat.