store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package store holds the current state of the loaded issue forms and notifies subscribers whenever it changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Loader

type Loader interface {
	Load(dir string) ([]*form.Form, error)
}

type Snapshot

type Snapshot struct {
	Forms []*form.Form
	Err   error

	// Version increments on each reload; clients can use it for SSE.
	Version uint64
}

Snapshot is a point-in-time view of the forms directory: either a list of valid forms or the error encountered while loading/validating them.

type Store

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

func New

func New(dir string, loader Loader) *Store

New creates a Store and performs the initial load.

func (*Store) Dir

func (s *Store) Dir() string

Dir returns the watched directory path.

func (*Store) Get

func (s *Store) Get() Snapshot

Get returns the current snapshot.

func (*Store) Reload

func (s *Store) Reload()

Reload re-reads and re-validates all forms in the directory. Any error becomes part of the snapshot. It is not returned to the caller because the goal of live-reload is to display errors in the UI.

func (*Store) Subscribe

func (s *Store) Subscribe() (<-chan struct{}, func())

Subscribe returns a channel that receives a tick on every Reload. Caller must call the returned cancel function when done.

Jump to

Keyboard shortcuts

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