2023-09-12 12:50:18 +00:00
|
|
|
|
using Core;
|
|
|
|
|
using KubernetesWorkflow;
|
|
|
|
|
|
|
|
|
|
namespace CodexPlugin
|
|
|
|
|
{
|
|
|
|
|
public static class CoreInterfaceExtensions
|
|
|
|
|
{
|
2023-09-20 10:02:32 +00:00
|
|
|
|
public static RunningContainers[] DeployCodexNodes(this CoreInterface ci, int number, Action<ICodexSetup> setup)
|
2023-09-12 12:50:18 +00:00
|
|
|
|
{
|
2023-09-20 10:02:32 +00:00
|
|
|
|
return Plugin(ci).DeployCodexNodes(number, setup);
|
2023-09-12 12:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-20 11:33:58 +00:00
|
|
|
|
public static ICodexNodeGroup WrapCodexContainers(this CoreInterface ci, RunningContainer[] containers)
|
|
|
|
|
{
|
|
|
|
|
// ew, clean this up.
|
|
|
|
|
var rcs = new RunningContainers(null!, containers.First().Pod, containers);
|
|
|
|
|
return WrapCodexContainers(ci, new[] { rcs });
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-12 12:50:18 +00:00
|
|
|
|
public static ICodexNodeGroup WrapCodexContainers(this CoreInterface ci, RunningContainers[] containers)
|
|
|
|
|
{
|
2023-09-19 11:58:45 +00:00
|
|
|
|
return Plugin(ci).WrapCodexContainers(ci, containers);
|
2023-09-12 12:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-20 10:02:32 +00:00
|
|
|
|
public static ICodexNode StartCodexNode(this CoreInterface ci)
|
2023-09-12 13:43:30 +00:00
|
|
|
|
{
|
2023-09-20 10:02:32 +00:00
|
|
|
|
return ci.StartCodexNodes(1)[0];
|
2023-09-12 13:43:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-20 10:02:32 +00:00
|
|
|
|
public static ICodexNode StartCodexNode(this CoreInterface ci, Action<ICodexSetup> setup)
|
2023-09-12 12:50:18 +00:00
|
|
|
|
{
|
2023-09-20 10:02:32 +00:00
|
|
|
|
return ci.StartCodexNodes(1, setup)[0];
|
2023-09-12 12:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-20 10:02:32 +00:00
|
|
|
|
public static ICodexNodeGroup StartCodexNodes(this CoreInterface ci, int number, Action<ICodexSetup> setup)
|
2023-09-12 12:50:18 +00:00
|
|
|
|
{
|
2023-09-20 10:02:32 +00:00
|
|
|
|
var rc = ci.DeployCodexNodes(number, setup);
|
2023-09-20 06:45:55 +00:00
|
|
|
|
var result = ci.WrapCodexContainers(rc);
|
|
|
|
|
Plugin(ci).WireUpMarketplace(result, setup);
|
|
|
|
|
return result;
|
2023-09-12 12:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-20 10:02:32 +00:00
|
|
|
|
public static ICodexNodeGroup StartCodexNodes(this CoreInterface ci, int number)
|
2023-09-12 12:50:18 +00:00
|
|
|
|
{
|
2023-09-20 10:02:32 +00:00
|
|
|
|
return ci.StartCodexNodes(number, s => { });
|
2023-09-12 12:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static CodexPlugin Plugin(CoreInterface ci)
|
|
|
|
|
{
|
|
|
|
|
return ci.GetPlugin<CodexPlugin>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|