routing: add option to force import MC pair history
This commit adds the `force` flag to the `XImportMissionControl` RPC which allows skipping rules around the pair import except for what is mandatory to make values meaningful. This can be useful for when clients would like to forcibly override MC state in order to manipulate routing results.
This commit is contained in:
8 files changed
+479
-400
No files matched your search
@@ -363,7 +363,9 @@ func (m *MissionControl) GetHistorySnapshot() *MissionControlSnapshot {
|
||||
// ImportHistory imports the set of mission control results provided to our
|
||||
// in-memory state. These results are not persisted, so will not survive
|
||||
// restarts.
|
||||
func (m *MissionControl) ImportHistory(history *MissionControlSnapshot) error {
|
||||
func (m *MissionControl) ImportHistory(history *MissionControlSnapshot,
|
||||
force bool) error {
|
||||
|
||||
if history == nil {
|
||||
return errors.New("cannot import nil history")
|
||||
}
|
||||
@@ -374,7 +376,7 @@ func (m *MissionControl) ImportHistory(history *MissionControlSnapshot) error {
|
||||
log.Infof("Importing history snapshot with %v pairs to mission control",
|
||||
len(history.Pairs))
|
||||
|
||||
imported := m.state.importSnapshot(history)
|
||||
imported := m.state.importSnapshot(history, force)
|
||||
|
||||
log.Infof("Imported %v results to mission control", imported)
|
||||
|
||||
@@ -520,7 +522,7 @@ func (m *MissionControl) applyPaymentResult(
|
||||
}
|
||||
|
||||
m.state.setLastPairResult(
|
||||
pair.From, pair.To, result.timeReply, &pairResult,
|
||||
pair.From, pair.To, result.timeReply, &pairResult, false,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user