Documentation
¶
Overview ¶
Package reloader provides interfaces and implementations for running local development processes with hot-reload capabilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknownType is returned when trying to create a reloader with an unknown type. ErrUnknownType = errors.New("unknown reloader type") // ErrRunFailed is returned when a reloader run operation fails. ErrRunFailed = errors.New("reloader run failed") // ErrStatusFailed is returned when unable to determine reloader status. ErrStatusFailed = errors.New("failed to get reloader status") // ErrTargetNotFound is returned when the target resource doesn't exist. ErrTargetNotFound = errors.New("target resource not found") )
Functions ¶
func ListTypes ¶
func ListTypes() []string
ListTypes returns a list of all registered reloader types.
func Register ¶
func Register(reloaderType string, factory ManagerFactory)
Register registers a reloader manager factory for a given type. This function is typically called in init() functions of reloader implementations.
Types ¶
type Manager ¶
type Manager interface {
// Type returns the reloader type that this manager handles (e.g., "mirror", "skaffold").
Type() string
// Run runs the reloader processes, blocking until the context is cancelled.
// This method should:
// - Perform any pre-run setup (e.g., creating deployment copies)
// - Start all configured processes
// - Monitor processes for crashes and restart as needed
// - Clean up on context cancellation (e.g., removing deployment copies)
//
// Returns an error if:
// - Unable to start processes
// - Repository directory doesn't exist
// - Target resources don't exist (for mirrord)
Run(ctx context.Context, reloaderConfig *v2.ReloaderConfig, caproniConfig *v2.CaproniConfig) error
// Status returns the current status of the reloader.
// Returns an error if unable to determine reloader state.
Status(ctx context.Context, reloaderConfig *v2.ReloaderConfig, caproniConfig *v2.CaproniConfig) (*Status, error)
// Validate validates the reloader configuration and referenced files.
// Returns nil if valid, or an error describing validation failures.
// Files in uncloned repository directories should not cause validation to fail.
Validate(reloaderConfig *v2.ReloaderConfig, caproniConfig *v2.CaproniConfig) error
}
Manager defines the interface for managing local development processes. Implementations are responsible for running processes with hot-reload capabilities using specific strategies (e.g., mirrord, skaffold).
func NewManager ¶
NewManager creates a new reloader manager for the given type. Returns an error if the type is not registered.
type ManagerFactory ¶
type ManagerFactory func() Manager
ManagerFactory is a function that creates a new reloader manager.
type State ¶
type State string
State represents the current state of a reloader.
const ( // StateNotDeployed indicates the target deployment doesn't exist. StateNotDeployed State = "not-deployed" // StateNotReady indicates the reloader cannot run (e.g., target resource missing). StateNotReady State = "not-ready" // StateReady indicates the reloader is ready to run. StateReady State = "ready" // StateFailed indicates the reloader failed. StateFailed State = "failed" )
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mirror implements the reloader manager for mirror reloaders.
|
Package mirror implements the reloader manager for mirror reloaders. |
|
Package skaffold implements the reloader manager for skaffold reloaders.
|
Package skaffold implements the reloader manager for skaffold reloaders. |