store

package
v1.2.0-main Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteTestDB

func DeleteTestDB(ctx context.Context, log *logrus.Logger, cfg *config.Config, store Store, dbName string)

DeleteTestDB drops the test database

func ImageBuildAPIVersion

func ImageBuildAPIVersion() string

func ImageBuildsToApiResource

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

func ImageBuildsToApiResourceWithOptions

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

func ImageExportAPIVersion

func ImageExportAPIVersion() string

func ImageExportsToApiResource

func ImageExportsToApiResource(imageExports []ImageExport, cont *string, numRemaining *int64) (api.ImageExportList, 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[api.ImageBuildSpec] `gorm:"type:jsonb"`

	// The last reported state, stored as opaque JSON object.
	Status *model.JSONField[api.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 NewImageBuildFromApiResource

func NewImageBuildFromApiResource(resource *api.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) ToApiResource

func (i *ImageBuild) ToApiResource(opts ...ImageBuildAPIResourceOption) (*api.ImageBuild, error)

type ImageBuildAPIResourceOption

type ImageBuildAPIResourceOption func(*imageBuildAPIResourceOptions)

func WithImageExports

func WithImageExports(imageExports []api.ImageExport) ImageBuildAPIResourceOption

type ImageBuildStore

type ImageBuildStore interface {
	Create(ctx context.Context, orgId uuid.UUID, imageBuild *api.ImageBuild) (*api.ImageBuild, error)
	Get(ctx context.Context, orgId uuid.UUID, name string, opts ...GetOption) (*api.ImageBuild, error)
	List(ctx context.Context, orgId uuid.UUID, listParams flightctlstore.ListParams, opts ...ListOption) (*api.ImageBuildList, error)
	Delete(ctx context.Context, orgId uuid.UUID, name string) (*api.ImageBuild, error)
	UpdateStatus(ctx context.Context, orgId uuid.UUID, imageBuild *api.ImageBuild) (*api.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[api.ImageExportSpec] `gorm:"type:jsonb"`

	// The last reported state, stored as opaque JSON object.
	Status *model.JSONField[api.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 NewImageExportFromApiResource

func NewImageExportFromApiResource(resource *api.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) ToApiResource

func (i *ImageExport) ToApiResource() (*api.ImageExport, error)

type ImageExportStore

type ImageExportStore interface {
	Create(ctx context.Context, orgId uuid.UUID, imageExport *api.ImageExport) (*api.ImageExport, error)
	Get(ctx context.Context, orgId uuid.UUID, name string) (*api.ImageExport, error)
	List(ctx context.Context, orgId uuid.UUID, listParams flightctlstore.ListParams) (*api.ImageExportList, error)
	Delete(ctx context.Context, orgId uuid.UUID, name string) (*api.ImageExport, error)
	UpdateStatus(ctx context.Context, orgId uuid.UUID, imageExport *api.ImageExport) (*api.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 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
	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

func PrepareDBForUnitTests

func PrepareDBForUnitTests(ctx context.Context, log *logrus.Logger) (Store, *config.Config, string, *gorm.DB)

PrepareDBForUnitTests creates a temporary test database for unit testing

Jump to

Keyboard shortcuts

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