Documentation
¶
Index ¶
- func AllSpecs(specs []*types.Spec) []*types.Spec
- func NormalizeSpecs(uri string, input []byte) ([]*types.Spec, error)
- func OrderByDependency(specs []*types.Spec) ([]*types.Spec, error)
- func SpecsFromURL(uri string) (root string, config []byte, err error)
- type Addressable
- func AsAddressable(spec types.Spec) Addressable
- func NewAddressable(kind string, pn plugin.Name, instance string) Addressable
- func NewAddressableFromMetadata(kind string, metadata types.Metadata) Addressable
- func NewAddressableFromPluginMetadata(meta plugin.Metadata) Addressable
- func NewAddressableFromPluginName(pn plugin.Name) Addressable
- type Constructor
- type ConstructorError
- type ConstructorSuccess
- type Destructor
- type ModelDefinition
- type Objects
- type Process
- type ProcessDefinition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeSpecs ¶
NormalizeSpecs given the input bytes and its source, returns the normalized specs where template urls have been updated to be absolute and the specs are in dependency order.
func OrderByDependency ¶
OrderByDependency returns the given specs in dependency order. The input is assume to be exhaustive in that all nested specs are part of the list.
Types ¶
type Addressable ¶
type Addressable interface {
// Kind corresponds to the packages under pkg/run/v0
Kind() string
// Plugin returns the address of the rpc (endpoint)
Plugin() plugin.Name
// Instance is the instance identifier
Instance() string
// String returns the string representation for debugging
String() string
}
Addressable represents an object that can be reached / located, whether it's an RPC endpoint or an object within the rpc endpoint.
func AsAddressable ¶
func AsAddressable(spec types.Spec) Addressable
AsAddressable returns a spec as an addressable object
func NewAddressable ¶
func NewAddressable(kind string, pn plugin.Name, instance string) Addressable
NewAddressable returns a generic addressable object
func NewAddressableFromMetadata ¶
func NewAddressableFromMetadata(kind string, metadata types.Metadata) Addressable
NewAddressableFromMetadata creates an addressable from metadata
func NewAddressableFromPluginMetadata ¶
func NewAddressableFromPluginMetadata(meta plugin.Metadata) Addressable
NewAddressableFromPluginMetadata returns an Addressable from the plugin metadata
func NewAddressableFromPluginName ¶
func NewAddressableFromPluginName(pn plugin.Name) Addressable
NewAddressableFromPluginName returns a generic addressable object from just the plugin name. The kind is assume to be the same as the lookup.
type Constructor ¶
type Constructor func(spec types.Spec, properties *types.Any) (identity *types.Identity, state *types.Any, err error)
Constructor constructs the instance using the rendered input
type ConstructorError ¶
ConstructorError is the callback when the destruction succeeds
type ConstructorSuccess ¶
ConstructorSuccess is the callback when construction succeeds
type ModelDefinition ¶
ModelDefinition defines the fsm model
type Objects ¶
type Objects interface {
FindBy(...interface{}) *types.Object
Add(*types.Object)
Remove(*types.Object)
Len() int
}
Objects is a collection of instances instantiated from specs. They are queryable via the FindBy method
func NewObjects ¶
NewObjects creates an index
type Process ¶
type Process struct {
ProcessDefinition
Constructor fsm.Action
// contains filtered or unexported fields
}
Process manages the lifecycle of one class of objects
func NewProcess ¶
func NewProcess(model ModelDefinition, input ProcessDefinition, store Objects, plugins func() discovery.Plugins) (*Process, error)
NewProcess creates a new process to manage a spec and the lifecycle of its instances.
func (*Process) NewInstance ¶
NewInstance creates an instance of the object in the initial state, calling the process constructor
type ProcessDefinition ¶
type ProcessDefinition struct {
Spec *types.Spec
Constructor Constructor
ConstructorError ConstructorError
ConstructorSuccess ConstructorSuccess
Destructor Destructor
}
ProcessDefinition has the Spec and the actual behaviors like construct/ destruct