Documentation
¶
Index ¶
Constants ¶
View Source
const ( // RuleAny denotes any rule type RuleAny = iota // RuleRoute denotes rules with a routing field RuleRoute // RuleAction denotes rules with an action field RuleAction )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct { // IDs is the set of acceptable rule IDs. A rule will pass the filter if its ID is a member of this set. // This field is ignored when len(IDs) <= 0. IDs []string // Tags is the set of tags each rule must contain. A rule will pass the filter if its tags are a subset of this // set. This field is ignored when len(Tags) <= 0. Tags []string // Destinations is the set of acceptable rule destinations. A rule will pass the filter if its destination is // a member of this set. This field is ignored when len(Destinations) <= 0. Destinations []string // RuleType is the type of rule to filter by. RuleType int }
Filter to apply to sets of rules.
type InvalidRuleError ¶
type InvalidRuleError struct{}
InvalidRuleError occurs when a rule is not valid
type JSONMarshalError ¶
type JSONMarshalError struct {
Message string
}
JSONMarshalError describes a JSON marshal or unmarshaling error
type Manager ¶
type Manager interface { // AddRules validates the rules and adds them to the collection for the namespace. AddRules(namespace string, rules []Rule) (NewRules, error) // GetRules returns a collection of filtered rules from the namespace. GetRules(namespace string, filter Filter) (RetrievedRules, error) // UpdateRules updates rules by ID in the namespace. UpdateRules(namespace string, rules []Rule) error // DeleteRules deletes rules that match the filter in the namespace. DeleteRules(namespace string, filter Filter) error // SetRules deletes the rules that match the filter and adds the new rules as a single // atomic transaction. SetRules(namespace string, filter Filter, rules []Rule) (NewRules, error) }
Manager is an interface for managing collections of rules mapped by namespace.
func NewMemoryManager ¶
NewMemoryManager constructs a new in memory manager.
func NewRedisManager ¶
NewRedisManager creates a Redis backed manager implementation.
type NewRules ¶
type NewRules struct { // IDs of the added rules. IDs []string }
NewRules provides information about newly added rules.
type RedisInsertError ¶
type RedisInsertError struct{}
RedisInsertError occurs when there is an issue writing to Redis
type RetrievedRules ¶
type RetrievedRules struct { // Rules that passed the filter. Rules []Rule // Revision of the rules for this namespace. Each time the collection of rules for the namespace are changed // the revision is incremented. Revision int64 }
RetrievedRules are the results of a read from a manager.
type Rule ¶
type Rule struct { ID string `json:"id"` Priority int `json:"priority"` Tags []string `json:"tags,omitempty"` Destination string `json:"destination"` Match json.RawMessage `json:"match,omitempty"` Route json.RawMessage `json:"route,omitempty"` Actions json.RawMessage `json:"actions,omitempty"` }
Rule represents an individual rule.
func FilterRules ¶
FilterRules returns a list of filtered rules.
Click to show internal directories.
Click to hide internal directories.