Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidCondition is returned if a condition is supplied that doesn't meet the requirements of the method. // For example, providing a condition without a cron field to the addCronEntry rule would yield this error. ErrInvalidCondition = errors.New("invalid condition supplied") // ErrInvalidAction is returned if an action is supplied that doesn't meet the requirements of the method. // For example, providing a timer action with an empty body would yield this error. ErrInvalidAction = errors.New("invalid action supplied") )
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine contains a single instance of a policy engine. This engine contains one or more policies, subscribes to updates from one or more services to trigger conditional changes, and uses these subscribed services to execute one or more actions when the relevant policy executes.
func (*Engine) AddPolicy ¶
func (e *Engine) AddPolicy(policy *Policy)
AddPolicy registers a new policy with the policy engine. Policies are held in an ordered list, descending by their weights, and this add will ensure the inserted policy is placed in the appropriate location.
type State ¶
type State struct {
// contains filtered or unexported fields
}
State represents the current state of the system this policy engine is monitoring. The engine will subscribe to updates from this state, and will execute operations against this state to change the state of the system.