2017-01-31 11:01:08 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
2017-02-05 22:22:34 +00:00
|
|
|
|
using Tapeti.Flow.Default;
|
2017-01-31 11:01:08 +00:00
|
|
|
|
|
2018-12-19 19:50:56 +00:00
|
|
|
|
// ReSharper disable UnusedMember.Global
|
|
|
|
|
|
2017-01-31 11:01:08 +00:00
|
|
|
|
namespace Tapeti.Flow
|
|
|
|
|
{
|
2019-08-14 18:48:40 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provides a way to store and load flow state.
|
|
|
|
|
/// </summary>
|
2017-01-31 11:01:08 +00:00
|
|
|
|
public interface IFlowStore
|
|
|
|
|
{
|
2019-08-14 18:48:40 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Must be called during application startup before subscribing or starting a flow.
|
|
|
|
|
/// If using an IFlowRepository that requires an update (such as creating tables) make
|
|
|
|
|
/// sure it is called before calling Load.
|
|
|
|
|
/// </summary>
|
2017-01-31 11:01:08 +00:00
|
|
|
|
Task Load();
|
2019-08-14 18:48:40 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Looks up the FlowID corresponding to a ContinuationID. For internal use.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="continuationID"></param>
|
2017-02-05 22:22:34 +00:00
|
|
|
|
Task<Guid?> FindFlowID(Guid continuationID);
|
2019-08-14 18:48:40 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Acquires a lock on the flow with the specified FlowID.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="flowID"></param>
|
2017-02-05 22:22:34 +00:00
|
|
|
|
Task<IFlowStateLock> LockFlowState(Guid flowID);
|
2017-01-31 11:01:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-08-14 18:48:40 +00:00
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents a lock on the flow state, to provide thread safety.
|
|
|
|
|
/// </summary>
|
2017-01-31 11:01:08 +00:00
|
|
|
|
public interface IFlowStateLock : IDisposable
|
|
|
|
|
{
|
2019-08-14 18:48:40 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The unique ID of the flow state.
|
|
|
|
|
/// </summary>
|
2017-02-05 22:22:34 +00:00
|
|
|
|
Guid FlowID { get; }
|
|
|
|
|
|
2019-08-14 18:48:40 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Acquires a copy of the flow state.
|
|
|
|
|
/// </summary>
|
2017-01-31 11:01:08 +00:00
|
|
|
|
Task<FlowState> GetFlowState();
|
2019-08-14 18:48:40 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Stores the new flow state.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="flowState"></param>
|
2019-08-19 07:33:07 +00:00
|
|
|
|
/// <param name="persistent"></param>
|
|
|
|
|
Task StoreFlowState(FlowState flowState, bool persistent);
|
2019-08-14 18:48:40 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Disposes of the flow state corresponding to this Flow ID.
|
|
|
|
|
/// </summary>
|
2017-01-31 11:01:08 +00:00
|
|
|
|
Task DeleteFlowState();
|
|
|
|
|
}
|
|
|
|
|
}
|