config+pilot: define autopilot.heuristic

And validate the config set by the user.
This commit is contained in:
Johan T. Halseth
2018-12-19 18:56:43 +01:00
parent c0fed861d2
commit 36e7694e8e
3 changed files with 90 additions and 7 deletions

View File

@@ -142,6 +142,27 @@ type AttachmentHeuristic interface {
map[NodeID]*NodeScore, error)
}
var (
// availableHeuristics holds all heuristics possible to combine for use
// with the autopilot agent.
availableHeuristics = []AttachmentHeuristic{
NewPrefAttachment(),
}
// AvailableHeuristics is a map that holds the name of available
// heuristics to the actual heuristic for easy lookup. It will be
// filled during init().
AvailableHeuristics = make(map[string]AttachmentHeuristic)
)
func init() {
// Fill the map from heuristic names to available heuristics for easy
// lookup.
for _, h := range availableHeuristics {
AvailableHeuristics[h.Name()] = h
}
}
// ChannelController is a simple interface that allows an auto-pilot agent to
// open a channel within the graph to a target peer, close targeted channels,
// or add/remove funds from existing channels via a splice in/out mechanisms.