sqlite

package
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2020 License: Apache-2.0 Imports: 22 Imported by: 14

Documentation

Index

Constants

View Source
const (
	ConfigMapCRDName     = "customResourceDefinitions"
	ConfigMapCSVName     = "clusterServiceVersions"
	ConfigMapPackageName = "packages"
)
View Source
const (
	DefaultMigrationsTable = "schema_migrations"
	NilVersion             = -1
)
View Source
const ClusterServiceVersionKind = "ClusterServiceVersion"

Variables

This section is empty.

Functions

func SplitCRDName added in v1.0.3

func SplitCRDName(crdName string) (plural, group string, err error)

Types

type ConfigMapLoader

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

ConfigMapLoader loads a configmap of resources into the database entries under "customResourceDefinitions" will be parsed as CRDs entries under "clusterServiceVersions" will be parsed as CSVs entries under "packages" will be parsed as Packages

func NewSQLLoaderForConfigMap

func NewSQLLoaderForConfigMap(store registry.Load, configMap v1.ConfigMap) *ConfigMapLoader

func NewSQLLoaderForConfigMapData

func NewSQLLoaderForConfigMapData(logger *logrus.Entry, store registry.Load, configMapData map[string]string) *ConfigMapLoader

NewSQLLoaderForConfigMapData is useful when the operator manifest(s) originate from a different source than a configMap. For example, operator manifest(s) can be downloaded from a remote registry like quay.io.

func (*ConfigMapLoader) Populate

func (c *ConfigMapLoader) Populate() error

type DbOption

type DbOption func(*DbOptions)

func WithMigratorBuilder

func WithMigratorBuilder(m func(loader *sql.DB) (Migrator, error)) DbOption

type DbOptions

type DbOptions struct {
	// MigratorBuilder is a function that returns a migrator instance
	MigratorBuilder func(*sql.DB) (Migrator, error)
}

type DirectoryLoader

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

DirectoryLoader loads a directory of resources into the database

func NewSQLLoaderForDirectory

func NewSQLLoaderForDirectory(store registry.Load, directory string) *DirectoryLoader

func (*DirectoryLoader) LoadBundleWalkFunc

func (d *DirectoryLoader) LoadBundleWalkFunc(path string, f os.FileInfo, err error) error

LoadBundleWalkFunc walks the directory. When it sees a `.clusterserviceversion.yaml` file, it attempts to load the surrounding files in the same directory as a bundle, and stores them in the db for querying

func (*DirectoryLoader) LoadPackagesWalkFunc

func (d *DirectoryLoader) LoadPackagesWalkFunc(path string, f os.FileInfo, err error) error

LoadPackagesWalkFunc attempts to unmarshal the file at the given path into a PackageManifest resource. If unmarshaling is successful, the PackageManifest is added to the loader's store.

func (*DirectoryLoader) Populate

func (d *DirectoryLoader) Populate() error

type ImageLoader added in v1.5.3

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

ImageLoader loads a bundle image of resources into the database

func NewSQLLoaderForImage added in v1.5.3

func NewSQLLoaderForImage(store registry.Load, image, containerTool string) *ImageLoader

func (*ImageLoader) LoadBundleFunc added in v1.5.3

func (i *ImageLoader) LoadBundleFunc() error

LoadBundleFunc walks the bundle directory. Looks for the metadata and manifests sub-directories to find the annotations.yaml file that will inform how the manifests of the bundle should be loaded into the database.

func (*ImageLoader) Populate added in v1.5.3

func (i *ImageLoader) Populate() error

type Migrator

type Migrator interface {
	Migrate(ctx context.Context) error
	Up(ctx context.Context, migrations migrations.Migrations) error
	Down(ctx context.Context, migrations migrations.Migrations) error
}

func NewSQLLiteMigrator

func NewSQLLiteMigrator(db *sql.DB) (Migrator, error)

NewSQLLiteMigrator returns a SQLLiteMigrator.

type PackageRemover

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

PackageRemover removes a package from the database

func NewSQLRemoverForPackages

func NewSQLRemoverForPackages(store registry.Load, packages string) *PackageRemover

func (*PackageRemover) Remove

func (d *PackageRemover) Remove() error

type SQLLiteMigrator

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

func (*SQLLiteMigrator) Down

func (m *SQLLiteMigrator) Down(ctx context.Context, migrations migrations.Migrations) error

func (*SQLLiteMigrator) Migrate

func (m *SQLLiteMigrator) Migrate(ctx context.Context) error

Migrate gets the current version from the database, the latest version from the migrations, and migrates up the the latest

func (*SQLLiteMigrator) Up

func (m *SQLLiteMigrator) Up(ctx context.Context, migrations migrations.Migrations) error

Up runs a specific set of migrations.

type SQLLoader added in v1.0.0

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

func NewSQLLiteLoader

func NewSQLLiteLoader(db *sql.DB, opts ...DbOption) (*SQLLoader, error)

func (*SQLLoader) AddBundlePackageChannels added in v1.5.3

func (s *SQLLoader) AddBundlePackageChannels(manifest registry.PackageManifest, bundle registry.Bundle) error

func (*SQLLoader) AddOperatorBundle added in v1.0.0

func (s *SQLLoader) AddOperatorBundle(bundle *registry.Bundle) error

func (*SQLLoader) AddPackageChannels added in v1.0.0

func (s *SQLLoader) AddPackageChannels(manifest registry.PackageManifest) error

func (*SQLLoader) ClearNonDefaultBundles added in v1.5.3

func (s *SQLLoader) ClearNonDefaultBundles(packageName string) error

func (*SQLLoader) Migrate added in v1.5.0

func (s *SQLLoader) Migrate(ctx context.Context) error

func (*SQLLoader) RmPackageName added in v1.5.3

func (s *SQLLoader) RmPackageName(packageName string) error

type SQLPopulator

type SQLPopulator interface {
	Populate() error
}

type SQLQuerier

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

func NewSQLLiteQuerier

func NewSQLLiteQuerier(dbFilename string) (*SQLQuerier, error)

func NewSQLLiteQuerierFromDb

func NewSQLLiteQuerierFromDb(db *sql.DB) *SQLQuerier

func (*SQLQuerier) GetApisForEntry

func (s *SQLQuerier) GetApisForEntry(ctx context.Context, entryId int64) (provided []*api.GroupVersionKind, required []*api.GroupVersionKind, err error)

func (*SQLQuerier) GetBundle

func (s *SQLQuerier) GetBundle(ctx context.Context, pkgName, channelName, csvName string) (*api.Bundle, error)

func (*SQLQuerier) GetBundleForChannel

func (s *SQLQuerier) GetBundleForChannel(ctx context.Context, pkgName string, channelName string) (*api.Bundle, error)

func (*SQLQuerier) GetBundleThatProvides

func (s *SQLQuerier) GetBundleThatProvides(ctx context.Context, group, apiVersion, kind string) (*api.Bundle, error)

Get the the latest bundle that provides the API in a default channel, error unless there is ONLY one

func (*SQLQuerier) GetBundleThatReplaces

func (s *SQLQuerier) GetBundleThatReplaces(ctx context.Context, name, pkgName, channelName string) (*api.Bundle, error)

func (*SQLQuerier) GetChannelEntriesThatProvide

func (s *SQLQuerier) GetChannelEntriesThatProvide(ctx context.Context, group, version, kind string) (entries []*registry.ChannelEntry, err error)

func (*SQLQuerier) GetChannelEntriesThatReplace

func (s *SQLQuerier) GetChannelEntriesThatReplace(ctx context.Context, name string) (entries []*registry.ChannelEntry, err error)

func (*SQLQuerier) GetImagesForBundle

func (s *SQLQuerier) GetImagesForBundle(ctx context.Context, csvName string) ([]string, error)

func (*SQLQuerier) GetLatestChannelEntriesThatProvide

func (s *SQLQuerier) GetLatestChannelEntriesThatProvide(ctx context.Context, group, version, kind string) (entries []*registry.ChannelEntry, err error)

Get latest channel entries that provide an api

func (*SQLQuerier) GetPackage

func (s *SQLQuerier) GetPackage(ctx context.Context, name string) (*registry.PackageManifest, error)

func (*SQLQuerier) ListImages

func (s *SQLQuerier) ListImages(ctx context.Context) ([]string, error)

func (*SQLQuerier) ListPackages

func (s *SQLQuerier) ListPackages(ctx context.Context) ([]string, error)

ListPackages returns a list of package names as strings

func (*SQLQuerier) ListTables

func (s *SQLQuerier) ListTables(ctx context.Context) ([]string, error)

type SQLRemover

type SQLRemover interface {
	Remove() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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