intent

package
v0.0.0-...-d6856c1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseIntent

type BaseIntent struct {
	// Dependencies maps type of dependent intents to set of theirs uuids
	Dependencies map[string]UUIDSet
}

BaseIntent implements the default Evaluate interface

func (*BaseIntent) AddDependentIntent

func (b *BaseIntent) AddDependentIntent(i Intent)

AddDependentIntent adds a intent to dependencies. This method can be used to add custom intents which are not refs or backrefs

func (*BaseIntent) Evaluate

func (b *BaseIntent) Evaluate(ctx context.Context, evaluateCtx *EvaluateContext) error

Evaluate creates/updates/deletes lower-level resources when needed.

func (*BaseIntent) GetDependencies

func (b *BaseIntent) GetDependencies() map[string]UUIDSet

GetDependencies returns collection of references and backrefs' uuids

func (*BaseIntent) RemoveDependentIntent

func (b *BaseIntent) RemoveDependentIntent(i Intent)

RemoveDependentIntent removes a intent from dependencies. This method can be used to add custom logic and reactions.

type Cache

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

Cache stores intents.

func NewCache

func NewCache() *Cache

NewCache creates new cache for intents.

func (*Cache) Delete

func (c *Cache) Delete(kind string, q Query)

Delete deletes intent from cache. It accepts kebab-case or CamelCase type name.

func (*Cache) Load

func (c *Cache) Load(kind string, q Query) Intent

Load loads intent from cache.

func (*Cache) Store

func (c *Cache) Store(i Intent)

Store puts intent into cache.

type EvaluateContext

type EvaluateContext struct {
	WriteService     services.WriteService
	ReadService      services.ReadService
	IntPoolAllocator asfservices.IntPoolAllocator
	IntentLoader     Loader
}

EvaluateContext contains context information for Resource to handle CRUD

type Intent

type Intent interface {
	models.Object
	Evaluate(ctx context.Context, evaluateCtx *EvaluateContext) error
	GetObject() models.Object
	GetDependencies() map[string]UUIDSet
	AddDependentIntent(i Intent)
	RemoveDependentIntent(i Intent)
}

Intent contains Intent Compiler state for a resource.

type Loader

type Loader interface {
	Load(typeName string, id Query) Intent
}

Loader provides access to existing intents (e.g. using a cache)

type Query

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

Query finds an intent in cache.

func ByFQName

func ByFQName(fqName []string) Query

ByFQName returns a query to find an intent by FQName.

func ByUUID

func ByUUID(uuid string) Query

ByUUID returns a query to find an intent by UUID.

func (Query) String

func (q Query) String() string

String returns the description of a Query.

type UUIDSet

type UUIDSet map[string]struct{}

UUIDSet set of uuids

Jump to

Keyboard shortcuts

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