2023-09-12 11:32:06 +00:00
|
|
|
|
using Core;
|
2023-09-11 14:57:57 +00:00
|
|
|
|
using KubernetesWorkflow;
|
|
|
|
|
|
|
|
|
|
namespace CodexPlugin
|
|
|
|
|
{
|
2023-09-13 08:23:05 +00:00
|
|
|
|
public class CodexPlugin : IProjectPlugin, IHasLogPrefix
|
2023-09-11 14:57:57 +00:00
|
|
|
|
{
|
2023-09-13 08:03:11 +00:00
|
|
|
|
private readonly CodexStarter codexStarter;
|
|
|
|
|
private readonly IPluginTools tools;
|
2023-09-13 12:37:53 +00:00
|
|
|
|
private readonly CodexLogLevel defaultLogLevel = CodexLogLevel.Trace;
|
2023-09-11 14:57:57 +00:00
|
|
|
|
|
2023-09-13 08:03:11 +00:00
|
|
|
|
public CodexPlugin(IPluginTools tools)
|
2023-09-11 14:57:57 +00:00
|
|
|
|
{
|
2023-09-13 08:03:11 +00:00
|
|
|
|
codexStarter = new CodexStarter(tools);
|
|
|
|
|
this.tools = tools;
|
2023-09-12 08:31:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-13 08:23:05 +00:00
|
|
|
|
public string LogPrefix => "(Codex) ";
|
2023-09-13 08:03:11 +00:00
|
|
|
|
|
|
|
|
|
public void Announce()
|
2023-09-12 08:31:55 +00:00
|
|
|
|
{
|
2023-09-13 08:03:11 +00:00
|
|
|
|
tools.GetLog().Log("hello from codex plugin. codex container info here.");
|
2023-09-11 14:57:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-13 08:03:11 +00:00
|
|
|
|
public void Decommission()
|
2023-09-12 08:31:55 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-11 14:57:57 +00:00
|
|
|
|
public RunningContainers[] StartCodexNodes(int numberOfNodes, Action<ICodexSetup> setup)
|
|
|
|
|
{
|
2023-09-13 12:37:53 +00:00
|
|
|
|
var codexSetup = new CodexSetup(numberOfNodes);
|
|
|
|
|
codexSetup.LogLevel = defaultLogLevel;
|
2023-09-11 14:57:57 +00:00
|
|
|
|
setup(codexSetup);
|
|
|
|
|
return codexStarter.BringOnline(codexSetup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ICodexNodeGroup WrapCodexContainers(RunningContainers[] containers)
|
|
|
|
|
{
|
|
|
|
|
return codexStarter.WrapCodexContainers(containers);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|