Documentation
¶
Overview ¶
Package hub provides hub lifecycle management and automatic binding.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Default = NewRegistry()
Functions ¶
func LogDiscovered ¶
func LogDiscovered()
LogDiscovered reads the homelab registry and logs discovered capabilities that are not yet registered in the hub. It does not perform automatic binding, which requires provider configuration to be set up first.
Types ¶
type AppHealth ¶
type AppHealth struct {
Name string `json:"name"`
Status homelab.AppStatus `json:"status"`
Health homelab.HealthStatus `json:"health"`
}
type Binding ¶
type Binding struct {
Capability CapabilityType `json:"capability"`
Backend string `json:"backend"`
App string `json:"app"`
Healthy bool `json:"healthy"`
}
type CapabilityHealth ¶
type CapabilityHealth struct {
Type CapabilityType `json:"capability"`
Backend string `json:"backend"`
App string `json:"app"`
Status HealthStatus `json:"status"`
Description string `json:"description,omitempty"`
}
type CapabilityType ¶
type CapabilityType string
const ( CapBookmark CapabilityType = "bookmark" CapArchive CapabilityType = "archive" CapReader CapabilityType = "reader" CapKanban CapabilityType = "kanban" CapFinance CapabilityType = "finance" CapInfra CapabilityType = "infra" CapShellHistory CapabilityType = "shell_history" CapNotify CapabilityType = "notify" CapExample CapabilityType = "example" CapForge CapabilityType = "forge" CapGithub CapabilityType = "github" CapNote CapabilityType = "note" CapMemo CapabilityType = "memo" )
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
func NewChecker ¶
func (*Checker) CheckCapability ¶
func (c *Checker) CheckCapability(_ context.Context, capType CapabilityType) (*CapabilityHealth, error)
type Descriptor ¶
type Descriptor struct {
Type CapabilityType `json:"type"`
Backend string `json:"backend"`
App string `json:"app"`
Description string `json:"description,omitzero"`
Operations []Operation `json:"operations,omitzero"`
Events []EventDef `json:"events,omitzero"`
Instance any `json:"-"`
Healthy bool `json:"healthy"`
}
type DiscoveredBinding ¶
type DiscoveredBinding struct {
Capability CapabilityType
Backend string
App string
Endpoint *homelab.EndpointInfo
Auth *homelab.AuthInfo
Bound bool
}
DiscoveredBinding represents a capability that has been discovered but not yet registered in the hub as a full-capability descriptor.
func AutoBind ¶
func AutoBind() []DiscoveredBinding
AutoBind reads the homelab registry and returns a list of discovered bindings together with their registration status in the hub.
type EndpointHealthChecker ¶
type EndpointHealthChecker struct {
// contains filtered or unexported fields
}
EndpointHealthChecker probes HTTP endpoints discovered on homelab apps to determine their health status.
func NewEndpointHealthChecker ¶
func NewEndpointHealthChecker(timeout time.Duration) *EndpointHealthChecker
NewEndpointHealthChecker creates a health checker with the given HTTP request timeout.
func (*EndpointHealthChecker) Check ¶
func (c *EndpointHealthChecker) Check(ctx context.Context, healthURL string) (HealthStatus, error)
Check probes a single health URL and returns whether the endpoint is healthy.
func (*EndpointHealthChecker) CheckCapabilities ¶
func (c *EndpointHealthChecker) CheckCapabilities(ctx context.Context, registry *Registry) []CapabilityHealth
CheckCapabilities probes all discovered endpoint health URLs across all homelab apps and builds CapabilityHealth entries. Capabilities that are already registered in the hub registry are skipped to avoid duplicates.
type HealthResult ¶
type HealthResult struct {
Status HealthStatus `json:"status"`
Timestamp time.Time `json:"timestamp"`
Details []CapabilityHealth `json:"details,omitempty"`
AppStatuses []AppHealth `json:"app_statuses,omitempty"`
}
type HealthStatus ¶
type HealthStatus string
const ( HealthHealthy HealthStatus = "healthy" HealthDegraded HealthStatus = "degraded" HealthUnhealthy HealthStatus = "unhealthy" )
type ParamDef ¶
type ParamDef struct {
Name string `json:"name"`
Type string `json:"type"`
Description string `json:"description,omitzero"`
Required bool `json:"required,omitzero"`
}
ParamDef describes a parameter for an operation.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) Get ¶
func (r *Registry) Get(capability CapabilityType) (Descriptor, bool)
func (*Registry) List ¶
func (r *Registry) List() []Descriptor
func (*Registry) Register ¶
func (r *Registry) Register(desc Descriptor) error
func (*Registry) Unregister ¶
func (r *Registry) Unregister(capType CapabilityType)
Unregister removes a capability descriptor from the hub registry.