node

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileDiscovery

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

FileDiscovery handles discovering node files in the filesystem

func NewFileDiscovery

func NewFileDiscovery(nodesDir string) *FileDiscovery

NewFileDiscovery creates a new file discovery instance. nodesDir is the directory where node YAML files are stored. Use config.ResolveNodesPath() to get this from the project config.

func (*FileDiscovery) DiscoverAll

func (d *FileDiscovery) DiscoverAll() ([]string, error)

DiscoverAll finds all .yaml files in the nodes directory

func (*FileDiscovery) DiscoverByPattern

func (d *FileDiscovery) DiscoverByPattern(pattern string) ([]string, error)

DiscoverByPattern finds .yaml files matching a path pattern

func (*FileDiscovery) IDToPath

func (d *FileDiscovery) IDToPath(id string) string

IDToPath converts a node ID to a file path Example: systems/food -> .deco/nodes/systems/food.yaml

func (*FileDiscovery) PathToID

func (d *FileDiscovery) PathToID(path string) string

PathToID converts a file path to a node ID Example: .deco/nodes/systems/food.yaml -> systems/food

type Repository

type Repository interface {
	// LoadAll loads all nodes from storage.
	LoadAll() ([]domain.Node, error)

	// Load retrieves a single node by its ID.
	// Returns the node if found, or an error if not found or on failure.
	Load(id string) (domain.Node, error)

	// Save persists a node to storage.
	// Creates a new node if it doesn't exist, updates if it does.
	Save(node domain.Node) error

	// Delete removes a node from storage by ID.
	// Returns an error if the node doesn't exist or on failure.
	Delete(id string) error

	// Exists checks if a node with the given ID exists in storage.
	Exists(id string) (bool, error)
}

Repository defines the interface for node persistence operations. Implementations handle loading and saving nodes to/from storage (filesystem, DB, etc.).

type YAMLRepository

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

YAMLRepository implements Repository using YAML files on the filesystem

func NewYAMLRepository

func NewYAMLRepository(nodesDir string) *YAMLRepository

NewYAMLRepository creates a new YAML-based node repository. nodesDir is the directory where node YAML files are stored. Use config.ResolveNodesPath() to get this from the project config.

func (*YAMLRepository) Delete

func (r *YAMLRepository) Delete(id string) error

Delete removes a node from storage by ID

func (*YAMLRepository) Exists

func (r *YAMLRepository) Exists(id string) (bool, error)

Exists checks if a node with the given ID exists in storage

func (*YAMLRepository) Load

func (r *YAMLRepository) Load(id string) (domain.Node, error)

Load retrieves a single node by its ID

func (*YAMLRepository) LoadAll

func (r *YAMLRepository) LoadAll() ([]domain.Node, error)

LoadAll loads all nodes from storage

func (*YAMLRepository) Save

func (r *YAMLRepository) Save(node domain.Node) error

Save persists a node to storage

Jump to

Keyboard shortcuts

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