dependencyref

package
v1.4.0-main Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DependencyRefStore

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

func (*DependencyRefStore) BulkUpsertDeviceRefs

func (s *DependencyRefStore) BulkUpsertDeviceRefs(ctx context.Context, orgID uuid.UUID, refs []model.DependencyRef) error

BulkUpsertDeviceRefs inserts device-level dependency refs, updating the revision and resource_key on conflict. Used by fleet rollout to populate refs for parameterized git revisions after template resolution.

func (*DependencyRefStore) DeleteByDevice

func (s *DependencyRefStore) DeleteByDevice(ctx context.Context, orgID uuid.UUID, deviceName string) error

DeleteByDevice removes all dependency refs where device_name matches, regardless of fleet_name. This handles both standalone refs and fleet-rollout refs created for parameterized revisions.

func (*DependencyRefStore) DeleteByFleet

func (s *DependencyRefStore) DeleteByFleet(ctx context.Context, orgID uuid.UUID, fleetName string) error

func (*DependencyRefStore) InitialMigration

func (s *DependencyRefStore) InitialMigration(ctx context.Context) error

func (*DependencyRefStore) ListByRefType

func (s *DependencyRefStore) ListByRefType(ctx context.Context, orgID uuid.UUID, refType string) ([]model.DependencyRef, error)

func (*DependencyRefStore) ListDueGitDependencies

func (s *DependencyRefStore) ListDueGitDependencies(ctx context.Context, orgID uuid.UUID, pollInterval time.Duration) ([]model.GitDependencyProbe, error)

ListDueGitDependencies returns git dependency probes that are due for polling. It LEFT JOINs dependency_refs with sync_states so that refs without a sync state row (never polled) are included, filters out parameterized revisions, applies the poll-interval time gate, and groups by (repository_name, revision) with array_agg for fan-out targets.

func (*DependencyRefStore) ListDueHttpDependencies

func (s *DependencyRefStore) ListDueHttpDependencies(ctx context.Context, orgID uuid.UUID, pollInterval time.Duration) ([]model.HttpDependencyProbe, error)

ListDueHttpDependencies returns HTTP dependency probes that are due for polling. Mirrors ListDueGitDependencies but filters by ref_type='http' and groups by (repository_name, http_suffix).

func (*DependencyRefStore) ListSecretDependencyTargets

func (s *DependencyRefStore) ListSecretDependencyTargets(ctx context.Context, secretNamespace, secretName, newFingerprint string) ([]model.SecretDependencyRef, error)

ListSecretDependencyTargets returns flat rows of (orgID, fleetName, deviceName) for all dependency_refs matching the given secret where the stored fingerprint differs from newFingerprint (or no fingerprint exists yet).

func (*DependencyRefStore) ReplaceByFleet

func (s *DependencyRefStore) ReplaceByFleet(ctx context.Context, orgID uuid.UUID, fleetName string, refs []model.DependencyRef) error

ReplaceByFleet atomically replaces fleet-level dependency refs (device_name = ”). Device-level refs (populated during fleet rollout) are left untouched.

func (*DependencyRefStore) ReplaceByFleetDevice

func (s *DependencyRefStore) ReplaceByFleetDevice(ctx context.Context, orgID uuid.UUID, fleetName, deviceName string, refs []model.DependencyRef) error

ReplaceByFleetDevice atomically replaces device-level dependency refs for a single device within a fleet. Used by the device-event rollout path so that stale refs are cleaned when a device's resolved revision changes.

func (*DependencyRefStore) ReplaceByStandaloneDevice

func (s *DependencyRefStore) ReplaceByStandaloneDevice(ctx context.Context, orgID uuid.UUID, deviceName string, refs []model.DependencyRef) error

ReplaceByStandaloneDevice atomically replaces all dependency refs for a standalone device (fleet_name = ”, device_name = deviceName).

func (*DependencyRefStore) ReplaceDeviceRefsByFleet

func (s *DependencyRefStore) ReplaceDeviceRefsByFleet(ctx context.Context, orgID uuid.UUID, fleetName string, refs []model.DependencyRef) error

ReplaceDeviceRefsByFleet atomically replaces all device-level dependency refs for a fleet. Fleet-level refs (device_name = ”) are left untouched.

func (*DependencyRefStore) ReplaceFleetScopedDeviceRefs

func (s *DependencyRefStore) ReplaceFleetScopedDeviceRefs(ctx context.Context, orgID uuid.UUID, deviceName string, refs []model.DependencyRef) error

ReplaceFleetScopedDeviceRefs atomically replaces all fleet-scoped refs for a device (any fleet). Used by RolloutDevice to handle fleet-move scenarios where the device's old-fleet refs must be cleaned alongside inserting new-fleet refs. Standalone refs (fleet_name=”) are left untouched.

func (*DependencyRefStore) Upsert

func (s *DependencyRefStore) Upsert(ctx context.Context, orgID uuid.UUID, ref *model.DependencyRef) error

type Store

type Store interface {
	InitialMigration(ctx context.Context) error
	Upsert(ctx context.Context, orgID uuid.UUID, ref *model.DependencyRef) error
	ListByRefType(ctx context.Context, orgID uuid.UUID, refType string) ([]model.DependencyRef, error)
	DeleteByFleet(ctx context.Context, orgID uuid.UUID, fleetName string) error
	DeleteByDevice(ctx context.Context, orgID uuid.UUID, deviceName string) error
	ReplaceByFleet(ctx context.Context, orgID uuid.UUID, fleetName string, refs []model.DependencyRef) error
	ReplaceDeviceRefsByFleet(ctx context.Context, orgID uuid.UUID, fleetName string, refs []model.DependencyRef) error
	ReplaceByFleetDevice(ctx context.Context, orgID uuid.UUID, fleetName, deviceName string, refs []model.DependencyRef) error
	ReplaceFleetScopedDeviceRefs(ctx context.Context, orgID uuid.UUID, deviceName string, refs []model.DependencyRef) error
	ReplaceByStandaloneDevice(ctx context.Context, orgID uuid.UUID, deviceName string, refs []model.DependencyRef) error
	BulkUpsertDeviceRefs(ctx context.Context, orgID uuid.UUID, refs []model.DependencyRef) error
	ListDueGitDependencies(ctx context.Context, orgID uuid.UUID, pollInterval time.Duration) ([]model.GitDependencyProbe, error)
	ListDueHttpDependencies(ctx context.Context, orgID uuid.UUID, pollInterval time.Duration) ([]model.HttpDependencyProbe, error)
	ListSecretDependencyTargets(ctx context.Context, secretNamespace, secretName, newFingerprint string) ([]model.SecretDependencyRef, error)
}

func NewDependencyRefStore

func NewDependencyRefStore(db *gorm.DB, log logrus.FieldLogger) Store

Jump to

Keyboard shortcuts

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