Documentation
¶
Overview ¶
Package engine keeps resource data fresh, k9s-style: one poll goroutine per watched (profile, resource, scope) key feeding an in-memory cache, with results pushed to the UI through a sink (the app wires p.Send). Views render cached rows instantly (stale-while-revalidate) while the poller refreshes in the background.
The engine deliberately runs outside the Bubble Tea loop so cache entries outlive view pushes/pops and drill-back is instant.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataEvent ¶
DataEvent is pushed to the sink after every fetch, and synchronously on Watch when cached rows exist. On fetch errors Rows retains the last good data (Stale=true) so views can keep rendering with a staleness badge.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine owns the cache and poll goroutines.
func New ¶
New builds an engine delivering events to sink. The sink must be safe to call from any goroutine (tea.Program.Send is). A nil store disables the disk cache.
func (*Engine) RefreshNow ¶
RefreshNow requests an immediate out-of-band fetch (ctrl+r). Non-blocking; coalesces if a refresh is already queued.
func (*Engine) Unwatch ¶
Unwatch drops one watcher; at zero the poll goroutine stops. The cache entry survives so the next Watch paints instantly.
type FetchFunc ¶
FetchFunc loads rows for one key. Bound to a def+clients+scope by the caller; the engine knows nothing about resources or the SDK.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists cache entries to disk so a fresh launch paints instantly from the last session's data (marked stale) while the poller refreshes in the background. Layout: <dir>/<profile>/<resource>[__scope].json.