hotload

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package hotload provides runtime protocol hot-loading and dynamic registration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatEvent

func FormatEvent(e Event) string

FormatEvent formats an event for display.

Types

type Event

type Event struct {
	Type     string    `json:"type"` // "loaded", "updated", "removed", "error"
	Protocol string    `json:"protocol"`
	File     string    `json:"file"`
	Time     time.Time `json:"time"`
	Error    string    `json:"error,omitempty"`
}

Event represents a hot-load event.

type Stats

type Stats struct {
	WatchedFiles int       `json:"watched_files"`
	LastScan     time.Time `json:"last_scan"`
	TotalLoads   int       `json:"total_loads"`
}

Stats returns hot-load statistics.

type Watcher

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

Watcher watches for PSL file changes and hot-reloads protocols.

func NewWatcher

func NewWatcher(lib *protocol.Library, dir string, interval time.Duration) *Watcher

NewWatcher creates a new file watcher for hot-loading.

func (*Watcher) GetStats

func (w *Watcher) GetStats() Stats

GetStats returns current watcher statistics.

func (*Watcher) OnEvent

func (w *Watcher) OnEvent(cb func(Event))

OnEvent registers a callback for hot-load events.

func (*Watcher) Scan

func (w *Watcher) Scan() []Event

Scan scans for changed PSL files and reloads them.

Jump to

Keyboard shortcuts

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