Documentation
¶
Overview ¶
Package loader holds the "load one entity by id from a store" pattern shared by Stovepipe's queue controllers (build, process, buildsignal).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByID ¶
func ByID[T any](ctx context.Context, id string, get func(context.Context, string) (T, error), entityName string) (T, error)
ByID loads one entity by id via get, returning it unwrapped on success. On failure it wraps the error as "failed to load <entityName> <id>: <cause>" so every stovepipe controller reports load failures in the same shape.
get is typically a store's Get method value passed directly (e.g. c.store.GetRequestStore().Get), which fixes T through inference so callers never spell out the type parameter.
Not-found is never special-cased into a retryable error here: per the storage read-after-write-consistency contract (see stovepipe/extension/storage/README.md), a Get miss on a row that a causally-prior write should already have produced is a storage implementation defect, not a lag condition worth retrying through. It surfaces as a plain error, non-retryable by platform/errs's default.
Types ¶
This section is empty.