Documentation
¶
Overview ¶
Package serviceunit provides domain-specific, field-level caching for ServiceUnit resources. ServiceUnitCache embeds cache.ObjectCache and adds typed Set* / Get* helpers for each resolved spec field (type, image, buildRef, containerPort, size, appType, stackType), plus PublishResolved, which projects a *serviceunitResolution.ResolvedServiceUnit into those fields. image and buildRef are type-discriminated: a ServiceUnit is either type: static (image) or type: build (buildRef), and PublishResolved caches exactly one of the pair based on the resolved spec's Type.
Index ¶
- type ServiceUnitCache
- func (s *ServiceUnitCache) GetAppType(ctx context.Context, nn types.NamespacedName, gen int64) (string, bool, error)
- func (s *ServiceUnitCache) GetBuildRef(ctx context.Context, nn types.NamespacedName, gen int64, into any) (bool, error)
- func (s *ServiceUnitCache) GetContainerPort(ctx context.Context, nn types.NamespacedName, gen int64) (int, bool, error)
- func (s *ServiceUnitCache) GetImage(ctx context.Context, nn types.NamespacedName, gen int64) (string, bool, error)
- func (s *ServiceUnitCache) GetSize(ctx context.Context, nn types.NamespacedName, gen int64) (int, bool, error)
- func (s *ServiceUnitCache) GetStackType(ctx context.Context, nn types.NamespacedName, gen int64) (string, bool, error)
- func (s *ServiceUnitCache) GetType(ctx context.Context, nn types.NamespacedName, gen int64) (string, bool, error)
- func (s *ServiceUnitCache) PublishResolved(ctx context.Context, nn types.NamespacedName, gen int64, ...) error
- func (s *ServiceUnitCache) SetAppType(ctx context.Context, nn types.NamespacedName, gen int64, appType string) error
- func (s *ServiceUnitCache) SetBuildRef(ctx context.Context, nn types.NamespacedName, gen int64, buildRef any) error
- func (s *ServiceUnitCache) SetContainerPort(ctx context.Context, nn types.NamespacedName, gen int64, port int) error
- func (s *ServiceUnitCache) SetImage(ctx context.Context, nn types.NamespacedName, gen int64, image string) error
- func (s *ServiceUnitCache) SetSize(ctx context.Context, nn types.NamespacedName, gen int64, size int) error
- func (s *ServiceUnitCache) SetStackType(ctx context.Context, nn types.NamespacedName, gen int64, stackType string) error
- func (s *ServiceUnitCache) SetType(ctx context.Context, nn types.NamespacedName, gen int64, typ string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServiceUnitCache ¶
type ServiceUnitCache struct {
*bocache.ObjectCache
}
ServiceUnitCache provides domain-specific, field-level caching for ServiceUnit resources.
func NewServiceUnitCache ¶
func NewServiceUnitCache(c *cache.Cache) *ServiceUnitCache
NewServiceUnitCache constructs a new ServiceUnitCache with the provided cache.Cache.
func (*ServiceUnitCache) GetAppType ¶
func (s *ServiceUnitCache) GetAppType(ctx context.Context, nn types.NamespacedName, gen int64) (string, bool, error)
func (*ServiceUnitCache) GetBuildRef ¶
func (s *ServiceUnitCache) GetBuildRef(ctx context.Context, nn types.NamespacedName, gen int64, into any) (bool, error)
func (*ServiceUnitCache) GetContainerPort ¶
func (s *ServiceUnitCache) GetContainerPort(ctx context.Context, nn types.NamespacedName, gen int64) (int, bool, error)
func (*ServiceUnitCache) GetImage ¶
func (s *ServiceUnitCache) GetImage(ctx context.Context, nn types.NamespacedName, gen int64) (string, bool, error)
func (*ServiceUnitCache) GetSize ¶
func (s *ServiceUnitCache) GetSize(ctx context.Context, nn types.NamespacedName, gen int64) (int, bool, error)
func (*ServiceUnitCache) GetStackType ¶
func (s *ServiceUnitCache) GetStackType(ctx context.Context, nn types.NamespacedName, gen int64) (string, bool, error)
func (*ServiceUnitCache) GetType ¶
func (s *ServiceUnitCache) GetType(ctx context.Context, nn types.NamespacedName, gen int64) (string, bool, error)
func (*ServiceUnitCache) PublishResolved ¶
func (s *ServiceUnitCache) PublishResolved(ctx context.Context, nn types.NamespacedName, gen int64, r *serviceunitResolution.ResolvedServiceUnit) error
PublishResolved writes the resolved service unit contract as a generation-scoped, field-level projection. The image/buildRef pair is type-discriminated: exactly one is published per the unit's type. All writes are best-effort: failures cost queryability, never correctness. Returns the first error encountered for optional logging; callers should not fail reconciliation on it.
func (*ServiceUnitCache) SetAppType ¶
func (s *ServiceUnitCache) SetAppType(ctx context.Context, nn types.NamespacedName, gen int64, appType string) error
func (*ServiceUnitCache) SetBuildRef ¶
func (s *ServiceUnitCache) SetBuildRef(ctx context.Context, nn types.NamespacedName, gen int64, buildRef any) error
func (*ServiceUnitCache) SetContainerPort ¶
func (s *ServiceUnitCache) SetContainerPort(ctx context.Context, nn types.NamespacedName, gen int64, port int) error
func (*ServiceUnitCache) SetImage ¶
func (s *ServiceUnitCache) SetImage(ctx context.Context, nn types.NamespacedName, gen int64, image string) error
func (*ServiceUnitCache) SetSize ¶
func (s *ServiceUnitCache) SetSize(ctx context.Context, nn types.NamespacedName, gen int64, size int) error
func (*ServiceUnitCache) SetStackType ¶
func (s *ServiceUnitCache) SetStackType(ctx context.Context, nn types.NamespacedName, gen int64, stackType string) error
func (*ServiceUnitCache) SetType ¶
func (s *ServiceUnitCache) SetType(ctx context.Context, nn types.NamespacedName, gen int64, typ string) error