catalog

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package catalog lets workflows label themselves, and lets applications find workflows by label.

A label is a string pair such as lifecycle=install, stored in the entry metadata under the reserved prefix "label:". The engine does not interpret labels; this package does.

Label rules:

  • One value per label. Passing the same label option twice keeps the last value.
  • Labels are set when the workflow is registered and cannot change afterwards, because metadata values never change.
  • Label names use lowercase letters, digits, dots and dashes, and start and end with a letter or digit.

Index

Constants

This section is empty.

Variables

View Source
var ErrMetadataUnsupported = errors.New("workflow entry does not support metadata")

ErrMetadataUnsupported is returned by Register when labels were requested but the entry does not support metadata. The workflow stays registered without labels.

Functions

func FindByLifecycle added in v0.46.0

func FindByLifecycle(engine workflow.Engine, lifecycle Lifecycle) []workflow.Identifier

FindByLifecycle returns the IDs of the workflows of the engine that are labeled lifecycle=<lifecycle>, sorted by ID.

The result is a snapshot. Entries without metadata support are skipped. A workflow that is removed or replaced between listing and lookup is skipped or seen as its current entry; it never causes a panic. The engine is only used through its workflow.Engine methods, so wrapped engines work.

func Register

Register registers a workflow with the engine and labels it with the given options.

Without options it behaves exactly like engine.Register. An error from engine.Register is returned unchanged, together with the entry that engine.Register returned, which is nil. If the entry does not support metadata, Register returns the entry together with ErrMetadataUnsupported; the workflow stays registered without labels.

Types

type Lifecycle

type Lifecycle string

Lifecycle is a predefined value of the lifecycle label.

const (
	// Install labels a workflow as an install step: lifecycle=install.
	Install Lifecycle = "install"
	// Uninstall labels a workflow as an uninstall step: lifecycle=uninstall.
	Uninstall Lifecycle = "uninstall"
)

type RegisterOption

type RegisterOption func(labels map[string]string)

RegisterOption sets a label on a workflow when it is registered.

func WithLifecycle

func WithLifecycle(lifecycle Lifecycle) RegisterOption

WithLifecycle labels the workflow with lifecycle=<lifecycle>.

Jump to

Keyboard shortcuts

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