Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct { Oper string Func interface{} Params []interface{} Sign ActionSignature }
Action is a structure defining an operation.
func NewAction ¶
func NewAction(fun interface{}, params ...interface{}) (a *Action)
NewAction creates an action given a function and optionally a parameter list params.
func (*Action) Equal ¶
Equal returns true if both action a and action b are equivalent, and false otherwise.
func (*Action) Function ¶
func (a *Action) Function() (f interface{})
Function returns the function f associated to the action a.
func (*Action) Parameters ¶
func (a *Action) Parameters() (p []interface{})
Parameters returns the actual paramaters p which optionally can be applied to action a.
func (*Action) Signature ¶
func (a *Action) Signature() (s ActionSignature)
Signature returns the signature s belonging to an action a.
type ActionSignature ¶
type ActionSignature struct { Oper container.Signature Func container.Signature Params container.Signature }
ActionSignature is a structure for storing signature information for faster matching.
func (ActionSignature) String ¶
func (as ActionSignature) String() (s string)
String returns print friendly representation of an action signature as.
type Aggregation ¶
type Aggregation struct { Lbl container.Label AggRule AggregationRule }
Aggregation is a structure defining how an aggregation operation should be transformed by an aggregation rule.
func NewAggregation ¶
func NewAggregation(l container.Label, r AggregationRule) (ap Aggregation)
NewAggregation constructs a new policy given a label l an aggregation rule r.
func (*Aggregation) Action ¶
func (ap *Aggregation) Action() (a Action)
Action returns the acction associated to the aggregation rule.
func (*Aggregation) Apply ¶
func (*Aggregation) Apply(ia Action) (oa Action)
Apply applies an aggregation policy onto the input action ia. Apply returns a modified action oa
func (*Aggregation) Label ¶
func (ap *Aggregation) Label() (l container.Label)
Label returns the label l attached to aggregation policy ap.
type AggregationRule ¶
type AggregationRule struct { Object Action Subject Transformations }
AggregationRule is a structure defining what transformations an action is subject to. The action is the object and the transformations are the subjects which will be applied to the action.
func NewAggregationRule ¶
func NewAggregationRule(a Action, trs Transformations) (ar AggregationRule)
NewAggregationRule constructs a new policy given an action a and a list of transformation trs.
func (*AggregationRule) Action ¶
func (ar *AggregationRule) Action() (a Action)
Action returns an action a associated to the aggregation rule ar.
func (*AggregationRule) Transformations ¶
func (ar *AggregationRule) Transformations() (tr Transformations)
Transformations returns the transformations that are associated to the aggregation rule ar.
type Composable ¶
type Composable struct { ActionMap *sync.Map // [ActionTypeSignature]Set(Template,Label) LabelMap *sync.Map // [Label]AggregationPolicy }
Composable is a structure for containing composable policies.
func NewComposable ¶
func NewComposable(aps ...Aggregation) (cp *Composable)
NewComposable creates a composable policy cp from any amount of aggregation policies aps.
func (*Composable) Add ¶
func (cp *Composable) Add(ap Aggregation) (b bool)
Add adds an aggregation policy ap to the composable policy cp. Add returns true if the aggregation policy ap has been added to the composable policy cp, and false otherwise.
func (*Composable) Delete ¶
func (cp *Composable) Delete(l container.Label) (b bool)
Delete removes an aggregation policy with label l from the composable policy cp. Delete returns true if an aggregation policy with label l has been deleted from the composable policy cp, and false otherwise.
func (*Composable) Find ¶
func (cp *Composable) Find(a *Action) (l *container.Label)
Find returns a reference to a label l given an action a.
func (*Composable) Retrieve ¶
func (cp *Composable) Retrieve(l container.Label) (ap *Aggregation)
Retrieve returns a reference to the aggregation policy ap with label l from the composable policy cp. Retrieve returns a reference if it exists and nil otherwise.
func (Composable) String ¶
func (cp Composable) String() (s string)
String returns a print friendly representation of a composable policy cp.
type Transformation ¶
type Transformation struct { Func interface{} Params []interface{} }
Transformation defines a structure for a transformation.
func NewTransformation ¶
func NewTransformation(fun interface{}, params ...interface{}) (tr Transformation)
NewTransformation creates a new transformation from a function and optional parameter list params.
func (*Transformation) Apply ¶
func (tr *Transformation) Apply(fparams ...interface{}) (res interface{}, err error)
Apply applies attached transformation and additionally passed parameters fparams. Apply returns an encapsulated result res and an error err if function application failed.
func (*Transformation) Function ¶
func (tr *Transformation) Function() (f interface{})
Function returns the function associated to the transformation tr.
func (*Transformation) Parameters ¶
func (tr *Transformation) Parameters() (p []interface{})
Parameters returns the parameters associated to the transformation tr.
func (Transformation) String ¶
func (tr Transformation) String() (s string)
String returns print friendly representation of a transformation tr.
type TransformationError ¶
type TransformationError struct {
// contains filtered or unexported fields
}
TransformationError defines an error occuring during a application of a transformation.
func (*TransformationError) Error ¶
func (err *TransformationError) Error() (msg string)
Error returns an error msg associated to the transformation tr.
type Transformations ¶
type Transformations struct { Tmpl Transformation Mtch Transformation Rslt Transformation }
Transformations defines a structure for a collection of transformations to be applied.
func NewTransformations ¶
func NewTransformations(tr ...*Transformation) (trs *Transformations)
NewTransformations creates a collection of transformations to be applied. NewTransformations returns a pointer to a collection if exactly 3 types of transformations are specified, otherwise nil is returned.
func (*Transformations) Match ¶
func (trs *Transformations) Match() (match *Transformation)
Match returns an transformation that can be applied to matched entities.
func (*Transformations) Result ¶
func (trs *Transformations) Result() (rslt *Transformation)
Result returns an transformation that can be applied to result entities.
func (*Transformations) Template ¶
func (trs *Transformations) Template() (trans *Transformation)
Template returns a transformation that can be applied to template entities.