using Serein.Library; using Serein.Library.Utils; using System; using System.Collections.Generic; using System.Threading.Tasks; namespace Serein.Library.Api { /// /// 流程上下文,包含运行环境接口,可以通过注册环境事件或调用环境接口,实现在流程运行时更改流程行为。 /// public interface IDynamicContext { /// /// 标识流程 /// string Guid {get; } /// /// 运行环境,包含IOC容器。 /// IFlowEnvironment Env { get; } /// /// 是否正在运行 /// RunState RunState { get; } /// /// 下一个要执行的节点类别 /// ConnectionInvokeType NextOrientation { get; set; } /// /// 运行时异常信息 /// Exception ExceptionOfRuning { get; set; } /// /// 获取节点的运行时参数数据 /// /// 节点 /// 第几个参数 /// 数据 void SetParamsTempData(string nodeModel, int index, object data); /// /// 获取节点的运行时参数数据 /// /// 节点 /// 第几个参数 /// 获取到的参数 bool TryGetParamsTempData(string nodeModel, int index, out object data); /// /// 设置节点的运行时上一节点,用以多线程中隔开不同流程的数据 /// /// 当前节点 /// 运行时上一节点 void SetPreviousNode(string currentNodeModel, string PreviousNode); /// /// 获取当前节点的运行时上一节点,用以流程中获取数据 /// /// /// string GetPreviousNode(string currentNodeModel); /// /// 获取节点的数据(当前节点需要获取上一节点数据时,需要从 运行时上一节点 的Guid 通过这个方法进行获取 /// /// /// FlowResult GetFlowData(string nodeModel); /// /// 上一节点数据透传到下一节点 /// /// FlowResult TransmissionData(string nodeModel); /// /// 添加或更新当前节点的数据 /// /// /// void AddOrUpdateFlowData(string nodeModel, FlowResult flowData); /// /// 添加或更新当前节点的数据 /// /// /// void AddOrUpdate(string nodeModel, object data); /// /// 重置流程状态(用于对象池回收) /// void Reset(); /// /// 用以提前结束当前上下文流程的运行 /// void Exit(); } }