cs-codex-dist-tests/ProjectPlugins/CodexPlugin/CodexStartupConfig.cs

104 lines
3.7 KiB
C#
Raw Normal View History

using KubernetesWorkflow;
2023-09-08 07:39:56 +00:00
using Utils;
2023-04-13 07:33:10 +00:00
namespace CodexPlugin
2023-04-12 11:53:55 +00:00
{
public class CodexStartupConfig
{
public string? NameOverride { get; set; }
2023-09-25 06:47:19 +00:00
public ILocation Location { get; set; } = KnownLocations.UnspecifiedLocation;
public CodexLogLevel LogLevel { get; set; }
2023-10-17 11:52:04 +00:00
public CodexLogCustomTopics? CustomTopics { get; set; } = new CodexLogCustomTopics(CodexLogLevel.Warn, CodexLogLevel.Warn);
2023-04-12 11:53:55 +00:00
public ByteSize? StorageQuota { get; set; }
2023-09-13 09:59:21 +00:00
public bool MetricsEnabled { get; set; }
2023-09-19 08:24:43 +00:00
public MarketplaceInitialConfig? MarketplaceConfig { get; set; }
public string? BootstrapSpr { get; set; }
public int? BlockTTL { get; set; }
public uint? SimulateProofFailures { get; set; }
public bool? EnableValidator { get; set; }
public TimeSpan? BlockMaintenanceInterval { get; set; }
public int? BlockMaintenanceNumber { get; set; }
public CodexTestNetConfig? PublicTestNet { get; set; }
public string LogLevelWithTopics()
{
var level = LogLevel.ToString()!.ToUpperInvariant();
if (CustomTopics != null)
{
var discV5Topics = new[]
{
"discv5",
"providers",
"manager",
"cache",
};
var libp2pTopics = new[]
{
"libp2p",
"multistream",
"switch",
"transport",
"tcptransport",
"semaphore",
"asyncstreamwrapper",
2023-10-08 06:04:04 +00:00
"lpstream",
"mplex",
"mplexchannel",
"noise",
"bufferstream",
"mplexcoder",
"secure",
"chronosstream",
"connection",
"connmanager",
2023-10-08 06:04:04 +00:00
"websock",
2024-01-18 09:24:59 +00:00
"ws-session",
"dialer",
"muxedupgrade",
"upgrade",
"identify"
};
2024-01-18 08:55:07 +00:00
var blockExchangeTopics = new[]
{
"codex",
"pendingblocks",
"peerctxstore",
"discoveryengine",
2024-01-18 09:24:59 +00:00
"blockexcengine",
"blockexcnetwork",
"blockexcnetworkpeer"
2024-01-18 08:55:07 +00:00
};
2024-03-14 13:29:28 +00:00
var contractClockTopics = new[]
{
"contracts",
"clock"
};
var jsonSerializeTopics = new[]
{
"serde",
"json",
"serialization"
};
level = $"{level};" +
$"{CustomTopics.DiscV5.ToString()!.ToLowerInvariant()}:{string.Join(",", discV5Topics)};" +
2024-03-14 13:29:28 +00:00
$"{CustomTopics.Libp2p.ToString()!.ToLowerInvariant()}:{string.Join(",", libp2pTopics)};" +
$"{CustomTopics.ContractClock.ToString().ToLowerInvariant()}:{string.Join(",", contractClockTopics)};" +
$"{CustomTopics.JsonSerialize.ToString().ToLowerInvariant()}:{string.Join(",", jsonSerializeTopics)}";
2024-01-18 08:55:07 +00:00
if (CustomTopics.BlockExchange != null)
{
level += $";{CustomTopics.BlockExchange.ToString()!.ToLowerInvariant()}:{string.Join(",", blockExchangeTopics)}";
}
}
return level;
}
2023-04-12 11:53:55 +00:00
}
public class CodexTestNetConfig
{
public int PublicDiscoveryPort { get; set; }
public int PublicListenPort { get; set; }
}
2023-04-12 11:53:55 +00:00
}