Documentation ¶
Index ¶
- Constants
- type AssetManager
- type MongodbAssetManager
- type PostgresAssetManager
- func (m *PostgresAssetManager) Close() error
- func (m *PostgresAssetManager) EnsureRepoExists(repoNamespace, repoName string) (int, error)
- func (m *PostgresAssetManager) GetDB() PostgresDB
- func (m *PostgresAssetManager) GetKubeappsNamespace() string
- func (m *PostgresAssetManager) Init() error
- func (m *PostgresAssetManager) InitTables() error
- func (m *PostgresAssetManager) InvalidateCache() error
- func (m *PostgresAssetManager) QueryAllCharts(query string, args ...interface{}) ([]*models.Chart, error)
- func (m *PostgresAssetManager) QueryOne(target interface{}, query string, args ...interface{}) error
- type PostgresAssetManagerIface
- type PostgresDB
Constants ¶
const ( ChartCollection = "charts" RepositoryCollection = "repos" ChartFilesCollection = "files" )
const ( // ChartTable table containing Charts info ChartTable = "charts" // RepositoryTable table containing repositories sync info RepositoryTable = "repos" // ChartFilesTable table containing files related to other charts ChartFilesTable = "files" // EnvvarPostgresTests enables tests that run against a local postgres EnvvarPostgresTests = "ENABLE_PG_INTEGRATION_TESTS" )
const AllNamespaces = "_all"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetManager ¶
AssetManager basic manager for the different db types
type MongodbAssetManager ¶
type MongodbAssetManager struct { DBSession datastore.Session KubeappsNamespace string // contains filtered or unexported fields }
MongodbAssetManager struct containing mongodb info
func NewMongoDBManager ¶
func NewMongoDBManager(config datastore.Config, kubeappsNamespace string) *MongodbAssetManager
NewMongoDBManager creates an asset manager for MongoDB
func (*MongodbAssetManager) Init ¶
func (m *MongodbAssetManager) Init() error
Init creates dbsession
func (*MongodbAssetManager) InitCollections ¶ added in v1.10.1
func (m *MongodbAssetManager) InitCollections() error
InitCollections ensure indexes of the different collections
func (*MongodbAssetManager) InvalidateCache ¶ added in v1.9.0
func (m *MongodbAssetManager) InvalidateCache() error
InvalidateCache drops the different collections and initialize them again
type PostgresAssetManager ¶
type PostgresAssetManager struct { DB PostgresDB // contains filtered or unexported fields }
PostgresAssetManager asset manager for postgres
func NewPGManager ¶
func NewPGManager(config datastore.Config, kubeappsNamespace string) (*PostgresAssetManager, error)
NewPGManager creates an asset manager for PG
func (*PostgresAssetManager) EnsureRepoExists ¶ added in v1.9.0
func (m *PostgresAssetManager) EnsureRepoExists(repoNamespace, repoName string) (int, error)
EnsureRepoExists upserts to get the primary key of a repo.
func (*PostgresAssetManager) GetDB ¶ added in v1.9.0
func (m *PostgresAssetManager) GetDB() PostgresDB
func (*PostgresAssetManager) GetKubeappsNamespace ¶ added in v1.9.0
func (m *PostgresAssetManager) GetKubeappsNamespace() string
func (*PostgresAssetManager) InitTables ¶ added in v1.9.0
func (m *PostgresAssetManager) InitTables() error
InitTables creates the required tables for the postgresql backend for assets.
func (*PostgresAssetManager) InvalidateCache ¶ added in v1.9.0
func (m *PostgresAssetManager) InvalidateCache() error
InvalidateCache for postgresql deletes and re-writes the schema
func (*PostgresAssetManager) QueryAllCharts ¶
func (m *PostgresAssetManager) QueryAllCharts(query string, args ...interface{}) ([]*models.Chart, error)
QueryAllCharts perform the given query and return the list of charts
func (*PostgresAssetManager) QueryOne ¶
func (m *PostgresAssetManager) QueryOne(target interface{}, query string, args ...interface{}) error
QueryOne element and store it in the target
type PostgresAssetManagerIface ¶
type PostgresAssetManagerIface interface { AssetManager QueryOne(target interface{}, query string, args ...interface{}) error QueryAllCharts(query string, args ...interface{}) ([]*models.Chart, error) InitTables() error InvalidateCache() error EnsureRepoExists(repoNamespace, repoName string) (int, error) GetDB() PostgresDB GetKubeappsNamespace() string }
PostgresAssetManagerIface represents the methods of the PG asset manager The interface is used by the tests to implement a fake PostgresAssetManagerIface