storage

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsActiveOperationInProgressError

func IsActiveOperationInProgressError(err error) bool

IsActiveOperationInProgressError checks if given error is ActiveOperationInProgress error

func IsAlreadyExistsError

func IsAlreadyExistsError(err error) bool

IsAlreadyExistsError checks if given error is AlreadyExist error

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError checks if given error is NotFound error

Types

type Addon

Addon is an interface that describe storage layer operations for Addons

type BindOperation added in v1.1.0

BindOperation is an interface that describe storage layer operations for BindOperations

type Chart

Chart is an interface that describe storage layer operations for Charts

type Config

type Config struct {
	Driver  DriverType        `json:"driver" valid:"required"`
	Provide ProviderConfigMap `json:"provide" valid:"required"`
	Etcd    etcd.Config       `json:"etcd"`
	Memory  memory.Config     `json:"memory"`
}

Config contains database configuration.

type ConfigList

type ConfigList []Config

ConfigList is a list of configurations

func ConfigParse

func ConfigParse(inByte []byte) (*ConfigList, error)

ConfigParse is parsing yaml file to the ConfigList

func NewConfigListAllMemory

func NewConfigListAllMemory() *ConfigList

NewConfigListAllMemory returns configured configList with the memory driver for all entities.

func (*ConfigList) ExtractEtcdURL

func (cl *ConfigList) ExtractEtcdURL() string

ExtractEtcdURL extracts URL to the ETCD from config

func (*ConfigList) WaitForEtcdReadiness added in v1.1.0

func (cl *ConfigList) WaitForEtcdReadiness() error

WaitForEtcdReadiness waits for ETCD to be ready

type DriverType

type DriverType string

DriverType defines type of data storage

const (
	// DriverEtcd is a driver for key-value store - Etcd
	DriverEtcd DriverType = "etcd"
	// DriverMemory is a driver to local in-memory store
	DriverMemory DriverType = "memory"
)

type EntityName

type EntityName string

EntityName defines name of the entity in database

const (
	// EntityAll represents name of all entities
	EntityAll EntityName = "all"
	// EntityChart represents name of chart entities
	EntityChart EntityName = "chart"
	// EntityAddon represents name of addon entities
	EntityAddon EntityName = "addon"
	// EntityInstance represents name of services instances entities
	EntityInstance EntityName = "instance"
	// EntityInstanceOperation represents name of instances operations entities
	EntityInstanceOperation EntityName = "instanceOperation"
	// EntityInstanceBindData represents name of bind data entities
	EntityInstanceBindData EntityName = "entityInstanceBindData"
	// EntityBindOperation represents name of bind operations entities
	EntityBindOperation EntityName = "bindOperation"
)

type Factory

type Factory interface {
	Addon() Addon
	Chart() Chart
	Instance() Instance
	InstanceOperation() InstanceOperation
	InstanceBindData() InstanceBindData
	BindOperation() BindOperation
}

Factory provides access to concrete storage. Multiple calls should to specific storage return the same storage instance.

func NewFactory

func NewFactory(cl *ConfigList) (Factory, error)

NewFactory is a factory for entities based on given ConfigList TODO: add error handling

type Instance

type Instance interface {
	Insert(*internal.Instance) error
	Upsert(*internal.Instance) (replace bool, err error)
	Get(internal.InstanceID) (*internal.Instance, error)
	GetAll() ([]*internal.Instance, error)
	Remove(internal.InstanceID) error
}

Instance is an interface that describe storage layer operations for Instances

type InstanceBindData

type InstanceBindData interface {
	Insert(*internal.InstanceBindData) error
	Get(internal.InstanceID) (*internal.InstanceBindData, error)
	Remove(internal.InstanceID) error
}

InstanceBindData is an interface that describe storage layer operations for InstanceBindData entities

type InstanceOperation

type InstanceOperation interface {
	// Insert is inserting object into storage.
	// Object is modified by setting CreatedAt.
	Insert(*internal.InstanceOperation) error
	Get(internal.InstanceID, internal.OperationID) (*internal.InstanceOperation, error)
	GetAll(internal.InstanceID) ([]*internal.InstanceOperation, error)
	UpdateState(internal.InstanceID, internal.OperationID, internal.OperationState) error
	UpdateStateDesc(internal.InstanceID, internal.OperationID, internal.OperationState, *string) error
	Remove(internal.InstanceID, internal.OperationID) error
}

InstanceOperation is an interface that describe storage layer operations for InstanceOperations

type ProviderConfig

type ProviderConfig struct{}

ProviderConfig provides configuration to the database provider

type ProviderConfigMap

type ProviderConfigMap map[EntityName]ProviderConfig

ProviderConfigMap contains map of provided configurations for given entities

Directories

Path Synopsis
driver
Package testing provides test functions for storage.
Package testing provides test functions for storage.

Jump to

Keyboard shortcuts

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