storage

package
v0.0.0-...-4b7ff4e Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: Apache-2.0, Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DbUser            = "admin"
	DbPass            = "nimda"
	DbName            = "broker"
	DbPort            = "5432"
	DockerUserNetwork = "test_network"
	EnvPipelineBuild  = "PIPELINE_BUILD"
)

Variables

This section is empty.

Functions

func CloseDatabase

func CloseDatabase(t *testing.T, connection *dbr.Connection)

func EnsureTestNetworkForDB

func EnsureTestNetworkForDB(t *testing.T, ctx context.Context) (func(), error)

func InitTestDBTables

func InitTestDBTables(t *testing.T, connectionURL string) error

Types

type BrokerStorage

type BrokerStorage interface {
	Instances() Instances
	Operations() Operations
	Provisioning() Provisioning
	Deprovisioning() Deprovisioning
	LMSTenants() LMSTenants
}

func NewFromConfig

func NewFromConfig(cfg Config, log logrus.FieldLogger) (BrokerStorage, *dbr.Connection, error)

func NewMemoryStorage

func NewMemoryStorage() BrokerStorage

type Config

type Config struct {
	User     string `envconfig:"default=postgres"`
	Password string `envconfig:"default=password"`
	Host     string `envconfig:"default=localhost"`
	Port     string `envconfig:"default=5432"`
	Name     string `envconfig:"default=broker"`
	SSLMode  string `envconfig:"default=disable"`

	MaxOpenConns    int           `envconfig:"default=8"`
	MaxIdleConns    int           `envconfig:"default=2"`
	ConnMaxLifetime time.Duration `envconfig:"default=30m"`
}

func InitTestDBContainer

func InitTestDBContainer(t *testing.T, ctx context.Context, hostname string) (func(), Config, error)

func (*Config) ConnectionURL

func (cfg *Config) ConnectionURL() string

type Deprovisioning

type Deprovisioning interface {
	InsertDeprovisioningOperation(operation internal.DeprovisioningOperation) error
	GetDeprovisioningOperationByID(operationID string) (*internal.DeprovisioningOperation, error)
	GetDeprovisioningOperationByInstanceID(instanceID string) (*internal.DeprovisioningOperation, error)
	UpdateDeprovisioningOperation(operation internal.DeprovisioningOperation) (*internal.DeprovisioningOperation, error)
}

type Instances

type Instances interface {
	FindAllJoinedWithOperations(prct ...predicate.Predicate) ([]internal.InstanceWithOperation, error)
	FindAllInstancesForRuntimes(runtimeIdList []string) ([]internal.Instance, error)
	GetByID(instanceID string) (*internal.Instance, error)
	Insert(instance internal.Instance) error
	Update(instance internal.Instance) error
	Delete(instanceID string) error
	GetInstanceStats() (internal.InstanceStats, error)
}

type LMSTenants

type LMSTenants interface {
	FindTenantByName(name, region string) (internal.LMSTenant, bool, error)
	InsertTenant(tenant internal.LMSTenant) error
}

type Operations

type Operations interface {
	Provisioning
	Deprovisioning

	GetOperationByID(operationID string) (*internal.Operation, error)
	GetOperationsInProgressByType(operationType dbmodel.OperationType) ([]internal.Operation, error)
	GetOperationStats() (internal.OperationStats, error)
}

type Provisioning

type Provisioning interface {
	InsertProvisioningOperation(operation internal.ProvisioningOperation) error
	GetProvisioningOperationByID(operationID string) (*internal.ProvisioningOperation, error)
	GetProvisioningOperationByInstanceID(instanceID string) (*internal.ProvisioningOperation, error)
	UpdateProvisioningOperation(operation internal.ProvisioningOperation) (*internal.ProvisioningOperation, error)
}

Directories

Path Synopsis
driver

Jump to

Keyboard shortcuts

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