store

package
v0.0.0-...-0c11bd6 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package store contains primitives for representing and changing the osbuild-composer state.

Index

Constants

View Source
const StoreDBName = "state"

StoreDBName is the name under which to save the store to the underlying jsondb

Variables

This section is empty.

Functions

This section is empty.

Types

type Compose

type Compose struct {
	Blueprint  *blueprint.Blueprint
	ImageBuild ImageBuild
	Packages   []rpmmd.PackageSpec
}

A Compose represent the task of building a set of images from a single blueprint. It contains all the information necessary to generate the inputs for the job, as well as the job's state.

func (*Compose) DeepCopy

func (c *Compose) DeepCopy() Compose

DeepCopy creates a copy of the Compose structure

type Fixture

type Fixture struct {
	*Store
	Cleanup func()
	*distrofactory.Factory
	HostDistroName string
	HostArchName   string
}

func FixtureBase

func FixtureBase(hostDistroName, hostArchName string) *Fixture

func FixtureEmpty

func FixtureEmpty(hostDistroName, hostArchName string) *Fixture

func FixtureFinished

func FixtureFinished(hostDistroName, hostArchName string) *Fixture

func FixtureJobs

func FixtureJobs(hostDistroName, hostArchName string) *Fixture

Fixture to use for checking job queue files

func FixtureOldChanges

func FixtureOldChanges(hostDistroName, hostArchName string) *Fixture

FixtureOldChanges contains a blueprint and old changes This simulates restarting the service and losing the old blueprints

type ImageBuild

type ImageBuild struct {
	ID          int
	ImageType   distro.ImageType
	Manifest    manifest.OSBuildManifest
	Targets     []*target.Target
	JobCreated  time.Time
	JobStarted  time.Time
	JobFinished time.Time
	Size        uint64
	JobID       uuid.UUID
	// Kept for backwards compatibility. Image builds which were done
	// before the move to the job queue use this to store whether they
	// finished successfully.
	QueueStatus common.ImageBuildState
}

ImageBuild represents a single image build inside a compose

func (*ImageBuild) DeepCopy

func (ib *ImageBuild) DeepCopy() ImageBuild

DeepCopy creates a copy of the ImageBuild structure

type NoLocalTargetError

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

func (*NoLocalTargetError) Error

func (e *NoLocalTargetError) Error() string

type NotFoundError

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type SourceConfig

type SourceConfig struct {
	Name           string   `json:"name" toml:"name"`
	Type           string   `json:"type" toml:"type"`
	URL            string   `json:"url" toml:"url"`
	CheckGPG       bool     `json:"check_gpg" toml:"check_gpg"`
	CheckSSL       bool     `json:"check_ssl" toml:"check_ssl"`
	System         bool     `json:"system" toml:"system"`
	Distros        []string `json:"distros" toml:"distros"`
	RHSM           bool     `json:"rhsm" toml:"rhsm"`
	CheckRepoGPG   bool     `json:"check_repogpg" toml:"check_repogpg"`
	GPGKeys        []string `json:"gpgkeys"`
	ModuleHotfixes *bool    `json:"module_hotfixes,omitempty"`
}

func NewSourceConfig

func NewSourceConfig(repo rpmmd.RepoConfig, system bool) SourceConfig

func (*SourceConfig) RepoConfig

func (s *SourceConfig) RepoConfig(name string) rpmmd.RepoConfig

type StateTransitionError

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

func (*StateTransitionError) Error

func (ste *StateTransitionError) Error() string

type Store

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

A Store contains all the persistent state of osbuild-composer, and is serialized on every change, and deserialized on start.

blueprints contain the most recent blueprint, using the name as the key

blueprintsCommits contains the order of the commits to a blueprint name as a string of hashes with the most recent one last.

blueprintsChanges contains the blueprint change, using the blueprint name string and the hash string from blueprintsCommits

func New

func New(stateDir *string, df *distrofactory.Factory, log *log.Logger) *Store

func (*Store) DeleteBlueprint

func (s *Store) DeleteBlueprint(name string) error

DeleteBlueprint will remove the named blueprint from the store if the blueprint does not exist it will return an error The workspace copy is deleted unconditionally, it will not return an error if it does not exist.

func (*Store) DeleteBlueprintFromWorkspace

func (s *Store) DeleteBlueprintFromWorkspace(name string) error

DeleteBlueprintFromWorkspace deletes the workspace copy of a blueprint if the blueprint doesn't exist in the workspace it returns an error

func (*Store) DeleteCompose

func (s *Store) DeleteCompose(id uuid.UUID) error

DeleteCompose deletes the compose from the state file and also removes all files on disk that are associated with this compose

func (*Store) DeleteSourceByID

func (s *Store) DeleteSourceByID(key string)

DeleteSourceByID removes a SourceConfig from store.Sources using the ID

func (*Store) DeleteSourceByName

func (s *Store) DeleteSourceByName(name string)

DeleteSourceByName removes a SourceConfig from store.Sources using the .Name field

func (*Store) GetAllComposes

func (s *Store) GetAllComposes() map[uuid.UUID]Compose

GetAllComposes creates a deep copy of all composes present in this store and returns them as a dictionary with compose UUIDs as keys

func (*Store) GetAllDistroSources

func (s *Store) GetAllDistroSources(distro string) map[string]SourceConfig

GetAllDistroSources returns the sources using the repo id as the key skipping sources that cannot be used with the selected distribution

func (*Store) GetAllSourcesByID

func (s *Store) GetAllSourcesByID() map[string]SourceConfig

GetAllSourcesByID returns the sources using the repo id as the key

func (*Store) GetAllSourcesByName

func (s *Store) GetAllSourcesByName() map[string]SourceConfig

GetAllSourcesByName returns the sources using the repo name as the key

func (*Store) GetBlueprint

func (s *Store) GetBlueprint(name string) (*blueprint.Blueprint, bool)

func (*Store) GetBlueprintChange

func (s *Store) GetBlueprintChange(name string, commit string) (*blueprint.Change, error)

GetBlueprintChange returns a specific change to a blueprint If the blueprint or change do not exist then an error is returned

func (*Store) GetBlueprintChanges

func (s *Store) GetBlueprintChanges(name string) []blueprint.Change

GetBlueprintChanges returns the list of changes, oldest first

func (*Store) GetBlueprintCommitted

func (s *Store) GetBlueprintCommitted(name string) *blueprint.Blueprint

func (*Store) GetCompose

func (s *Store) GetCompose(id uuid.UUID) (Compose, bool)

func (*Store) GetSource

func (s *Store) GetSource(name string) *SourceConfig

func (*Store) ListBlueprints

func (s *Store) ListBlueprints() []string

func (*Store) ListSourcesById

func (s *Store) ListSourcesById() []string

ListSourcesById returns the repo source id Id is a short identifier for the repo, not a full name description

func (*Store) ListSourcesByName

func (s *Store) ListSourcesByName() []string

ListSourcesByName returns the repo source names Name is different than Id, it can be a full description of the repo

func (*Store) PushBlueprint

func (s *Store) PushBlueprint(bp blueprint.Blueprint, commitMsg string) error

func (*Store) PushBlueprintToWorkspace

func (s *Store) PushBlueprintToWorkspace(bp blueprint.Blueprint) error

func (*Store) PushCompose

func (s *Store) PushCompose(composeID uuid.UUID,
	manifest manifest.OSBuildManifest,
	imageType distro.ImageType,
	bp *blueprint.Blueprint,
	size uint64,
	targets []*target.Target,
	jobId uuid.UUID,
	packages []rpmmd.PackageSpec) error

func (*Store) PushSource

func (s *Store) PushSource(key string, source SourceConfig)

PushSource stores a SourceConfig in store.Sources

func (*Store) PushTestCompose

func (s *Store) PushTestCompose(composeID uuid.UUID,
	manifest manifest.OSBuildManifest,
	imageType distro.ImageType,
	bp *blueprint.Blueprint,
	size uint64,
	targets []*target.Target,
	testSuccess bool,
	packages []rpmmd.PackageSpec) error

PushTestCompose is used for testing Set testSuccess to create a fake successful compose, otherwise it will create a failed compose It does not actually run a compose job

func (*Store) TagBlueprint

func (s *Store) TagBlueprint(name string) error

TagBlueprint will tag the most recent commit It will return an error if the blueprint doesn't exist

Jump to

Keyboard shortcuts

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