Documentation ¶
Overview ¶
Package store contains primitives for representing and changing the osbuild-composer state.
Index ¶
- Constants
- type Compose
- type Fixture
- func FixtureBase(hostDistroName, hostArchName string) *Fixture
- func FixtureEmpty(hostDistroName, hostArchName string) *Fixture
- func FixtureFinished(hostDistroName, hostArchName string) *Fixture
- func FixtureJobs(hostDistroName, hostArchName string) *Fixture
- func FixtureOldChanges(hostDistroName, hostArchName string) *Fixture
- type ImageBuild
- type NoLocalTargetError
- type NotFoundError
- type SourceConfig
- type StateTransitionError
- type Store
- func (s *Store) DeleteBlueprint(name string) error
- func (s *Store) DeleteBlueprintFromWorkspace(name string) error
- func (s *Store) DeleteCompose(id uuid.UUID) error
- func (s *Store) DeleteSourceByID(key string)
- func (s *Store) DeleteSourceByName(name string)
- func (s *Store) GetAllComposes() map[uuid.UUID]Compose
- func (s *Store) GetAllDistroSources(distro string) map[string]SourceConfig
- func (s *Store) GetAllSourcesByID() map[string]SourceConfig
- func (s *Store) GetAllSourcesByName() map[string]SourceConfig
- func (s *Store) GetBlueprint(name string) (*blueprint.Blueprint, bool)
- func (s *Store) GetBlueprintChange(name string, commit string) (*blueprint.Change, error)
- func (s *Store) GetBlueprintChanges(name string) []blueprint.Change
- func (s *Store) GetBlueprintCommitted(name string) *blueprint.Blueprint
- func (s *Store) GetCompose(id uuid.UUID) (Compose, bool)
- func (s *Store) GetSource(name string) *SourceConfig
- func (s *Store) ListBlueprints() []string
- func (s *Store) ListSourcesById() []string
- func (s *Store) ListSourcesByName() []string
- func (s *Store) PushBlueprint(bp blueprint.Blueprint, commitMsg string) error
- func (s *Store) PushBlueprintToWorkspace(bp blueprint.Blueprint) error
- func (s *Store) PushCompose(composeID uuid.UUID, manifest manifest.OSBuildManifest, ...) error
- func (s *Store) PushSource(key string, source SourceConfig)
- func (s *Store) PushTestCompose(composeID uuid.UUID, manifest manifest.OSBuildManifest, ...) error
- func (s *Store) TagBlueprint(name string) error
Constants ¶
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.
type Fixture ¶
type Fixture struct { *Store Cleanup func() *distrofactory.Factory HostDistroName string HostArchName string }
func FixtureBase ¶
func FixtureEmpty ¶
func FixtureFinished ¶
func FixtureJobs ¶
Fixture to use for checking job queue files
func FixtureOldChanges ¶
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 (*Store) DeleteBlueprint ¶
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 ¶
DeleteBlueprintFromWorkspace deletes the workspace copy of a blueprint if the blueprint doesn't exist in the workspace it returns an error
func (*Store) DeleteCompose ¶
DeleteCompose deletes the compose from the state file and also removes all files on disk that are associated with this compose
func (*Store) DeleteSourceByID ¶
DeleteSourceByID removes a SourceConfig from store.Sources using the ID
func (*Store) DeleteSourceByName ¶
DeleteSourceByName removes a SourceConfig from store.Sources using the .Name field
func (*Store) GetAllComposes ¶
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) GetBlueprintChange ¶
GetBlueprintChange returns a specific change to a blueprint If the blueprint or change do not exist then an error is returned
func (*Store) GetBlueprintChanges ¶
GetBlueprintChanges returns the list of changes, oldest first
func (*Store) GetBlueprintCommitted ¶
func (*Store) GetSource ¶
func (s *Store) GetSource(name string) *SourceConfig
func (*Store) ListBlueprints ¶
func (*Store) ListSourcesById ¶
ListSourcesById returns the repo source id Id is a short identifier for the repo, not a full name description
func (*Store) ListSourcesByName ¶
ListSourcesByName returns the repo source names Name is different than Id, it can be a full description of the repo
func (*Store) PushBlueprint ¶
func (*Store) PushBlueprintToWorkspace ¶
func (*Store) PushCompose ¶
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 ¶
TagBlueprint will tag the most recent commit It will return an error if the blueprint doesn't exist