Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/connectors/pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ As with all configs, the standard wrapper is used.
"specVersion": "v1", // Must be set to the correct version
"selector": {}, // May be used to apply this to a subset of charges
"spec": {
"selectMode": "default", // Can be set to: "default" or "priorityMerge"
"restriction": "unrestricted", // Can be set to: "unrestricted", "noRepeat" or "lowestUsage"
"connectors": [ // Connectors contains the list of connectors in the pool
{
Expand All @@ -29,6 +30,7 @@ As with all configs, the standard wrapper is used.
## Spec Definition
FieldName | Required | Definition
---:|---|:---
selectMode | false | "default" or "priorityMerge"
restriction | false | "unrestricted" (Default) , "noRepeat" or "lowestUsage"
[connectors](#connector-definition) | false | Non-empty list of the connectors in the pool

Expand Down
11 changes: 11 additions & 0 deletions v1/connector/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,19 @@ const (
RestrictionLowestUsage Restriction = "lowestUsage"
)

type SelectMode string

const (
// SelectModeDefault groups all connectors in the pool, and orders by priority
SelectModeDefault SelectMode = "default"

// SelectModePriorityMerge selects a single connector from each priority (after weighting shuffle)
SelectModePriorityMerge SelectMode = "priorityMerge"
)

// Pool is used to select a group of connectors and the order that they should be used in
type Pool struct {
SelectMode SelectMode `json:"selectMode" yaml:"selectMode" validate:"oneof=default priorityMerge"`
Restriction Restriction `json:"restriction" yaml:"restriction" validate:"oneof=unrestricted noRepeat lowestUsage"`
Connectors []PoolItem `json:"connectors" yaml:"connectors" validate:"gt=0,dive"`
}
Expand Down