storage

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2018 License: Apache-2.0 Imports: 4 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 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"
	// EntityRemoteEnvironment represents name of remote environment entities
	EntityRemoteEnvironment EntityName = "remoteenvironment"
	// 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 {
	RemoteEnvironment() RemoteEnvironment
	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)
	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

type RemoteEnvironment

type RemoteEnvironment interface {
	Upsert(re *internal.RemoteEnvironment) (bool, error)
	Get(name internal.RemoteEnvironmentName) (*internal.RemoteEnvironment, error)
	FindAll() ([]*internal.RemoteEnvironment, error)
	FindOneByServiceID(id internal.RemoteServiceID) (*internal.RemoteEnvironment, error)
	Remove(name internal.RemoteEnvironmentName) error
}

RemoteEnvironment is an interface that describe storage layer operations for Charts

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