store

package
v1.3.0-main Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImageBuildAPIVersion

func ImageBuildAPIVersion() string

func ImageBuildsToDomain

func ImageBuildsToDomain(imageBuilds []ImageBuild, cont *string, numRemaining *int64) (domain.ImageBuildList, error)

func ImageBuildsToDomainWithOptions

func ImageBuildsToDomainWithOptions(imageBuilds []ImageBuild, cont *string, numRemaining *int64, imageExportsMap map[string][]domain.ImageExport) (domain.ImageBuildList, error)

func ImageExportAPIVersion

func ImageExportAPIVersion() string

func ImageExportsToDomain

func ImageExportsToDomain(imageExports []ImageExport, cont *string, numRemaining *int64) (domain.ImageExportList, error)

func ImagePromotionAPIVersion added in v1.2.0

func ImagePromotionAPIVersion() string

func ImagePromotionsToDomain added in v1.2.0

func ImagePromotionsToDomain(pubs []ImagePromotion, cont *string, numRemaining *int64) (domain.ImagePromotionList, error)

func TxFromContext

func TxFromContext(ctx context.Context) *gorm.DB

TxFromContext retrieves a transaction from context, or nil if none exists

func WithTx

func WithTx(ctx context.Context, tx *gorm.DB) context.Context

WithTx returns a new context with the given transaction attached

Types

type GetOption

type GetOption func(*GetOptions)

func GetWithExports

func GetWithExports(val bool) GetOption

type GetOptions

type GetOptions struct {
	WithExports bool
}

type ImageBuild

type ImageBuild struct {
	model.Resource

	// The desired state, stored as opaque JSON object.
	Spec *model.JSONField[domain.ImageBuildSpec] `gorm:"type:jsonb"`

	// The last reported state, stored as opaque JSON object.
	Status *model.JSONField[domain.ImageBuildStatus] `gorm:"type:jsonb"`

	// Logs contains the last 500 lines of build logs for completed builds.
	// This is separate from Status to keep the ImageBuild resource lightweight.
	// Logs are only accessible via the /log endpoint.
	Logs *string `gorm:"type:text"`
}

func NewImageBuildFromDomain

func NewImageBuildFromDomain(resource *domain.ImageBuild) (*ImageBuild, error)

func (*ImageBuild) GetKind

func (i *ImageBuild) GetKind() string

func (*ImageBuild) GetStatusAsJson

func (i *ImageBuild) GetStatusAsJson() ([]byte, error)

func (*ImageBuild) HasNilSpec

func (i *ImageBuild) HasNilSpec() bool

func (*ImageBuild) HasSameSpecAs

func (i *ImageBuild) HasSameSpecAs(otherResource any) bool

func (*ImageBuild) ListSelectors

func (i *ImageBuild) ListSelectors() selector.SelectorNameSet

ListSelectors returns all available field selectors for ImageBuild

func (*ImageBuild) ResolveSelector

func (i *ImageBuild) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)

ResolveSelector resolves a field selector name to a SelectorField for ImageBuild

func (ImageBuild) String

func (i ImageBuild) String() string

func (*ImageBuild) ToDomain

func (i *ImageBuild) ToDomain(opts ...ImageBuildDomainOption) (*domain.ImageBuild, error)

type ImageBuildDomainOption

type ImageBuildDomainOption func(*imageBuildDomainOptions)

func WithImageExports

func WithImageExports(imageExports []domain.ImageExport) ImageBuildDomainOption

type ImageBuildStore

type ImageBuildStore interface {
	Create(ctx context.Context, orgId uuid.UUID, imageBuild *domain.ImageBuild) (*domain.ImageBuild, error)
	Get(ctx context.Context, orgId uuid.UUID, name string, opts ...GetOption) (*domain.ImageBuild, error)
	List(ctx context.Context, orgId uuid.UUID, listParams flightctlstore.ListParams, opts ...ListOption) (*domain.ImageBuildList, error)
	Delete(ctx context.Context, orgId uuid.UUID, name string) (*domain.ImageBuild, error)
	UpdateStatus(ctx context.Context, orgId uuid.UUID, imageBuild *domain.ImageBuild) (*domain.ImageBuild, error)
	UpdateLastSeen(ctx context.Context, orgId uuid.UUID, name string, timestamp time.Time) error
	UpdateLogs(ctx context.Context, orgId uuid.UUID, name string, logs string) error
	GetLogs(ctx context.Context, orgId uuid.UUID, name string) (string, error)
	InitialMigration(ctx context.Context) error
}

ImageBuildStore is the store interface for ImageBuild resources

func NewImageBuildStore

func NewImageBuildStore(db *gorm.DB, log logrus.FieldLogger) ImageBuildStore

NewImageBuildStore creates a new ImageBuild store

type ImageExport

type ImageExport struct {
	model.Resource

	// The desired state, stored as opaque JSON object.
	Spec *model.JSONField[domain.ImageExportSpec] `gorm:"type:jsonb"`

	// The last reported state, stored as opaque JSON object.
	Status *model.JSONField[domain.ImageExportStatus] `gorm:"type:jsonb"`

	// Logs contains the last 500 lines of export logs for completed exports.
	// This is separate from Status to keep the ImageExport resource lightweight.
	// Logs are only accessible via the /log endpoint.
	Logs *string `gorm:"type:text"`
}

ImageExport model

func NewImageExportFromDomain

func NewImageExportFromDomain(resource *domain.ImageExport) (*ImageExport, error)

func (*ImageExport) GetKind

func (i *ImageExport) GetKind() string

func (*ImageExport) GetStatusAsJson

func (i *ImageExport) GetStatusAsJson() ([]byte, error)

func (*ImageExport) HasNilSpec

func (i *ImageExport) HasNilSpec() bool

func (*ImageExport) HasSameSpecAs

func (i *ImageExport) HasSameSpecAs(otherResource any) bool

func (*ImageExport) ListSelectors

func (i *ImageExport) ListSelectors() selector.SelectorNameSet

ListSelectors returns all available field selectors for ImageExport

func (*ImageExport) ResolveSelector

func (i *ImageExport) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)

ResolveSelector resolves a field selector name to a SelectorField for ImageExport

func (ImageExport) String

func (i ImageExport) String() string

func (*ImageExport) ToDomain

func (i *ImageExport) ToDomain() (*domain.ImageExport, error)

type ImageExportStore

type ImageExportStore interface {
	Create(ctx context.Context, orgId uuid.UUID, imageExport *domain.ImageExport) (*domain.ImageExport, error)
	Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.ImageExport, error)
	List(ctx context.Context, orgId uuid.UUID, listParams flightctlstore.ListParams) (*domain.ImageExportList, error)
	Delete(ctx context.Context, orgId uuid.UUID, name string) (*domain.ImageExport, error)
	UpdateStatus(ctx context.Context, orgId uuid.UUID, imageExport *domain.ImageExport) (*domain.ImageExport, error)
	UpdateLastSeen(ctx context.Context, orgId uuid.UUID, name string, timestamp time.Time) error
	UpdateLogs(ctx context.Context, orgId uuid.UUID, name string, logs string) error
	GetLogs(ctx context.Context, orgId uuid.UUID, name string) (string, error)
	InitialMigration(ctx context.Context) error
}

ImageExportStore is the store interface for ImageExport resources

func NewImageExportStore

func NewImageExportStore(db *gorm.DB, log logrus.FieldLogger) ImageExportStore

NewImageExportStore creates a new ImageExport store

type ImagePromotion added in v1.2.0

type ImagePromotion struct {
	model.Resource

	// The desired state, stored as opaque JSON object.
	Spec *model.JSONField[domain.ImagePromotionSpec] `gorm:"type:jsonb"`

	// The last reported state, stored as opaque JSON object.
	Status *model.JSONField[domain.ImagePromotionStatus] `gorm:"type:jsonb"`
}

func NewImagePromotionFromDomain added in v1.2.0

func NewImagePromotionFromDomain(resource *domain.ImagePromotion) (*ImagePromotion, error)

func (*ImagePromotion) GetKind added in v1.2.0

func (i *ImagePromotion) GetKind() string

func (*ImagePromotion) GetStatusAsJson added in v1.2.0

func (i *ImagePromotion) GetStatusAsJson() ([]byte, error)

func (*ImagePromotion) HasNilSpec added in v1.2.0

func (i *ImagePromotion) HasNilSpec() bool

func (*ImagePromotion) HasSameSpecAs added in v1.2.0

func (i *ImagePromotion) HasSameSpecAs(otherResource any) bool

func (*ImagePromotion) ListSelectors added in v1.2.0

func (i *ImagePromotion) ListSelectors() selector.SelectorNameSet

ListSelectors returns all available field selectors for ImagePromotion

func (*ImagePromotion) ResolveSelector added in v1.2.0

func (i *ImagePromotion) ResolveSelector(name selector.SelectorName) (*selector.SelectorField, error)

ResolveSelector resolves a field selector name to a SelectorField for ImagePromotion

func (ImagePromotion) String added in v1.2.0

func (i ImagePromotion) String() string

func (*ImagePromotion) ToDomain added in v1.2.0

func (i *ImagePromotion) ToDomain() (*domain.ImagePromotion, error)

type ImagePromotionStore added in v1.2.0

type ImagePromotionStore interface {
	Create(ctx context.Context, orgId uuid.UUID, pub *domain.ImagePromotion) (*domain.ImagePromotion, error)
	Get(ctx context.Context, orgId uuid.UUID, name string) (*domain.ImagePromotion, error)
	List(ctx context.Context, orgId uuid.UUID, listParams flightctlstore.ListParams) (*domain.ImagePromotionList, error)
	Delete(ctx context.Context, orgId uuid.UUID, name string) (*domain.ImagePromotion, error)
	// Update updates the spec, labels, and status of an ImagePromotion atomically.
	// Used for PATCH/PUT operations that add new export formats.
	Update(ctx context.Context, orgId uuid.UUID, pub *domain.ImagePromotion) (*domain.ImagePromotion, error)
	UpdateStatus(ctx context.Context, orgId uuid.UUID, pub *domain.ImagePromotion) (*domain.ImagePromotion, error)
	// ListPendingForBuild returns all WaitingForArtifacts and AmendmentFailed promotions for the given imageBuildRef.
	// Used to re-evaluate promotions when an ImageBuild or ImageExport status changes.
	ListPendingForBuild(ctx context.Context, orgId uuid.UUID, imageBuildRef string) ([]domain.ImagePromotion, error)
	InitialMigration(ctx context.Context) error
}

ImagePromotionStore is the store interface for ImagePromotion resources

func NewImagePromotionStore added in v1.2.0

func NewImagePromotionStore(db *gorm.DB, log logrus.FieldLogger) ImagePromotionStore

NewImagePromotionStore creates a new ImagePromotion store

type ListOption

type ListOption func(*ListOptions)

func ListWithExports

func ListWithExports(val bool) ListOption

type ListOptions

type ListOptions struct {
	WithExports bool
}

type Store

type Store interface {
	ImageBuild() ImageBuildStore
	ImageExport() ImageExportStore
	ImagePromotion() ImagePromotionStore
	RunMigrations(ctx context.Context) error
	Ping() error
	Close() error
}

Store is the imagebuilder-specific store interface

func NewStore

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

NewStore creates a new imagebuilder store

Jump to

Keyboard shortcuts

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