store

package
v0.6.39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: AGPL-3.0, Apache-2.0, MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InsightComponentPriority

func InsightComponentPriority(name, namespace, kind string) *client.InsightComponentPriority

InsightComponentPriority returns insight priority for a given component.

func NodeStatisticHealth

func NodeStatisticHealth(pendingPods int64) *client.NodeStatisticHealth

NodeStatisticHealth returns health status based on the number of pending pods.

func WithTransaction

func WithTransaction(conn *sqlite.Conn, fn func() error) (err error)

Types

type ComponentState

type ComponentState int32

ComponentState int32 representation used for better performance.

const (
	ComponentStateRunning ComponentState = iota
	ComponentStatePending
	ComponentStateFailed
	ComponentStatePaused
)

func NewComponentState

func NewComponentState(in *client.ComponentState) ComponentState

func (ComponentState) Attribute

func (in ComponentState) Attribute() *client.ComponentState

Attribute that can be used in the Console API calls.

func (ComponentState) String

func (in ComponentState) String() string

String returns human-readable component state string representation.

type DatabaseStore

type DatabaseStore struct {
	// contains filtered or unexported fields
}

func (*DatabaseStore) CommitTransientSHA

func (in *DatabaseStore) CommitTransientSHA(obj unstructured.Unstructured) error

func (*DatabaseStore) DeleteComponent

func (in *DatabaseStore) DeleteComponent(key smcommon.StoreKey) error

func (*DatabaseStore) DeleteComponents

func (in *DatabaseStore) DeleteComponents(group, version, kind string) error

func (*DatabaseStore) DeleteUnsyncedComponentsByKeys

func (in *DatabaseStore) DeleteUnsyncedComponentsByKeys(objects containers.Set[smcommon.StoreKey]) error

func (*DatabaseStore) Expire

func (in *DatabaseStore) Expire(serviceID string) error

func (*DatabaseStore) ExpireHookComponents

func (in *DatabaseStore) ExpireHookComponents(serviceID string) error

func (*DatabaseStore) ExpireOlderThan

func (in *DatabaseStore) ExpireOlderThan(ttl time.Duration) error

func (*DatabaseStore) ExpireSHA

func (in *DatabaseStore) ExpireSHA(obj unstructured.Unstructured) error

func (*DatabaseStore) GetAppliedComponent

func (in *DatabaseStore) GetAppliedComponent(obj unstructured.Unstructured) (result *smcommon.Component, err error)

func (*DatabaseStore) GetAppliedComponentByUID

func (in *DatabaseStore) GetAppliedComponentByUID(uid types.UID) (result *client.ComponentChildAttributes, err error)

func (*DatabaseStore) GetAppliedComponentsByGVK

func (in *DatabaseStore) GetAppliedComponentsByGVK(gvk schema.GroupVersionKind) (result []smcommon.Component, err error)

func (*DatabaseStore) GetComponentAttributes

func (in *DatabaseStore) GetComponentAttributes(serviceID string, isDeleting bool) ([]client.ComponentAttributes, error)

func (*DatabaseStore) GetComponentCounts

func (in *DatabaseStore) GetComponentCounts() (nodeCount, namespaceCount int64, err error)

func (*DatabaseStore) GetComponentInsights

func (in *DatabaseStore) GetComponentInsights() (result []client.ClusterInsightComponentAttributes, err error)

func (*DatabaseStore) GetHealthScore

func (in *DatabaseStore) GetHealthScore() (int64, error)

func (*DatabaseStore) GetHookComponents

func (in *DatabaseStore) GetHookComponents(serviceID string) ([]smcommon.HookComponent, error)

func (*DatabaseStore) GetNodeStatistics

func (in *DatabaseStore) GetNodeStatistics() ([]*client.NodeStatisticAttributes, error)

func (*DatabaseStore) GetResourceHealth

func (in *DatabaseStore) GetResourceHealth(resources []unstructured.Unstructured) (hasPendingResources, hasFailedResources bool, err error)

func (*DatabaseStore) GetServiceComponents

func (in *DatabaseStore) GetServiceComponents(serviceID string, onlyApplied bool) (smcommon.Components, error)

func (*DatabaseStore) GetServiceComponentsWithChildren

func (in *DatabaseStore) GetServiceComponentsWithChildren(serviceID string, onlyApplied bool) ([]client.ComponentAttributes, error)

func (*DatabaseStore) SaveComponent

func (in *DatabaseStore) SaveComponent(obj unstructured.Unstructured) error

func (*DatabaseStore) SaveComponentAttributes

func (in *DatabaseStore) SaveComponentAttributes(obj client.ComponentChildAttributes, args ...any) error

func (*DatabaseStore) SaveComponents

func (in *DatabaseStore) SaveComponents(objects []unstructured.Unstructured) error

func (*DatabaseStore) SaveHookComponentWithManifestSHA

func (in *DatabaseStore) SaveHookComponentWithManifestSHA(manifest, appliedResource unstructured.Unstructured) error

func (*DatabaseStore) SaveUnsyncedComponents

func (in *DatabaseStore) SaveUnsyncedComponents(objects []unstructured.Unstructured) error

func (*DatabaseStore) SetComponentUnsynced

func (in *DatabaseStore) SetComponentUnsynced(obj unstructured.Unstructured) error

func (*DatabaseStore) SetServiceChildren

func (in *DatabaseStore) SetServiceChildren(serviceID, parentUID string, keys []smcommon.StoreKey) (int, error)

func (*DatabaseStore) Shutdown

func (in *DatabaseStore) Shutdown() error

func (*DatabaseStore) SyncAppliedResource

func (in *DatabaseStore) SyncAppliedResource(obj unstructured.Unstructured) error

func (*DatabaseStore) SyncServiceComponents

func (in *DatabaseStore) SyncServiceComponents(serviceID string, resources []unstructured.Unstructured) error

func (*DatabaseStore) UpdateComponentSHA

func (in *DatabaseStore) UpdateComponentSHA(obj unstructured.Unstructured, shaType SHAType) error

type Option

type Option func(store *DatabaseStore)

Option represents a function that configures the database store.

func WithFilePath

func WithFilePath(path string) Option

WithFilePath sets the path where the cache file will be stored in the file storage mode.

func WithPoolSize

func WithPoolSize(size int) Option

WithPoolSize sets the maximum number of concurrent connections in the pool.

func WithStorage

func WithStorage(storage api.Storage) Option

WithStorage sets the storage mode for the cache.

type ProfiledStore

type ProfiledStore struct {
	// contains filtered or unexported fields
}

ProfiledStore is a wrapper around a Store that adds Datadog tracing for all database-related operations.

It assumes Datadog's tracer has been initialized elsewhere in the application (see cmd/agent/args/datadog.go).

func (*ProfiledStore) CommitTransientSHA

func (p *ProfiledStore) CommitTransientSHA(obj unstructured.Unstructured) error

CommitTransientSHA wraps Store.CommitTransientSHA with tracing.

func (*ProfiledStore) DeleteComponent

func (p *ProfiledStore) DeleteComponent(key smcommon.StoreKey) error

DeleteComponent wraps Store.DeleteComponent with tracing.

func (*ProfiledStore) DeleteComponents

func (p *ProfiledStore) DeleteComponents(group, version, kind string) error

DeleteComponents wraps Store.DeleteComponents with tracing.

func (*ProfiledStore) DeleteUnsyncedComponentsByKeys

func (p *ProfiledStore) DeleteUnsyncedComponentsByKeys(objects containers.Set[smcommon.StoreKey]) error

DeleteUnsyncedComponentsByKeys wraps Store.DeleteUnsyncedComponentsByKeys with tracing.

func (*ProfiledStore) Expire

func (p *ProfiledStore) Expire(serviceID string) error

Expire wraps Store.Expire with tracing.

func (*ProfiledStore) ExpireHookComponents

func (p *ProfiledStore) ExpireHookComponents(serviceID string) error

ExpireHookComponents wraps Store.ExpireHookComponents with tracing.

func (*ProfiledStore) ExpireOlderThan

func (p *ProfiledStore) ExpireOlderThan(ttl time.Duration) error

ExpireOlderThan wraps Store.ExpireOlderThan with tracing.

func (*ProfiledStore) ExpireSHA

func (p *ProfiledStore) ExpireSHA(obj unstructured.Unstructured) error

ExpireSHA wraps Store.ExpireSHA with tracing.

func (*ProfiledStore) GetAppliedComponent

func (p *ProfiledStore) GetAppliedComponent(obj unstructured.Unstructured) (*smcommon.Component, error)

GetAppliedComponent wraps Store.GetAppliedComponent with tracing.

func (*ProfiledStore) GetAppliedComponentByUID

func (p *ProfiledStore) GetAppliedComponentByUID(uid types.UID) (*client.ComponentChildAttributes, error)

GetAppliedComponentByUID wraps Store.GetAppliedComponentByUID with tracing.

func (*ProfiledStore) GetAppliedComponentsByGVK

func (p *ProfiledStore) GetAppliedComponentsByGVK(gvk schema.GroupVersionKind) ([]smcommon.Component, error)

GetAppliedComponentsByGVK wraps Store.GetAppliedComponentsByGVK with tracing.

func (*ProfiledStore) GetComponentAttributes

func (p *ProfiledStore) GetComponentAttributes(serviceID string, isDeleting bool) (attrs []client.ComponentAttributes, err error)

func (*ProfiledStore) GetComponentCounts

func (p *ProfiledStore) GetComponentCounts() (nodeCount, namespaceCount int64, err error)

GetComponentCounts wraps Store.GetComponentCounts with tracing.

func (*ProfiledStore) GetComponentInsights

func (p *ProfiledStore) GetComponentInsights() ([]client.ClusterInsightComponentAttributes, error)

GetComponentInsights wraps Store.GetComponentInsights with tracing.

func (*ProfiledStore) GetHealthScore

func (p *ProfiledStore) GetHealthScore() (int64, error)

GetHealthScore wraps Store.GetHealthScore with tracing.

func (*ProfiledStore) GetHookComponents

func (p *ProfiledStore) GetHookComponents(serviceID string) ([]smcommon.HookComponent, error)

GetHookComponents wraps Store.GetHookComponents with tracing.

func (*ProfiledStore) GetNodeStatistics

func (p *ProfiledStore) GetNodeStatistics() ([]*client.NodeStatisticAttributes, error)

GetNodeStatistics wraps Store.GetNodeStatistics with tracing.

func (*ProfiledStore) GetResourceHealth

func (p *ProfiledStore) GetResourceHealth(resources []unstructured.Unstructured) (hasPendingResources, hasFailedResources bool, err error)

GetResourceHealth wraps Store.GetResourceHealth with tracing.

func (*ProfiledStore) GetServiceComponents

func (p *ProfiledStore) GetServiceComponents(serviceID string, onlyApplied bool) (smcommon.Components, error)

GetServiceComponents wraps Store.GetServiceComponents with tracing.

func (*ProfiledStore) GetServiceComponentsWithChildren

func (p *ProfiledStore) GetServiceComponentsWithChildren(serviceID string, onlyApplied bool) (attrs []client.ComponentAttributes, err error)

func (*ProfiledStore) SaveComponent

func (p *ProfiledStore) SaveComponent(obj unstructured.Unstructured) error

SaveComponent wraps Store.SaveComponent with tracing.

func (*ProfiledStore) SaveComponentAttributes

func (p *ProfiledStore) SaveComponentAttributes(obj client.ComponentChildAttributes, args ...any) error

SaveComponentAttributes wraps Store.SaveComponentAttributes with tracing.

func (*ProfiledStore) SaveComponents

func (p *ProfiledStore) SaveComponents(obj []unstructured.Unstructured) error

SaveComponents wraps Store.SaveComponents with tracing.

func (*ProfiledStore) SaveHookComponentWithManifestSHA

func (p *ProfiledStore) SaveHookComponentWithManifestSHA(manifest, appliedResource unstructured.Unstructured) error

SaveHookComponentWithManifestSHA wraps Store.SaveHookComponentWithManifestSHA with tracing.

func (*ProfiledStore) SaveUnsyncedComponents

func (p *ProfiledStore) SaveUnsyncedComponents(obj []unstructured.Unstructured) error

SaveUnsyncedComponents wraps Store.SaveUnsyncedComponents with tracing.

func (*ProfiledStore) SetComponentUnsynced

func (p *ProfiledStore) SetComponentUnsynced(obj unstructured.Unstructured) error

SetComponentUnsynced wraps Store.SetComponentUnsynced with tracing.

func (*ProfiledStore) SetServiceChildren

func (p *ProfiledStore) SetServiceChildren(serviceID, parentUID string, keys []smcommon.StoreKey) (int, error)

SetServiceChildren wraps Store.SetServiceChildren with tracing.

func (*ProfiledStore) Shutdown

func (p *ProfiledStore) Shutdown() error

Shutdown wraps Store.Shutdown with tracing.

func (*ProfiledStore) SyncAppliedResource

func (p *ProfiledStore) SyncAppliedResource(obj unstructured.Unstructured) error

SyncAppliedResource wraps Store.SyncAppliedResource with tracing.

func (*ProfiledStore) SyncServiceComponents

func (p *ProfiledStore) SyncServiceComponents(serviceID string, resources []unstructured.Unstructured) error

SyncServiceComponents wraps Store.SyncServiceComponents with tracing.

func (*ProfiledStore) UpdateComponentSHA

func (p *ProfiledStore) UpdateComponentSHA(obj unstructured.Unstructured, t SHAType) error

UpdateComponentSHA wraps Store.UpdateComponentSHA with tracing.

type ProfiledStoreLocal

type ProfiledStoreLocal struct {
	// contains filtered or unexported fields
}

func (*ProfiledStoreLocal) CommitTransientSHA

func (p *ProfiledStoreLocal) CommitTransientSHA(obj unstructured.Unstructured) error

CommitTransientSHA wraps Store.CommitTransientSHA with tracing.

func (*ProfiledStoreLocal) DeleteComponent

func (p *ProfiledStoreLocal) DeleteComponent(key smcommon.StoreKey) error

DeleteComponent wraps Store.DeleteComponent with tracing.

func (*ProfiledStoreLocal) DeleteComponents

func (p *ProfiledStoreLocal) DeleteComponents(group, version, kind string) error

DeleteComponents wraps Store.DeleteComponents with tracing.

func (*ProfiledStoreLocal) DeleteUnsyncedComponentsByKeys

func (p *ProfiledStoreLocal) DeleteUnsyncedComponentsByKeys(objects containers.Set[smcommon.StoreKey]) error

DeleteUnsyncedComponentsByKeys wraps Store.DeleteUnsyncedComponentsByKeys with tracing.

func (*ProfiledStoreLocal) Expire

func (p *ProfiledStoreLocal) Expire(serviceID string) error

Expire wraps Store.Expire with tracing.

func (*ProfiledStoreLocal) ExpireHookComponents

func (p *ProfiledStoreLocal) ExpireHookComponents(serviceID string) error

ExpireHookComponents wraps Store.ExpireHookComponents with tracing.

func (*ProfiledStoreLocal) ExpireOlderThan

func (p *ProfiledStoreLocal) ExpireOlderThan(ttl time.Duration) error

ExpireOlderThan wraps Store.ExpireOlderThan with tracing.

func (*ProfiledStoreLocal) ExpireSHA

ExpireSHA wraps Store.ExpireSHA with tracing.

func (*ProfiledStoreLocal) GetAppliedComponent

func (p *ProfiledStoreLocal) GetAppliedComponent(obj unstructured.Unstructured) (*smcommon.Component, error)

GetAppliedComponent wraps Store.GetAppliedComponent with tracing.

func (*ProfiledStoreLocal) GetAppliedComponentByUID

func (p *ProfiledStoreLocal) GetAppliedComponentByUID(uid types.UID) (*client.ComponentChildAttributes, error)

GetAppliedComponentByUID wraps Store.GetAppliedComponentByUID with tracing.

func (*ProfiledStoreLocal) GetAppliedComponentsByGVK

func (p *ProfiledStoreLocal) GetAppliedComponentsByGVK(gvk schema.GroupVersionKind) ([]smcommon.Component, error)

GetAppliedComponentsByGVK wraps Store.GetAppliedComponentsByGVK with tracing.

func (*ProfiledStoreLocal) GetComponentAttributes

func (p *ProfiledStoreLocal) GetComponentAttributes(serviceID string, isDeleting bool) (attrs []client.ComponentAttributes, err error)

func (*ProfiledStoreLocal) GetComponentCounts

func (p *ProfiledStoreLocal) GetComponentCounts() (nodeCount, namespaceCount int64, err error)

GetComponentCounts wraps Store.GetComponentCounts with tracing.

func (*ProfiledStoreLocal) GetComponentInsights

func (p *ProfiledStoreLocal) GetComponentInsights() ([]client.ClusterInsightComponentAttributes, error)

GetComponentInsights wraps Store.GetComponentInsights with tracing.

func (*ProfiledStoreLocal) GetHealthScore

func (p *ProfiledStoreLocal) GetHealthScore() (int64, error)

GetHealthScore wraps Store.GetHealthScore with tracing.

func (*ProfiledStoreLocal) GetHookComponents

func (p *ProfiledStoreLocal) GetHookComponents(serviceID string) ([]smcommon.HookComponent, error)

GetHookComponents wraps Store.GetHookComponents with tracing.

func (*ProfiledStoreLocal) GetNodeStatistics

func (p *ProfiledStoreLocal) GetNodeStatistics() ([]*client.NodeStatisticAttributes, error)

GetNodeStatistics wraps Store.GetNodeStatistics with tracing.

func (*ProfiledStoreLocal) GetResourceHealth

func (p *ProfiledStoreLocal) GetResourceHealth(resources []unstructured.Unstructured) (hasPendingResources, hasFailedResources bool, err error)

GetResourceHealth wraps Store.GetResourceHealth with tracing.

func (*ProfiledStoreLocal) GetServiceComponents

func (p *ProfiledStoreLocal) GetServiceComponents(serviceID string, onlyApplied bool) (smcommon.Components, error)

GetServiceComponents wraps Store.GetServiceComponents with tracing.

func (*ProfiledStoreLocal) GetServiceComponentsWithChildren

func (p *ProfiledStoreLocal) GetServiceComponentsWithChildren(serviceID string, onlyApplied bool) (attrs []client.ComponentAttributes, err error)

func (ProfiledStoreLocal) SaveComponent

func (p ProfiledStoreLocal) SaveComponent(obj unstructured.Unstructured) error

func (*ProfiledStoreLocal) SaveComponentAttributes

func (p *ProfiledStoreLocal) SaveComponentAttributes(obj client.ComponentChildAttributes, args ...any) error

SaveComponentAttributes wraps Store.SaveComponentAttributes with tracing.

func (ProfiledStoreLocal) SaveComponents

func (p ProfiledStoreLocal) SaveComponents(obj []unstructured.Unstructured) error

func (*ProfiledStoreLocal) SaveHookComponentWithManifestSHA

func (p *ProfiledStoreLocal) SaveHookComponentWithManifestSHA(manifest, appliedResource unstructured.Unstructured) error

SaveHookComponentWithManifestSHA wraps Store.SaveHookComponentWithManifestSHA with tracing.

func (ProfiledStoreLocal) SaveUnsyncedComponents

func (p ProfiledStoreLocal) SaveUnsyncedComponents(obj []unstructured.Unstructured) error

func (*ProfiledStoreLocal) SetComponentUnsynced

func (p *ProfiledStoreLocal) SetComponentUnsynced(obj unstructured.Unstructured) error

SetComponentUnsynced wraps Store.SetComponentUnsynced with tracing.

func (*ProfiledStoreLocal) SetServiceChildren

func (p *ProfiledStoreLocal) SetServiceChildren(serviceID, parentUID string, keys []smcommon.StoreKey) (int, error)

SetServiceChildren wraps Store.SetServiceChildren with tracing.

func (*ProfiledStoreLocal) Shutdown

func (p *ProfiledStoreLocal) Shutdown() error

Shutdown wraps Store.Shutdown with tracing.

func (*ProfiledStoreLocal) SyncAppliedResource

func (p *ProfiledStoreLocal) SyncAppliedResource(obj unstructured.Unstructured) error

SyncAppliedResource wraps Store.SyncAppliedResource with tracing.

func (*ProfiledStoreLocal) SyncServiceComponents

func (p *ProfiledStoreLocal) SyncServiceComponents(serviceID string, resources []unstructured.Unstructured) error

SyncServiceComponents wraps Store.SyncServiceComponents with tracing.

func (*ProfiledStoreLocal) UpdateComponentSHA

func (p *ProfiledStoreLocal) UpdateComponentSHA(obj unstructured.Unstructured, t SHAType) error

UpdateComponentSHA wraps Store.UpdateComponentSHA with tracing.

type SHAType

type SHAType string
const (
	// ManifestSHA is SHA of the resource manifest from the repository.
	// It is used to detect changes in the manifest that are not yet applied.
	ManifestSHA SHAType = "MANIFEST"

	// ApplySHA is SHA of the resource post-server-side apply.
	// Taking only metadata w/ name, namespace, annotations and labels and non-status non-metadata fields.
	ApplySHA SHAType = "APPLY"

	// ServerSHA is SHA from a watch of the resource, using the same pruning function as applySHA.
	// It is persisted only if there's a current-inventory annotation.
	ServerSHA SHAType = "SERVER"

	// TransientManifestSHA is a temporary SHA of the resource manifest from the repository.
	// It is saved by the filters and committed after the resource is applied.
	TransientManifestSHA SHAType = "TRANSIENT"
)

type Store

type Store interface {
	SaveComponent(obj unstructured.Unstructured) error

	SaveComponents(obj []unstructured.Unstructured) error

	SaveUnsyncedComponents(obj []unstructured.Unstructured) error

	SetComponentUnsynced(obj unstructured.Unstructured) error

	// GetComponentAttributes returns service components attributes from the store.
	GetComponentAttributes(serviceID string, isDeleting bool) ([]client.ComponentAttributes, error)

	// SyncServiceComponents is used to store all service components in the store before applying them and to
	// ensure that components that are no longer part of the service and were not applied are removed from the store.
	SyncServiceComponents(serviceID string, resources []unstructured.Unstructured) error

	// DeleteUnsyncedComponentsByKeys removes multiple components from the store based on their smcommon.StoreKey.
	// It will delete only not applied components.
	// If the applied component is passed, it will be ignored.
	// It returns an error if any issue occurs during the deletion process.
	DeleteUnsyncedComponentsByKeys(objects containers.Set[smcommon.StoreKey]) error

	GetAppliedComponent(obj unstructured.Unstructured) (*smcommon.Component, error)

	GetAppliedComponentByUID(uid types.UID) (*client.ComponentChildAttributes, error)

	// GetAppliedComponentsByGVK returns all applied components matching provided GVK.
	GetAppliedComponentsByGVK(gvk schema.GroupVersionKind) ([]smcommon.Component, error)

	// DeleteComponent removes a component from the store based on its smcommon.StoreKey.
	// It returns an error if any issue occurs during the deletion process.
	DeleteComponent(key smcommon.StoreKey) error

	// DeleteComponents removes components from the store based on GVK.
	// It returns an error if any issue occurs during the deletion process.
	DeleteComponents(group, version, kind string) error

	SaveComponentAttributes(obj client.ComponentChildAttributes, args ...any) error

	// GetServiceComponents retrieves all parent components associated with a given service ID.
	// All components with parents are filtered out.
	// It returns a slice of Component structs containing information about each component and any error encountered.
	GetServiceComponents(serviceID string, onlyApplied bool) (smcommon.Components, error)

	// GetServiceComponentsWithChildren returns service components with their children populated.
	// It uses a single query to fetch both components and their recursive children (up to 4 levels deep).
	GetServiceComponentsWithChildren(serviceID string, onlyApplied bool) ([]client.ComponentAttributes, error)

	GetComponentInsights() ([]client.ClusterInsightComponentAttributes, error)

	GetComponentCounts() (nodeCount, namespaceCount int64, err error)

	// GetNodeStatistics returns a list of node statistics, including the node name and count of pending pods
	// that were created more than 5 minutes ago. Each NodeStatisticAttributes contains the node name and
	// the number of pending pods for that node. The health field is currently not implemented.
	// Returns an error if the database operation fails or if the connection cannot be established.
	GetNodeStatistics() ([]*client.NodeStatisticAttributes, error)

	// GetHealthScore calculates cluster health as a percentage using a base score minus deductions system.
	// Returns the health score as an integer value (0-100) and any error encountered.
	GetHealthScore() (int64, error)

	// UpdateComponentSHA updates the SHA for a component.
	UpdateComponentSHA(unstructured.Unstructured, SHAType) error

	// CommitTransientSHA commits a transient SHA to the store.
	CommitTransientSHA(unstructured.Unstructured) error

	// SyncAppliedResource synchronizes the component information after its manifest is applied.
	// It updates apply SHA, server SHA, commits transient manifest SHA and marks the component with the manifest flag.
	SyncAppliedResource(obj unstructured.Unstructured) error

	// ExpireSHA removes component SHA information.
	ExpireSHA(unstructured.Unstructured) error

	// Expire removes component SHA information based on the provided service ID.
	Expire(string) error

	// ExpireOlderThan removes component SHA information from entries older than the provided TTL.
	ExpireOlderThan(time.Duration) error

	// Shutdown closes the database connection and deletes the store.
	Shutdown() error

	// GetResourceHealth checks health statuses of provided resources.
	GetResourceHealth(resources []unstructured.Unstructured) (hasPendingResources, hasFailedResources bool, err error)

	// GetHookComponents returns all hook components with a deletion policy that belong to the specified service.
	GetHookComponents(serviceID string) ([]smcommon.HookComponent, error)

	// SaveHookComponentWithManifestSHA saves the hook component with manifest SHA in the store.
	SaveHookComponentWithManifestSHA(manifest, appliedResource unstructured.Unstructured) error

	// ExpireHookComponents removes all hook components that belong to the specified service from the store.
	ExpireHookComponents(serviceID string) error

	// SetServiceChildren sets the children of a service based on the provided parent UID and keys.
	SetServiceChildren(serviceID, parentUID string, keys []smcommon.StoreKey) (int, error)
}

func NewDatabaseStore

func NewDatabaseStore(ctx context.Context, options ...Option) (Store, error)

func NewLocalProfiledStore

func NewLocalProfiledStore(inner Store) Store

func NewProfiledStore

func NewProfiledStore(inner Store) Store

NewProfiledStore wraps the provided Store with Datadog tracing. If inner is nil it returns nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL