Documentation
¶
Index ¶
- type CountByRolloutStatusResult
- type FleetApplyFunc
- type FleetMutation
- type FleetStore
- func (s *FleetStore) CountByRolloutStatus(ctx context.Context, orgId *uuid.UUID, _ *string) ([]CountByRolloutStatusResult, error)
- func (s *FleetStore) Create(ctx context.Context, orgId uuid.UUID, fleet *domain.Fleet) (*domain.Fleet, error)
- func (s *FleetStore) Delete(ctx context.Context, orgId uuid.UUID, name string, ...) error
- func (s *FleetStore) Get(ctx context.Context, orgId uuid.UUID, name string, opts ...GetOption) (*domain.Fleet, error)
- func (s *FleetStore) GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.RepositoryList, error)
- func (s *FleetStore) InitialMigration(ctx context.Context) error
- func (s *FleetStore) List(ctx context.Context, orgId uuid.UUID, listParams store.ListParams, ...) (*domain.FleetList, error)
- func (s *FleetStore) ListDisruptionBudgetFleets(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)
- func (s *FleetStore) ListFleetsByAppCatalogItemRef(ctx context.Context, orgId uuid.UUID, catalog string, item string, ...) (*domain.FleetList, error)
- func (s *FleetStore) ListFleetsByOsCatalogItemRef(ctx context.Context, orgId uuid.UUID, catalog string, item string, ...) (*domain.FleetList, error)
- func (s *FleetStore) ListFleetsByVolumeCatalogItemRef(ctx context.Context, orgId uuid.UUID, catalog string, item string, ...) (*domain.FleetList, error)
- func (s *FleetStore) ListIgnoreOrg(ctx context.Context) ([]model.Fleet, error)
- func (s *FleetStore) ListRolloutDeviceSelection(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)
- func (s *FleetStore) Mutate(ctx context.Context, orgId uuid.UUID, name string, previous *domain.Fleet, ...) (*domain.Fleet, *domain.Fleet, bool, error)
- func (s *FleetStore) OverwriteRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string, repositoryNames ...string) error
- func (s *FleetStore) UnsetOwner(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, owner string) error
- func (s *FleetStore) UnsetOwnerByKind(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, resourceKind string) error
- func (s *FleetStore) Update(ctx context.Context, orgId uuid.UUID, before, fleet *domain.Fleet) (bool, error)
- func (s *FleetStore) UpdateAnnotations(ctx context.Context, orgId uuid.UUID, name string, ...) (*domain.Fleet, *domain.Fleet, error)
- func (s *FleetStore) UpdateStatus(ctx context.Context, orgId uuid.UUID, fleet *domain.Fleet) (*domain.Fleet, *domain.Fleet, error)
- type GetOption
- type ListOption
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CountByRolloutStatusResult ¶
CountByRolloutStatusResult holds the result of the group by query for fleet rollout status.
type FleetApplyFunc ¶
type FleetApplyFunc func(m *FleetMutation) error
FleetApplyFunc mutates m in place on every Mutate attempt.
type FleetMutation ¶
FleetMutation is the unit apply mutates. Handlers decide all field changes. Fleet is nil on the create path until apply assigns it.
func (*FleetMutation) Clone ¶
func (m *FleetMutation) Clone() (store.ResourceMutation[domain.Fleet], error)
func (*FleetMutation) RequireExisting ¶
func (m *FleetMutation) RequireExisting() error
RequireExisting returns ErrResourceNotFound when Fleet is nil (create path). Update-only callers should invoke this at the start of apply.
func (*FleetMutation) Resource ¶
func (m *FleetMutation) Resource() *domain.Fleet
func (*FleetMutation) SetResource ¶
func (m *FleetMutation) SetResource(fleet *domain.Fleet)
type FleetStore ¶
type FleetStore struct {
// contains filtered or unexported fields
}
func (*FleetStore) CountByRolloutStatus ¶
func (s *FleetStore) CountByRolloutStatus(ctx context.Context, orgId *uuid.UUID, _ *string) ([]CountByRolloutStatusResult, error)
CountByRolloutStatus returns the count of fleets grouped by org_id and rollout status.
func (*FleetStore) Create ¶
func (s *FleetStore) Create(ctx context.Context, orgId uuid.UUID, fleet *domain.Fleet) (*domain.Fleet, error)
Create inserts a fleet. No events; callers fire their own callbacks.
func (*FleetStore) Delete ¶
func (s *FleetStore) Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback store.EventCallback) error
func (*FleetStore) GetRepositoryRefs ¶
func (s *FleetStore) GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.RepositoryList, error)
func (*FleetStore) InitialMigration ¶
func (s *FleetStore) InitialMigration(ctx context.Context) error
func (*FleetStore) List ¶
func (s *FleetStore) List(ctx context.Context, orgId uuid.UUID, listParams store.ListParams, opts ...ListOption) (*domain.FleetList, error)
func (*FleetStore) ListDisruptionBudgetFleets ¶
func (s *FleetStore) ListDisruptionBudgetFleets(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)
ListDisruptionBudgetFleets attempts to get fleets for disruption budget. Since the disruption budget acts like a gate to device rendering, the query searches for fleets that each contains at least 1 device that has different value set between tha annotation 'device-controller/templateVersion' which is set before rollout and 'device-controller/renderedTemplateVersion' which is set after rollout.
func (*FleetStore) ListFleetsByAppCatalogItemRef ¶
func (*FleetStore) ListFleetsByOsCatalogItemRef ¶
func (*FleetStore) ListFleetsByVolumeCatalogItemRef ¶
func (*FleetStore) ListIgnoreOrg ¶
func (*FleetStore) ListRolloutDeviceSelection ¶
func (s *FleetStore) ListRolloutDeviceSelection(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)
ListRolloutDeviceSelection attempts to get all relevant fleets for rollout device selection. A relevant fleet contains at least 1 device that at least one of the conditions below is true: - marked as selected for rollout - the template version of the fleet is not the same the template version in the annotation 'device-controller/renderedTemplateVersion' - the field 'status.config.renderedVersion' is not the same as the annotation 'device-controller/renderedVersion'
func (*FleetStore) Mutate ¶
func (s *FleetStore) Mutate(ctx context.Context, orgId uuid.UUID, name string, previous *domain.Fleet, apply FleetApplyFunc) (*domain.Fleet, *domain.Fleet, bool, error)
Mutate loads the named fleet (or uses previous on the first attempt), runs apply, and persists via GenericStore.Mutate using Create / Update. Missing fleets are created (apply must set Fleet); existing ones are updated. The caller is responsible for firing any event callback using the returned before/updated/created values.
func (*FleetStore) OverwriteRepositoryRefs ¶
func (*FleetStore) UnsetOwner ¶
func (*FleetStore) UnsetOwnerByKind ¶
func (*FleetStore) Update ¶
func (s *FleetStore) Update(ctx context.Context, orgId uuid.UUID, before, fleet *domain.Fleet) (bool, error)
Update writes a fleet update. Returns retry=true on lost optimistic lock / deadlock.
type ListOption ¶
type ListOption func(*listOptions)
func ListWithDevicesSummary ¶
func ListWithDevicesSummary(val bool) ListOption
type Store ¶
type Store interface {
InitialMigration(ctx context.Context) error
// Create inserts a fleet. Duplicate names return ErrDuplicateName.
// No events; the caller fires its own callback.
Create(ctx context.Context, orgId uuid.UUID, fleet *domain.Fleet) (*domain.Fleet, error)
// Mutate loads (or uses previous once), runs apply, and persists via Create / Update.
// If the fleet does not exist, m.Fleet is nil and apply must assign it (create);
// otherwise apply mutates a clone. Returns created and the pre-mutation snapshot so
// the caller can fire its own event callback; Mutate itself never calls one.
// Create-only API callers should use Create instead. Update-only callers should call
// m.RequireExisting() in apply.
Mutate(ctx context.Context, orgId uuid.UUID, name string, previous *domain.Fleet, apply FleetApplyFunc) (updated *domain.Fleet, before *domain.Fleet, created bool, err error)
// UpdateStatus sets fleet.Status via Mutate. No events; the caller fires its own callback.
UpdateStatus(ctx context.Context, orgId uuid.UUID, fleet *domain.Fleet) (updated *domain.Fleet, before *domain.Fleet, err error)
// UpdateAnnotations merges annotations (and applies deleteKeys) via Mutate.
// No events; the caller fires its own callback using before/updated.
UpdateAnnotations(ctx context.Context, orgId uuid.UUID, name string, annotations map[string]string, deleteKeys []string) (updated *domain.Fleet, before *domain.Fleet, err error)
Get(ctx context.Context, orgId uuid.UUID, name string, opts ...GetOption) (*domain.Fleet, error)
List(ctx context.Context, orgId uuid.UUID, listParams store.ListParams, opts ...ListOption) (*domain.FleetList, error)
Delete(ctx context.Context, orgId uuid.UUID, name string, eventCallback store.EventCallback) error
ListRolloutDeviceSelection(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)
ListDisruptionBudgetFleets(ctx context.Context, orgId uuid.UUID) (*domain.FleetList, error)
UnsetOwner(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, owner string) error
UnsetOwnerByKind(ctx context.Context, tx *gorm.DB, orgId uuid.UUID, resourceKind string) error
OverwriteRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string, repositoryNames ...string) error
GetRepositoryRefs(ctx context.Context, orgId uuid.UUID, name string) (*domain.RepositoryList, error)
// Used by catalog
ListFleetsByOsCatalogItemRef(ctx context.Context, orgId uuid.UUID, catalog string, item string, listParams store.ListParams) (*domain.FleetList, error)
ListFleetsByAppCatalogItemRef(ctx context.Context, orgId uuid.UUID, catalog string, item string, listParams store.ListParams) (*domain.FleetList, error)
ListFleetsByVolumeCatalogItemRef(ctx context.Context, orgId uuid.UUID, catalog string, item string, listParams store.ListParams) (*domain.FleetList, error)
// Used by domain metrics
CountByRolloutStatus(ctx context.Context, orgId *uuid.UUID, _ *string) ([]CountByRolloutStatusResult, error)
}
func NewFleetStore ¶
func NewFleetStore(db *gorm.DB, log logrus.FieldLogger) Store