cs-codex-dist-tests/DistTestCore/CodexNodeFactory.cs

33 lines
1.2 KiB
C#
Raw Normal View History

2023-04-13 12:36:17 +00:00
using DistTestCore.Codex;
2023-04-14 08:51:35 +00:00
using DistTestCore.Marketplace;
2023-04-13 12:36:17 +00:00
using DistTestCore.Metrics;
namespace DistTestCore
{
public interface ICodexNodeFactory
{
OnlineCodexNode CreateOnlineCodexNode(CodexAccess access, CodexNodeGroup group);
}
public class CodexNodeFactory : ICodexNodeFactory
{
private readonly TestLifecycle lifecycle;
private readonly IMetricsAccessFactory metricsAccessFactory;
2023-04-14 08:51:35 +00:00
private readonly IMarketplaceAccessFactory marketplaceAccessFactory;
2023-04-13 12:36:17 +00:00
2023-04-14 08:51:35 +00:00
public CodexNodeFactory(TestLifecycle lifecycle, IMetricsAccessFactory metricsAccessFactory, IMarketplaceAccessFactory marketplaceAccessFactory)
2023-04-13 12:36:17 +00:00
{
this.lifecycle = lifecycle;
this.metricsAccessFactory = metricsAccessFactory;
2023-04-14 08:51:35 +00:00
this.marketplaceAccessFactory = marketplaceAccessFactory;
2023-04-13 12:36:17 +00:00
}
public OnlineCodexNode CreateOnlineCodexNode(CodexAccess access, CodexNodeGroup group)
{
var metricsAccess = metricsAccessFactory.CreateMetricsAccess(access.Container);
2023-04-14 08:51:35 +00:00
var marketplaceAccess = marketplaceAccessFactory.CreateMarketplaceAccess();
return new OnlineCodexNode(lifecycle, access, group, metricsAccess, marketplaceAccess);
2023-04-13 12:36:17 +00:00
}
}
}