memory

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

This section is empty.

Types

type Application

type Application struct {
	// contains filtered or unexported fields
}

Application entity

func NewApplication

func NewApplication() *Application

NewApplication creates new storage for Applications

func (*Application) FindAll

func (s *Application) FindAll() ([]*internal.Application, error)

FindAll returns from memory all Application

func (*Application) FindOneByServiceID

func (s *Application) FindOneByServiceID(id internal.ApplicationServiceID) (*internal.Application, error)

FindOneByServiceID returns Application which contains Service with given ID

func (*Application) Get

Get returns from memory Application with given name

func (*Application) Remove

func (s *Application) Remove(name internal.ApplicationName) error

Remove removes from memory Application with given name

func (*Application) Upsert

func (s *Application) Upsert(app *internal.Application) (bool, error)

Upsert persists Application in memory.

If Application already exists in storage than full replace is performed.

True is returned if Application already existed in storage and was replaced.

type Config

type Config struct {
	MaxKeys int64 `json:"max-keys"`
}

Config provide config for storage

type Instance

type Instance struct {
	// contains filtered or unexported fields
}

Instance implements in-memory storage for Instance entities.

func NewInstance

func NewInstance() *Instance

NewInstance creates new Instances storage

func (*Instance) FindOne

func (s *Instance) FindOne(m func(i *internal.Instance) bool) (*internal.Instance, error)

FindOne returns from storage first object which passes the match.

func (*Instance) Get

Get returns object from storage.

func (*Instance) Insert

func (s *Instance) Insert(i *internal.Instance) error

Insert inserts object to storage.

func (*Instance) Remove

func (s *Instance) Remove(id internal.InstanceID) error

Remove removing object from storage.

func (*Instance) UpdateState

func (s *Instance) UpdateState(iID internal.InstanceID, state internal.InstanceState) error

UpdateState modifies state on object in storage.

type InstanceOperation

type InstanceOperation struct {
	// contains filtered or unexported fields
}

InstanceOperation implements in-memory storage InstanceOperation.

func NewInstanceOperation

func NewInstanceOperation() *InstanceOperation

NewInstanceOperation returns new instance of InstanceOperation storage.

func (*InstanceOperation) Get

Get returns object from storage.

func (*InstanceOperation) GetAll

GetAll returns all objects from storage.

func (*InstanceOperation) GetLast

GetLast returns last inserted object from storage.

func (*InstanceOperation) Insert

Insert inserts object into storage.

func (*InstanceOperation) Remove

Remove removes object from storage.

func (*InstanceOperation) UpdateState

UpdateState modifies state on object in storage.

func (*InstanceOperation) UpdateStateDesc

func (s *InstanceOperation) UpdateStateDesc(iID internal.InstanceID, opID internal.OperationID, state internal.OperationState, desc *string) error

UpdateStateDesc updates both state and description for single operation. If desc is nil than description will be removed.

func (*InstanceOperation) WithTimeProvider

func (s *InstanceOperation) WithTimeProvider(nowProvider func() time.Time)

WithTimeProvider allows for passing custom time provider. Used mostly in testing.

Jump to

Keyboard shortcuts

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