Documentation ¶
Index ¶
- func GetMethod(path string) string
- func GetService(path string) string
- func Index(path string, index int) string
- func InsideProperty(source *specs.Property, target *specs.Property) bool
- func LookupReference(ctx *broker.Context, breakpoint string, reference *specs.PropertyReference, ...) (*specs.Property, error)
- func NewRepeating(store Store, tracker Tracker, path string, values []interface{})
- func NewRepeatingMessages(store Store, tracker Tracker, path string, values []map[string]interface{})
- func ReferencedParameterMapPaths(referenced ReferencedCollection, property *specs.ParameterMap) *specs.ParameterMap
- func ReferencedPathsProperty(referenced ReferencedCollection, property *specs.Property) *specs.Property
- func Resolve(ctx *broker.Context, flows specs.FlowListInterface) (err error)
- func ResolveCall(ctx *broker.Context, node *specs.Node, call *specs.Call, ...) (err error)
- func ResolveFlow(ctx *broker.Context, flow specs.FlowInterface) (err error)
- func ResolveNode(ctx *broker.Context, node *specs.Node, flow specs.FlowInterface) (err error)
- func ResolveOnError(ctx *broker.Context, node *specs.Node, params *specs.OnError, ...) (err error)
- func ResolveParameterMap(ctx *broker.Context, node *specs.Node, params *specs.ParameterMap, ...) (err error)
- func ResolveParams(ctx *broker.Context, node *specs.Node, params map[string]*specs.Property, ...) error
- func ResolveProperty(ctx *broker.Context, node *specs.Node, property *specs.Property, ...) error
- func ScopeNestedReferences(resource, path string, source, target *specs.Template)
- func StoreValues(store Store, tracker Tracker, path string, values map[string]interface{})
- type Collection
- type EnumVal
- type ErrUndefinedReference
- type ErrUndefinedResource
- type ErrUnresolvedCall
- type ErrUnresolvedFlow
- type ErrUnresolvedNode
- type ErrUnresolvedOnError
- type ErrUnresolvedParameterMap
- type ErrUnresolvedParams
- type ErrUnresolvedProperty
- type Reference
- type ReferencedCollection
- type Store
- type Tracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetService ¶
GetService returns the service from the given endpoint
func InsideProperty ¶
InsideProperty checks whether the given property is insde the source property
func LookupReference ¶
func LookupReference(ctx *broker.Context, breakpoint string, reference *specs.PropertyReference, flow specs.FlowInterface) (*specs.Property, error)
LookupReference looks up the given reference
func NewRepeating ¶
NewRepeating appends the given repeating values to the given reference
func NewRepeatingMessages ¶
func NewRepeatingMessages(store Store, tracker Tracker, path string, values []map[string]interface{})
NewRepeatingMessages appends the given repeating messages to the given reference
func ReferencedParameterMapPaths ¶
func ReferencedParameterMapPaths(referenced ReferencedCollection, property *specs.ParameterMap) *specs.ParameterMap
ReferencedParameterMapPaths constructs a new parameter map containing only the paths provided inisde the references collection. All properties not found iniside the collection will be ignored.
func ReferencedPathsProperty ¶
func ReferencedPathsProperty(referenced ReferencedCollection, property *specs.Property) *specs.Property
ReferencedPathsProperty constructs a new property containing only the paths provided inisde the references collection. All properties not found iniside the collection will be ignored.
func Resolve ¶
func Resolve(ctx *broker.Context, flows specs.FlowListInterface) (err error)
Resolve all references inside the given flow list
func ResolveCall ¶
func ResolveCall(ctx *broker.Context, node *specs.Node, call *specs.Call, flow specs.FlowInterface) (err error)
ResolveCall resolves all references made within the given call
func ResolveFlow ¶
func ResolveFlow(ctx *broker.Context, flow specs.FlowInterface) (err error)
ResolveFlow all references made within the given flow
func ResolveNode ¶
ResolveNode resolves all references made within the given node
func ResolveOnError ¶
func ResolveOnError(ctx *broker.Context, node *specs.Node, params *specs.OnError, flow specs.FlowInterface) (err error)
ResolveOnError resolves references made inside the given on error specs
func ResolveParameterMap ¶
func ResolveParameterMap(ctx *broker.Context, node *specs.Node, params *specs.ParameterMap, flow specs.FlowInterface) (err error)
ResolveParameterMap resolves all references made within the given parameter map
func ResolveParams ¶
func ResolveParams(ctx *broker.Context, node *specs.Node, params map[string]*specs.Property, flow specs.FlowInterface) error
ResolveParams resolves all references made within the given parameters
func ResolveProperty ¶
func ResolveProperty(ctx *broker.Context, node *specs.Node, property *specs.Property, flow specs.FlowInterface) error
ResolveProperty resolves all references made within the given property
func ScopeNestedReferences ¶
ScopeNestedReferences clones all properties on the left side to the target on the right side.
Types ¶
type Collection ¶
type Collection map[string]*specs.PropertyReference
Collection represents a map of property references
func ParameterReferences ¶
func ParameterReferences(params *specs.ParameterMap) Collection
ParameterReferences returns all the available references inside the given parameter map
func PropertyReferences ¶
func PropertyReferences(property *specs.Property) Collection
PropertyReferences returns the available references within the given property
func (Collection) MergeLeft ¶
func (references Collection) MergeLeft(incoming ...Collection)
MergeLeft merges the references into the given reference
type EnumVal ¶
type EnumVal struct {
// contains filtered or unexported fields
}
EnumVal represents a enum value
func (*EnumVal) MarshalJSON ¶
MarshalJSON custom marshal implementation mainly used for testing purposes
func (*EnumVal) UnmarshalJSON ¶
UnmarshalJSON custom unmarshal implementation mainly used for testing purposes
type ErrUndefinedReference ¶
type ErrUndefinedReference struct { Property *specs.Property Breakpoint string // contains filtered or unexported fields }
ErrUndefinedReference occurs when resolving meets unknown reference.
func NewErrUndefinedReference ¶
func NewErrUndefinedReference(inner error, property *specs.Property, breakpoint string) ErrUndefinedReference
NewErrUndefinedReference constructs a new error thrown when a undefined reference is given.
func (ErrUndefinedReference) Error ¶
func (e ErrUndefinedReference) Error() string
Error returns a description of the given error as a string
func (ErrUndefinedReference) Prettify ¶
func (e ErrUndefinedReference) Prettify() prettyerr.Error
Prettify returns the prettified version of the given error
type ErrUndefinedResource ¶
type ErrUndefinedResource struct { // Reference points to the reference which caused the error Reference *specs.PropertyReference Breakpoint string // AvailableReferences contains the whole list of known references AvailableReferences map[string]lookup.ReferenceMap // contains filtered or unexported fields }
ErrUndefinedResource occurs when resolving meets unknown resource
func (ErrUndefinedResource) Error ¶
func (e ErrUndefinedResource) Error() string
Error returns a description of the given error as a string
func (ErrUndefinedResource) Prettify ¶
func (e ErrUndefinedResource) Prettify() prettyerr.Error
Prettify returns the prettified version of the given error
type ErrUnresolvedCall ¶
ErrUnresolvedCall is thrown when Semaphore is unable to resolve a reference inside the given call.
func (ErrUnresolvedCall) Error ¶
func (e ErrUnresolvedCall) Error() string
func (ErrUnresolvedCall) Prettify ¶
func (e ErrUnresolvedCall) Prettify() prettyerr.Error
Prettify returns the prettified version of the given error
type ErrUnresolvedFlow ¶
type ErrUnresolvedFlow struct { Name string // contains filtered or unexported fields }
ErrUnresolvedFlow occurs when the whole flow cannot be resolved. It's the root error in this package.
func (ErrUnresolvedFlow) Error ¶
func (e ErrUnresolvedFlow) Error() string
Error returns a description of the given error as a string
func (ErrUnresolvedFlow) Prettify ¶
func (e ErrUnresolvedFlow) Prettify() prettyerr.Error
Prettify returns the prettified version of the given error
type ErrUnresolvedNode ¶
ErrUnresolvedNode is thrown when Semaphore is unable to resolve a reference inside the given node.
func (ErrUnresolvedNode) Error ¶
func (e ErrUnresolvedNode) Error() string
Error returns a description of the given error as a string
func (ErrUnresolvedNode) Prettify ¶
func (e ErrUnresolvedNode) Prettify() prettyerr.Error
Prettify returns the prettified version of the given error
type ErrUnresolvedOnError ¶
type ErrUnresolvedOnError struct { OnError *specs.OnError // contains filtered or unexported fields }
ErrUnresolvedOnError is thrown when Semaphore is unable to resolve a reference inside the given on error.
func (ErrUnresolvedOnError) Error ¶
func (e ErrUnresolvedOnError) Error() string
Error returns a description of the given error as a string
func (ErrUnresolvedOnError) Prettify ¶
func (e ErrUnresolvedOnError) Prettify() prettyerr.Error
Prettify returns the prettified version of the given error
type ErrUnresolvedParameterMap ¶
type ErrUnresolvedParameterMap struct { Parameter *specs.ParameterMap // contains filtered or unexported fields }
ErrUnresolvedParameterMap is thrown when Semaphore is unable to resolve a reference in the given parameter map.
func (ErrUnresolvedParameterMap) Error ¶
func (e ErrUnresolvedParameterMap) Error() string
Error returns a description of the given error as a string
func (ErrUnresolvedParameterMap) Prettify ¶
func (e ErrUnresolvedParameterMap) Prettify() prettyerr.Error
Prettify returns the prettified version of the given error
type ErrUnresolvedParams ¶
type ErrUnresolvedParams struct { Params map[string]*specs.Property // contains filtered or unexported fields }
ErrUnresolvedParams is thrown when Semaphore is unable to resolve a reference inside the given parameters.
func (ErrUnresolvedParams) Error ¶
func (e ErrUnresolvedParams) Error() string
func (ErrUnresolvedParams) Prettify ¶
func (e ErrUnresolvedParams) Prettify() prettyerr.Error
Prettify returns the prettified version of the given error
type ErrUnresolvedProperty ¶
type ErrUnresolvedProperty struct { Property *specs.Property // contains filtered or unexported fields }
ErrUnresolvedProperty is thrown when Semaphore is unable to resolve a reference inside the given property.
func NewErrUnresolvedProperty ¶
func NewErrUnresolvedProperty(inner error, property *specs.Property) ErrUnresolvedProperty
NewErrUnresolvedProperty is thrown when the given property has not been resolved
func (ErrUnresolvedProperty) Error ¶
func (e ErrUnresolvedProperty) Error() string
func (ErrUnresolvedProperty) Prettify ¶
func (e ErrUnresolvedProperty) Prettify() prettyerr.Error
Prettify returns the prettified version of the given error
type Reference ¶
type Reference struct { Value interface{} Enum *int32 }
Reference represents a value reference
type ReferencedCollection ¶
type ReferencedCollection map[string]struct{}
ReferencedCollection contains a collection of paths
func ReferencedResourcePaths ¶
func ReferencedResourcePaths(flow specs.FlowInterface, resource string) ReferencedCollection
ReferencedResourcePaths defines all paths references to the given resource inside the given flow. These references could be used to only include the properties used and referenced inside a given flow.
func (ReferencedCollection) Has ¶
func (collection ReferencedCollection) Has(path string) bool
Has verifies whether the given path is available inside the given collection.
func (ReferencedCollection) Set ¶
func (collection ReferencedCollection) Set(path string)
Set deconstructs the given paths to ensure that all parts to the given paths are available. This is used to allow for easy comparisons against property paths.
ex: "meta.info.name" results in: "meta", "meta.info", "meta.info.name"
type Store ¶
type Store interface { // Store stores the reference using the given path as key Store(path string, reference *Reference) // Load attempts to load the reference for the given path. // If no reference has been found is a nil value returned. Load(path string) *Reference // Define defines the length of a array or object at the given path. // Any previously defined lengths for the given path will be overridden. Define(path string, length int) // Length returns the length of the given object or array at the given path Length(path string) int }
Store is a key/value store capable of holding reference values. Reference values could be fetched by providing the absolute path of a property. The reference store is used inside flows and codecs to track properties and their values. Property keys are delimited with a simple dot-notation (ex: meta.key).
Arrays are stored by defining the index and property path (ex: items[0].key). When defining an array or object make sure to define the length. The length of objects and properties are used inside implementations as a reference.
func NewPrefixStore ¶
NewPrefixStore fixes all writes and reads from the given store on the set resource and prefix path
type Tracker ¶
type Tracker interface { // Track includes the given path and index to be tracked. // Trackers could be nested to track multiple or nested arrays on different indexes. Track(path string, index int) // Resolve resolves the given path to include all tracked array indexes found inside the given path. // ex: "items.key" - "items[0].key" Resolve(path string) string // Next increases the index of the counter at the given path Next(path string) int }
Tracker tracks the index positions of arrays. Paths represent arrays or objects stored inside a reference store. Paths defined inside references could be resolved to include the current items index. These indexes are required since paths inside the reference store are absolute. Trackers could be nested to track multiple arrays on different or nested paths.
The tracker does not perform any mutex locking. Most usecases/implementations are not concurrent.
example: track := tracker.Track("items", 0) // sets the current index of "items" at 0 path := track.Resolve("items.key") // returns: "items[0].key" track.Next("items") // increases the index of "items" by one