2023-04-12 13:11:36 +00:00
|
|
|
|
using Utils;
|
|
|
|
|
|
|
|
|
|
namespace KubernetesWorkflow
|
|
|
|
|
{
|
|
|
|
|
public class WorkflowNumberSource
|
|
|
|
|
{
|
|
|
|
|
private readonly NumberSource servicePortNumberSource;
|
2023-04-13 09:07:36 +00:00
|
|
|
|
private readonly NumberSource containerNumberSource;
|
2023-04-12 13:11:36 +00:00
|
|
|
|
|
2023-04-13 09:07:36 +00:00
|
|
|
|
public WorkflowNumberSource(int workflowNumber, NumberSource servicePortNumberSource, NumberSource containerNumberSource)
|
2023-04-12 13:11:36 +00:00
|
|
|
|
{
|
|
|
|
|
WorkflowNumber = workflowNumber;
|
|
|
|
|
this.servicePortNumberSource = servicePortNumberSource;
|
2023-04-13 09:07:36 +00:00
|
|
|
|
this.containerNumberSource = containerNumberSource;
|
2023-04-12 13:11:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int WorkflowNumber { get; }
|
|
|
|
|
|
|
|
|
|
public int GetContainerNumber()
|
|
|
|
|
{
|
|
|
|
|
return containerNumberSource.GetNextNumber();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int GetServicePort()
|
|
|
|
|
{
|
|
|
|
|
return servicePortNumberSource.GetNextNumber();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|