From 97442da8f705bfaa8a30e354e29ff4cfdfce4c4b Mon Sep 17 00:00:00 2001 From: carla Date: Tue, 19 Jan 2021 10:57:11 +0200 Subject: [PATCH] routing: add string method for cfg --- routing/missioncontrol.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/routing/missioncontrol.go b/routing/missioncontrol.go index ac281a8e..5d91e69c 100644 --- a/routing/missioncontrol.go +++ b/routing/missioncontrol.go @@ -1,6 +1,7 @@ package routing import ( + "fmt" "sync" "time" @@ -125,6 +126,15 @@ type MissionControlConfig struct { MinFailureRelaxInterval time.Duration } +// String returns a string representation of a mission control config. +func (c *MissionControlConfig) String() string { + return fmt.Sprintf("Penalty Half Life: %v, Apriori Hop "+ + "Probablity: %v, Maximum History: %v, Apriori Weight: %v, "+ + "Minimum Failure Relax Interval: %v", c.PenaltyHalfLife, + c.AprioriHopProbability, c.MaxMcHistory, c.AprioriWeight, + c.MinFailureRelaxInterval) +} + // TimedPairResult describes a timestamped pair result. type TimedPairResult struct { // FailTime is the time of the last failure. @@ -178,10 +188,7 @@ type paymentResult struct { func NewMissionControl(db kvdb.Backend, self route.Vertex, cfg *MissionControlConfig) (*MissionControl, error) { - log.Debugf("Instantiating mission control with config: "+ - "PenaltyHalfLife=%v, AprioriHopProbability=%v, "+ - "AprioriWeight=%v", cfg.PenaltyHalfLife, - cfg.AprioriHopProbability, cfg.AprioriWeight) + log.Debugf("Instantiating mission control with config: %v", cfg) store, err := newMissionControlStore(db, cfg.MaxMcHistory) if err != nil {