2023-09-15 10:36:35 +00:00
|
|
|
|
using Core;
|
|
|
|
|
|
|
|
|
|
namespace GethPlugin
|
|
|
|
|
{
|
|
|
|
|
public class GethPlugin : IProjectPlugin, IHasLogPrefix, IHasMetadata
|
|
|
|
|
{
|
2023-09-15 13:52:02 +00:00
|
|
|
|
private readonly GethStarter starter;
|
2023-09-19 11:58:45 +00:00
|
|
|
|
private readonly IPluginTools tools;
|
2023-09-15 10:36:35 +00:00
|
|
|
|
|
|
|
|
|
public GethPlugin(IPluginTools tools)
|
|
|
|
|
{
|
2023-09-15 13:52:02 +00:00
|
|
|
|
starter = new GethStarter(tools);
|
2023-09-19 11:58:45 +00:00
|
|
|
|
this.tools = tools;
|
2023-09-15 10:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string LogPrefix => "(Geth) ";
|
|
|
|
|
|
|
|
|
|
public void Announce()
|
|
|
|
|
{
|
2023-09-19 11:58:45 +00:00
|
|
|
|
tools.GetLog().Log($"Loaded Geth plugin.");
|
2023-09-15 10:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AddMetadata(IAddMetadata metadata)
|
|
|
|
|
{
|
2023-09-19 11:58:45 +00:00
|
|
|
|
metadata.Add("gethid", GethContainerRecipe.DockerImage);
|
2023-09-15 10:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Decommission()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-20 08:13:29 +00:00
|
|
|
|
public GethDeployment DeployGeth(Action<IGethSetup> setup)
|
2023-09-15 13:52:02 +00:00
|
|
|
|
{
|
|
|
|
|
var startupConfig = new GethStartupConfig();
|
|
|
|
|
setup(startupConfig);
|
|
|
|
|
return starter.StartGeth(startupConfig);
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-20 08:13:29 +00:00
|
|
|
|
public IGethNode WrapGethDeployment(GethDeployment startResult)
|
2023-09-19 09:51:59 +00:00
|
|
|
|
{
|
2023-09-20 08:13:29 +00:00
|
|
|
|
startResult = SerializeGate.Gate(startResult);
|
|
|
|
|
return starter.WrapGethContainer(startResult);
|
2023-09-19 09:51:59 +00:00
|
|
|
|
}
|
2023-09-15 10:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
}
|