storage

package
v0.0.0-...-affaa53 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: Apache-2.0 Imports: 7 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 Bundle

type Bundle interface {
	Upsert(*internal.Bundle) (replace bool, err error)
	Get(internal.BundleName, semver.Version) (*internal.Bundle, error)
	GetByID(internal.BundleID) (*internal.Bundle, error)
	Remove(internal.BundleName, semver.Version) error
	RemoveByID(internal.BundleID) error
	RemoveAll() error
	FindAll() ([]*internal.Bundle, error)
}

Bundle is an interface that describe storage layer operations for Bundles

type Chart

type Chart interface {
	Upsert(*chart.Chart) (replace bool, err error)
	Get(name internal.ChartName, ver semver.Version) (*chart.Chart, error)
	Remove(name internal.ChartName, version semver.Version) error
}

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.

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"
	// EntityBundle represents name of bundle entities
	EntityBundle EntityName = "bundle"
	// 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"
)

type Factory

type Factory interface {
	Bundle() Bundle
	Chart() Chart
	Instance() Instance
	InstanceOperation() InstanceOperation
	InstanceBindData() InstanceBindData
}

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
	Get(id internal.InstanceID) (*internal.Instance, error)
	GetAll() ([]*internal.Instance, error)
	Remove(id 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