state

package
v2.1.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateDate

func GenerateDate() time.Time

func GenerateId

func GenerateId() string

func StringsToMap

func StringsToMap(list []string) map[string]struct{}

Types

type CommonConfigStore

type CommonConfigStore struct {
	Configs []entity.CommonConfig
}

func NewCommonConfigStore

func NewCommonConfigStore() *CommonConfigStore

func (*CommonConfigStore) Create

func (*CommonConfigStore) DeleteByIds

func (cs *CommonConfigStore) DeleteByIds(ids []string) int

func (*CommonConfigStore) GetAll

func (cs *CommonConfigStore) GetAll() []entity.CommonConfig

func (CommonConfigStore) GetByIds

func (cs CommonConfigStore) GetByIds(ids []string) []entity.CommonConfig

func (CommonConfigStore) GetByName

func (cs CommonConfigStore) GetByName(name string) []entity.CommonConfig

func (*CommonConfigStore) UpdateById

func (cs *CommonConfigStore) UpdateById(config entity.CommonConfig)

type ConfigStore

type ConfigStore struct {
	Configs []entity.Config
}

func NewConfigStore

func NewConfigStore() *ConfigStore

func (*ConfigStore) Activate

func (cs *ConfigStore) Activate(config entity.Config, date time.Time) []entity.Config

func (*ConfigStore) Create

func (cs *ConfigStore) Create(config entity.Config) entity.Config

func (*ConfigStore) DeleteByIds

func (cs *ConfigStore) DeleteByIds(ids []string) int

func (*ConfigStore) FilterByCommonConfigs

func (cs *ConfigStore) FilterByCommonConfigs(commonIds []string) []entity.Config

func (ConfigStore) GetActiveByModuleId

func (cs ConfigStore) GetActiveByModuleId(moduleId string) *entity.Config

func (ConfigStore) GetByIds

func (cs ConfigStore) GetByIds(ids []string) []entity.Config

func (ConfigStore) GetByModuleIds

func (cs ConfigStore) GetByModuleIds(ids []string) []entity.Config

func (*ConfigStore) UpdateById

func (cs *ConfigStore) UpdateById(config entity.Config)

type Mesh

type Mesh struct {
	// { "ModuleName": { "address": BackendDeclaration, ...}, ... }
	ModulesMap map[string]NodesMap
}

func NewMesh

func NewMesh() *Mesh

func (Mesh) BackendExist

func (m Mesh) BackendExist(backend structure.BackendDeclaration) (exist bool)

func (Mesh) CheckBackendChanged

func (m Mesh) CheckBackendChanged(backend structure.BackendDeclaration) (changed bool)

func (*Mesh) DeleteBackend

func (m *Mesh) DeleteBackend(backend structure.BackendDeclaration) (deleted bool)

func (Mesh) GetBackends

func (m Mesh) GetBackends(module string) []structure.BackendDeclaration

func (Mesh) GetModuleAddresses

func (m Mesh) GetModuleAddresses(moduleName string) []structure.AddressConfiguration

func (Mesh) GetRoutes

func (m Mesh) GetRoutes() structure.RoutingConfig

func (*Mesh) UpsertBackend

func (m *Mesh) UpsertBackend(backend structure.BackendDeclaration) (changed bool)

type ModuleStore

type ModuleStore struct {
	Modules []entity.Module
}

func NewModuleStore

func NewModuleStore() *ModuleStore

func (*ModuleStore) Create

func (ms *ModuleStore) Create(module entity.Module)

func (*ModuleStore) DeleteByIds

func (ms *ModuleStore) DeleteByIds(ids []string) []entity.Module

func (*ModuleStore) GetAll

func (ms *ModuleStore) GetAll() []entity.Module

func (ModuleStore) GetById

func (ms ModuleStore) GetById(id string) *entity.Module

func (ModuleStore) GetByName

func (ms ModuleStore) GetByName(name string) *entity.Module

func (*ModuleStore) UpdateByName

func (ms *ModuleStore) UpdateByName(module entity.Module)

type NodesMap

type NodesMap map[string]structure.BackendDeclaration

type ReadonlyCommonConfigStore

type ReadonlyCommonConfigStore interface {
	GetByIds(ids []string) []entity.CommonConfig
	GetByName(name string) []entity.CommonConfig
	GetAll() []entity.CommonConfig
}

type ReadonlyConfigStore

type ReadonlyConfigStore interface {
	GetActiveByModuleId(moduleId string) *entity.Config
	GetByIds(ids []string) []entity.Config
	GetByModuleIds(ids []string) []entity.Config
	FilterByCommonConfigs(commonIds []string) []entity.Config
}

type ReadonlyMesh

type ReadonlyMesh interface {
	CheckBackendChanged(backend structure.BackendDeclaration) (changed bool)
	BackendExist(backend structure.BackendDeclaration) (exist bool)
	GetModuleAddresses(moduleName string) []structure.AddressConfiguration
	GetBackends(module string) []structure.BackendDeclaration
	GetRoutes() structure.RoutingConfig
}

type ReadonlyModuleStore

type ReadonlyModuleStore interface {
	GetByName(name string) *entity.Module
	GetById(id string) *entity.Module
	GetAll() []entity.Module
}

type ReadonlySchemaStore

type ReadonlySchemaStore interface {
	GetByModuleIds(ids []string) []entity.ConfigSchema
}

type ReadonlyState

type ReadonlyState interface {
	Mesh() ReadonlyMesh
	Configs() ReadonlyConfigStore
	Schemas() ReadonlySchemaStore
	Modules() ReadonlyModuleStore
	CommonConfigs() ReadonlyCommonConfigStore
}

type SchemaStore

type SchemaStore struct {
	Schemas []entity.ConfigSchema
}

func NewSchemaStore

func NewSchemaStore() *SchemaStore

func (*SchemaStore) DeleteByIds

func (ss *SchemaStore) DeleteByIds(ids []string) int

func (SchemaStore) GetByModuleIds

func (ss SchemaStore) GetByModuleIds(ids []string) []entity.ConfigSchema

func (*SchemaStore) Upsert

func (ss *SchemaStore) Upsert(schema entity.ConfigSchema) entity.ConfigSchema

type State

type State struct {
	MeshStore          *Mesh
	ConfigsStore       *ConfigStore
	SchemasStore       *SchemaStore
	ModulesStore       *ModuleStore
	CommonConfigsStore *CommonConfigStore
}

func NewState

func NewState() *State

func NewStateFromSnapshot

func NewStateFromSnapshot(configs []entity.Config, schemas []entity.ConfigSchema, modules []entity.Module, commConfigs []entity.CommonConfig) *State

func (State) CommonConfigs

func (s State) CommonConfigs() ReadonlyCommonConfigStore

func (State) Configs

func (s State) Configs() ReadonlyConfigStore

func (State) Mesh

func (s State) Mesh() ReadonlyMesh

func (State) Modules

func (s State) Modules() ReadonlyModuleStore

func (State) Schemas

func (s State) Schemas() ReadonlySchemaStore

func (*State) WritableCommonConfigs

func (s *State) WritableCommonConfigs() WriteableCommonConfigStore

func (*State) WritableConfigs

func (s *State) WritableConfigs() WriteableConfigStore

func (*State) WritableMesh

func (s *State) WritableMesh() WriteableMesh

func (*State) WritableModules

func (s *State) WritableModules() WriteableModuleStore

func (*State) WritableSchemas

func (s *State) WritableSchemas() WriteableSchemaStore

type WritableState

type WritableState interface {
	ReadonlyState
	WritableMesh() WriteableMesh
	WritableConfigs() WriteableConfigStore
	WritableSchemas() WriteableSchemaStore
	WritableModules() WriteableModuleStore
	WritableCommonConfigs() WriteableCommonConfigStore
}

type WriteableCommonConfigStore

type WriteableCommonConfigStore interface {
	ReadonlyCommonConfigStore
	Create(config entity.CommonConfig) entity.CommonConfig
	UpdateById(config entity.CommonConfig)
	DeleteByIds(ids []string) int
}

type WriteableConfigStore

type WriteableConfigStore interface {
	ReadonlyConfigStore
	Create(config entity.Config) entity.Config
	UpdateById(config entity.Config)
	DeleteByIds(ids []string) int
	Activate(config entity.Config, date time.Time) (affected []entity.Config)
}

type WriteableMesh

type WriteableMesh interface {
	ReadonlyMesh
	UpsertBackend(backend structure.BackendDeclaration) (changed bool)
	DeleteBackend(backend structure.BackendDeclaration) (deleted bool)
}

type WriteableModuleStore

type WriteableModuleStore interface {
	ReadonlyModuleStore
	UpdateByName(module entity.Module)
	Create(entity.Module)
	DeleteByIds(ids []string) (deleted []entity.Module)
}

type WriteableSchemaStore

type WriteableSchemaStore interface {
	ReadonlySchemaStore
	Upsert(schema entity.ConfigSchema) entity.ConfigSchema
	DeleteByIds(ids []string) int
}

Jump to

Keyboard shortcuts

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