store

package
v0.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package store provides the in-memory state store for the grove daemon.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type State

type State struct {
	Workspaces map[string]*enrichment.EnrichedWorkspace `json:"workspaces"` // Keyed by path
	Sessions   map[string]*models.Session               `json:"sessions"`   // Keyed by ID
}

State represents the complete world view of the daemon.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is the in-memory state store for the daemon. It is thread-safe and supports pub/sub for real-time updates.

func New

func New() *Store

New creates a new Store instance.

func (*Store) ApplyUpdate

func (s *Store) ApplyUpdate(u Update)

ApplyUpdate modifies the state and notifies subscribers.

func (*Store) Get

func (s *Store) Get() State

Get returns a copy of the current state.

func (*Store) GetFocus

func (s *Store) GetFocus() map[string]struct{}

GetFocus returns the set of focused workspace paths.

func (*Store) GetSessions

func (s *Store) GetSessions() []*models.Session

GetSessions returns a slice of all sessions.

func (*Store) GetWorkspaces

func (s *Store) GetWorkspaces() []*enrichment.EnrichedWorkspace

GetWorkspaces returns a slice of all enriched workspaces.

func (*Store) IsFocused

func (s *Store) IsFocused(path string) bool

IsFocused returns true if the given path is in the focus set.

func (*Store) SetFocus

func (s *Store) SetFocus(paths []string)

SetFocus updates the set of focused workspace paths. Focused workspaces get priority scanning by collectors.

func (*Store) Subscribe

func (s *Store) Subscribe() chan Update

Subscribe creates a new subscription channel for state updates.

func (*Store) Unsubscribe

func (s *Store) Unsubscribe(ch chan Update)

Unsubscribe removes a subscription and closes its channel.

type Update

type Update struct {
	Type    UpdateType
	Source  string // Which collector sent this update (e.g., "git", "workspace", "session", "plan", "note")
	Scanned int    // Number of items actually scanned (for focused updates)
	Payload interface{}
}

Update represents a change to the state.

type UpdateType

type UpdateType string

UpdateType defines what kind of data changed.

const (
	UpdateWorkspaces UpdateType = "workspaces"
	UpdateSessions   UpdateType = "sessions"
	UpdateFocus      UpdateType = "focus"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL