storage

package
v0.0.0-...-a52e8f6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 Application

type Application interface {
	Upsert(app *internal.Application) (bool, error)
	Get(name internal.ApplicationName) (*internal.Application, error)
	FindAll() ([]*internal.Application, error)
	FindOneByServiceID(id internal.ApplicationServiceID) (*internal.Application, error)
	Remove(name internal.ApplicationName) error
}

Application 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"`
	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

type DriverType

type DriverType string

DriverType defines type of data storage

const (
	// 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"
	// EntityApplication represents name of application entities
	EntityApplication EntityName = "application"
	// EntityInstance represents name of services instances entities
	EntityInstance EntityName = "instance"
	// EntityInstanceOperation represents name of instances operations entities
	EntityInstanceOperation EntityName = "instanceOperation"
)

type Factory

type Factory interface {
	Application() Application
	Instance() Instance
	InstanceOperation() InstanceOperation
}

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

type Instance

type Instance interface {
	Insert(i *internal.Instance) error
	Remove(id internal.InstanceID) error
	Get(id internal.InstanceID) (*internal.Instance, error)
	FindOne(func(i *internal.Instance) bool) (*internal.Instance, error)
	UpdateState(iID internal.InstanceID, state internal.InstanceState) error
}

Instance is an interface that describe storage layer operations for Instances

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)
	GetLast(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
	WithTimeProvider(func() time.Time)
}

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
automock
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0
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