Documentation
¶
Index ¶
- type ResourceCache
- type ResourceCacheMap
- func (rc *ResourceCacheMap) Clear()
- func (rc *ResourceCacheMap) Get(id object.ObjMetadata) ResourceStatus
- func (rc *ResourceCacheMap) Load(values ...ResourceStatus) error
- func (rc *ResourceCacheMap) Put(id object.ObjMetadata, value ResourceStatus)
- func (rc *ResourceCacheMap) Remove(id object.ObjMetadata)
- type ResourceCacheReader
- type ResourceStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResourceCache ¶
type ResourceCache interface { ResourceCacheReader // Load one or more resources into the cache, generating the ObjMetadata // from the objects. Load(...ResourceStatus) error // Put the resource into the cache using the specified ID. Put(object.ObjMetadata, ResourceStatus) // Remove the resource associated with the ID from the cache. Remove(object.ObjMetadata) // Clear the cache. Clear() }
ResourceCache stores CachedResource objects
type ResourceCacheMap ¶
type ResourceCacheMap struct {
// contains filtered or unexported fields
}
ResourceCacheMap stores ResourceStatus objects in a map indexed by resource ID. ResourceCacheMap is thread-safe.
func NewResourceCacheMap ¶
func NewResourceCacheMap() *ResourceCacheMap
NewResourceCacheMap returns a new empty ResourceCacheMap
func (*ResourceCacheMap) Get ¶
func (rc *ResourceCacheMap) Get(id object.ObjMetadata) ResourceStatus
Get retrieves the resource associated with the ID from the cache. Returns (nil, true) if not found in the cache.
func (*ResourceCacheMap) Load ¶
func (rc *ResourceCacheMap) Load(values ...ResourceStatus) error
Load resources into the cache, generating the ID from the resource itself. Existing resources with the same ID will be replaced. Returns an error if any resource ID cannot be generated.
func (*ResourceCacheMap) Put ¶
func (rc *ResourceCacheMap) Put(id object.ObjMetadata, value ResourceStatus)
Put the resource into the cache using the supplied ID, replacing any existing resource with the same ID.
func (*ResourceCacheMap) Remove ¶
func (rc *ResourceCacheMap) Remove(id object.ObjMetadata)
Remove the resource associated with the ID from the cache.
type ResourceCacheReader ¶
type ResourceCacheReader interface { // Get the resource associated with the ID from the cache. // If not cached, status will be Unknown and resource will be nil. Get(object.ObjMetadata) ResourceStatus }
ResourceCacheReader retrieves CachedResource objects
type ResourceStatus ¶
type ResourceStatus struct { // Resource is the last known value retrieved from the cluster Resource *unstructured.Unstructured // Status of the resource Status status.Status // StatusMessage is the human readable reason for the status StatusMessage string }
ResourceStatus wraps an unstructured resource object, combined with the computed status (whether the status matches the spec).