mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-03 22:13:10 +00:00
updates marketplace contract, fixes type conversions
This commit is contained in:
parent
dc7a034566
commit
0c961b8348
@ -61,7 +61,8 @@ namespace KubernetesWorkflow
|
||||
var startResult = controller.BringOnline(recipes, location);
|
||||
var containers = CreateContainers(startResult, recipes, startupConfig);
|
||||
|
||||
var rc = new RunningPod(Guid.NewGuid().ToString(), startupConfig, startResult, containers);
|
||||
var info = GetPodInfo(startResult.Deployment);
|
||||
var rc = new RunningPod(Guid.NewGuid().ToString(), info, startupConfig, startResult, containers);
|
||||
cluster.Configuration.Hooks.OnContainersStarted(rc);
|
||||
|
||||
if (startResult.ExternalService != null)
|
||||
@ -83,9 +84,14 @@ namespace KubernetesWorkflow
|
||||
});
|
||||
}
|
||||
|
||||
public PodInfo GetPodInfo(RunningDeployment deployment)
|
||||
{
|
||||
return K8s(c => c.GetPodInfo(deployment));
|
||||
}
|
||||
|
||||
public PodInfo GetPodInfo(RunningContainer container)
|
||||
{
|
||||
return K8s(c => c.GetPodInfo(container.RunningPod.StartResult.Deployment));
|
||||
return GetPodInfo(container.RunningPod.StartResult.Deployment);
|
||||
}
|
||||
|
||||
public PodInfo GetPodInfo(RunningPod pod)
|
||||
|
||||
@ -4,9 +4,10 @@ namespace KubernetesWorkflow.Types
|
||||
{
|
||||
public class RunningPod
|
||||
{
|
||||
public RunningPod(string id, StartupConfig startupConfig, StartResult startResult, RunningContainer[] containers)
|
||||
public RunningPod(string id, PodInfo podInfo, StartupConfig startupConfig, StartResult startResult, RunningContainer[] containers)
|
||||
{
|
||||
Id = id;
|
||||
PodInfo = podInfo;
|
||||
StartupConfig = startupConfig;
|
||||
StartResult = startResult;
|
||||
Containers = containers;
|
||||
@ -15,6 +16,7 @@ namespace KubernetesWorkflow.Types
|
||||
}
|
||||
|
||||
public string Id { get; }
|
||||
public PodInfo PodInfo { get; }
|
||||
public StartupConfig StartupConfig { get; }
|
||||
public StartResult StartResult { get; }
|
||||
public RunningContainer[] Containers { get; }
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -14,7 +14,7 @@ namespace CodexPlugin
|
||||
name: container.Name,
|
||||
imageName: container.Recipe.Image,
|
||||
startUtc: container.Recipe.RecipeCreatedUtc,
|
||||
discoveryEndpoint: container.GetInternalAddress(CodexContainerRecipe.DiscoveryPortTag),
|
||||
discoveryEndpoint: SetClusterInternalIpAddress(pod, container.GetInternalAddress(CodexContainerRecipe.DiscoveryPortTag)),
|
||||
apiEndpoint: container.GetAddress(CodexContainerRecipe.ApiPortTag),
|
||||
listenEndpoint: container.GetInternalAddress(CodexContainerRecipe.ListenPortTag),
|
||||
ethAccount: container.Recipe.Additionals.Get<EthAccount>(),
|
||||
@ -22,13 +22,14 @@ namespace CodexPlugin
|
||||
);
|
||||
}
|
||||
|
||||
// todo: is this needed for the discovery address??
|
||||
//var info = codexAccess.GetPodInfo();
|
||||
//return new Address(
|
||||
// logName: $"{GetName()}:DiscoveryPort",
|
||||
// host: info.Ip,
|
||||
// port: Container.Recipe.GetPortByTag(CodexContainerRecipe.DiscoveryPortTag)!.Number
|
||||
//);
|
||||
private static Address SetClusterInternalIpAddress(RunningPod pod, Address address)
|
||||
{
|
||||
return new Address(
|
||||
logName: address.LogName,
|
||||
host: pod.PodInfo.Ip,
|
||||
port: address.Port
|
||||
);
|
||||
}
|
||||
|
||||
private static Address? GetMetricsEndpoint(RunningContainer container)
|
||||
{
|
||||
|
||||
@ -78,6 +78,11 @@ namespace MarketInsights
|
||||
average.ProofProbability = GetNewAverage(average.ProofProbability, average.Number, requestEvent.Request.Request.Ask.ProofProbability);
|
||||
}
|
||||
|
||||
private float GetNewAverage(float currentAverage, int newNumberOfValues, ulong newValue)
|
||||
{
|
||||
return GetNewAverage(currentAverage, newNumberOfValues, Convert.ToSingle(newValue));
|
||||
}
|
||||
|
||||
private float GetNewAverage(float currentAverage, int newNumberOfValues, BigInteger newValue)
|
||||
{
|
||||
return GetNewAverage(currentAverage, newNumberOfValues, (float)newValue);
|
||||
|
||||
@ -95,8 +95,8 @@ namespace TestNetRewarder
|
||||
|
||||
private bool MeetsSizeRequirement(IChainStateRequest r)
|
||||
{
|
||||
var slotSize = r.Request.Ask.SlotSize.ToDecimal();
|
||||
decimal min = reward.CheckConfig.MinSlotSize.SizeInBytes;
|
||||
var slotSize = r.Request.Ask.SlotSize;
|
||||
ulong min = Convert.ToUInt64(reward.CheckConfig.MinSlotSize.SizeInBytes);
|
||||
return slotSize >= min;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user