Skip to content

Commit c34c35d

Browse files
committed
cmd/commands: update query+import+rc mc to accept an mc namespace
1 parent 29ba968 commit c34c35d

File tree

2 files changed

+46
-10
lines changed

2 files changed

+46
-10
lines changed

cmd/commands/cmd_import_mission_control.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ var importMissionControlCommand = cli.Command{
3131
Name: "force",
3232
Usage: "whether to force the history entry import",
3333
},
34+
&cli.StringFlag{
35+
Name: "mission_control_namespace",
36+
Usage: "an optional mission control namespace to import " +
37+
"into. If not specified, the default " +
38+
"mission control namespace will be used.",
39+
},
3440
},
3541
}
3642

@@ -94,7 +100,8 @@ func importMissionControl(ctx *cli.Context) error {
94100
Pairs: []*routerrpc.PairHistory{
95101
importResult,
96102
},
97-
Force: ctx.IsSet("force"),
103+
Force: ctx.IsSet("force"),
104+
MissionControlNamespace: ctx.String("mission_control_namespace"),
98105
}
99106

100107
rpcCtx := context.Background()

cmd/commands/cmd_mission_control.go

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,15 @@ var queryMissionControlCommand = cli.Command{
273273
Name: "querymc",
274274
Category: "Mission Control",
275275
Usage: "Query the internal mission control state.",
276-
Action: actionDecorator(queryMissionControl),
276+
Flags: []cli.Flag{
277+
&cli.StringFlag{
278+
Name: "mission_control_namespace",
279+
Usage: "an optional mission control namespace to query. " +
280+
"If not specified, the default mission control " +
281+
"namespace will be used.",
282+
},
283+
},
284+
Action: actionDecorator(queryMissionControl),
277285
}
278286

279287
func queryMissionControl(ctx *cli.Context) error {
@@ -283,7 +291,9 @@ func queryMissionControl(ctx *cli.Context) error {
283291

284292
client := routerrpc.NewRouterClient(conn)
285293

286-
req := &routerrpc.QueryMissionControlRequest{}
294+
req := &routerrpc.QueryMissionControlRequest{
295+
MissionControlNamespace: ctx.String("mission_control_namespace"),
296+
}
287297
snapshot, err := client.QueryMissionControl(ctxc, req)
288298
if err != nil {
289299
return err
@@ -299,8 +309,16 @@ var queryProbCommand = cli.Command{
299309
Category: "Mission Control",
300310
Usage: "Deprecated. Estimate a success probability.",
301311
ArgsUsage: "from-node to-node amt",
302-
Action: actionDecorator(queryProb),
303-
Hidden: true,
312+
Flags: []cli.Flag{
313+
&cli.StringFlag{
314+
Name: "mission_control_namespace",
315+
Usage: "an optional mission control namespace to query. " +
316+
"If not specified, the default mission control " +
317+
"namespace will be used.",
318+
},
319+
},
320+
Action: actionDecorator(queryProb),
321+
Hidden: true,
304322
}
305323

306324
func queryProb(ctx *cli.Context) error {
@@ -336,9 +354,10 @@ func queryProb(ctx *cli.Context) error {
336354
client := routerrpc.NewRouterClient(conn)
337355

338356
req := &routerrpc.QueryProbabilityRequest{
339-
FromNode: fromNode[:],
340-
ToNode: toNode[:],
341-
AmtMsat: int64(amtMsat),
357+
FromNode: fromNode[:],
358+
ToNode: toNode[:],
359+
AmtMsat: int64(amtMsat),
360+
MissionControlNamespace: ctx.String("mission_control_namespace"),
342361
}
343362

344363
response, err := client.QueryProbability(ctxc, req)
@@ -355,7 +374,15 @@ var resetMissionControlCommand = cli.Command{
355374
Name: "resetmc",
356375
Category: "Mission Control",
357376
Usage: "Reset internal mission control state.",
358-
Action: actionDecorator(resetMissionControl),
377+
Flags: []cli.Flag{
378+
&cli.StringFlag{
379+
Name: "mission_control_namespace",
380+
Usage: "an optional mission control namespace to reset. " +
381+
"If not specified, the default mission control " +
382+
"namespace will be used.",
383+
},
384+
},
385+
Action: actionDecorator(resetMissionControl),
359386
}
360387

361388
func resetMissionControl(ctx *cli.Context) error {
@@ -365,7 +392,9 @@ func resetMissionControl(ctx *cli.Context) error {
365392

366393
client := routerrpc.NewRouterClient(conn)
367394

368-
req := &routerrpc.ResetMissionControlRequest{}
395+
req := &routerrpc.ResetMissionControlRequest{
396+
MissionControlNamespace: ctx.String("mission_control_namespace"),
397+
}
369398
_, err := client.ResetMissionControl(ctxc, req)
370399

371400
return err

0 commit comments

Comments
 (0)