2017-02-05 22:22:34 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace Tapeti.Flow.Default
|
|
|
|
|
{
|
|
|
|
|
public class FlowState
|
|
|
|
|
{
|
|
|
|
|
private FlowMetadata metadata;
|
|
|
|
|
private Dictionary<Guid, ContinuationMetadata> continuations;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public FlowMetadata Metadata
|
|
|
|
|
{
|
2018-12-19 19:50:56 +00:00
|
|
|
|
get => metadata ?? (metadata = new FlowMetadata());
|
|
|
|
|
set => metadata = value;
|
2017-02-05 22:22:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Data { get; set; }
|
|
|
|
|
|
|
|
|
|
public Dictionary<Guid, ContinuationMetadata> Continuations
|
|
|
|
|
{
|
2018-12-19 19:50:56 +00:00
|
|
|
|
get => continuations ?? (continuations = new Dictionary<Guid, ContinuationMetadata>());
|
|
|
|
|
set => continuations = value;
|
2017-02-05 22:22:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public FlowState Clone()
|
|
|
|
|
{
|
2017-10-17 08:34:07 +00:00
|
|
|
|
return new FlowState {
|
|
|
|
|
metadata = metadata.Clone(),
|
|
|
|
|
Data = Data,
|
|
|
|
|
continuations = continuations?.ToDictionary(kv => kv.Key, kv => kv.Value.Clone())
|
|
|
|
|
};
|
2017-02-05 22:22:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class FlowMetadata
|
|
|
|
|
{
|
|
|
|
|
public ReplyMetadata Reply { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public FlowMetadata Clone()
|
|
|
|
|
{
|
|
|
|
|
return new FlowMetadata
|
|
|
|
|
{
|
|
|
|
|
Reply = Reply?.Clone()
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ReplyMetadata
|
|
|
|
|
{
|
|
|
|
|
public string ReplyTo { get; set; }
|
|
|
|
|
public string CorrelationId { get; set; }
|
|
|
|
|
public string ResponseTypeName { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ReplyMetadata Clone()
|
|
|
|
|
{
|
|
|
|
|
return new ReplyMetadata
|
|
|
|
|
{
|
|
|
|
|
ReplyTo = ReplyTo,
|
|
|
|
|
CorrelationId = CorrelationId,
|
|
|
|
|
ResponseTypeName = ResponseTypeName
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ContinuationMetadata
|
|
|
|
|
{
|
|
|
|
|
public string MethodName { get; set; }
|
|
|
|
|
public string ConvergeMethodName { get; set; }
|
2017-02-12 18:04:26 +00:00
|
|
|
|
public bool ConvergeMethodSync { get; set; }
|
2017-02-05 22:22:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContinuationMetadata Clone()
|
|
|
|
|
{
|
|
|
|
|
return new ContinuationMetadata
|
|
|
|
|
{
|
|
|
|
|
MethodName = MethodName,
|
2017-02-12 18:04:26 +00:00
|
|
|
|
ConvergeMethodName = ConvergeMethodName,
|
|
|
|
|
ConvergeMethodSync = ConvergeMethodSync
|
2017-02-05 22:22:34 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|