handler

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry stores registered task type handlers. It supports exact matches and pattern-based routing (e.g., "email:*"). Longest matching pattern wins, similar to net/http.ServeMux. It is safe for concurrent use.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new empty handler registry.

func (*Registry) Get

func (r *Registry) Get(taskType types.TaskType) (*types.HandlerDefinition, bool)

Get returns the handler definition for a task type. It first checks exact matches, then falls back to pattern matching (longest prefix wins).

func (*Registry) Len

func (r *Registry) Len() int

Len returns the number of registered handlers (exact + pattern).

func (*Registry) Register

func (r *Registry) Register(def types.HandlerDefinition) error

Register adds a handler definition to the registry. TaskType can be an exact name ("email.send") or a pattern ("email:*", "email.*"). Patterns ending with "*" match any task type sharing that prefix.

func (*Registry) TaskTypes

func (r *Registry) TaskTypes() []string

TaskTypes returns all registered task type names (exact + pattern).

Jump to

Keyboard shortcuts

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