JournaledGrain<TGrainState,TEventBase> 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。
public abstract class JournaledGrain<TGrainState,TEventBase> : Orleans.LogConsistency.LogConsistentGrainBase<TGrainState>, Orleans.LogConsistency.ILogConsistentGrain, Orleans.LogConsistency.ILogViewAdaptorHost<TGrainState,TEventBase>, Orleans.MultiCluster.ILogConsistencyProtocolParticipant where TGrainState : class, new() where TEventBase : class
public abstract class JournaledGrain<TGrainState,TEventBase> : Orleans.LogConsistency.LogConsistentGrain<TGrainState>, Orleans.IGrain, Orleans.LogConsistency.ILogViewAdaptorHost<TGrainState,TEventBase>, Orleans.MultiCluster.ILogConsistencyProtocolParticipant where TGrainState : class, new() where TEventBase : class
public abstract class JournaledGrain<TGrainState,TEventBase> : Orleans.EventSourcing.LogConsistentGrain<TGrainState>, Orleans.EventSourcing.ILogConsistencyProtocolParticipant, Orleans.EventSourcing.ILogViewAdaptorHost<TGrainState,TEventBase>, Orleans.IGrain where TGrainState : class, new() where TEventBase : class
type JournaledGrain<'GrainState, 'EventBase (requires 'GrainState : null and 'GrainState : (new : unit -> 'GrainState) and 'EventBase : null)> = class
inherit LogConsistentGrainBase<'GrainState (requires 'GrainState : null and 'GrainState : (new : unit -> 'GrainState))>
interface ILogConsistentGrain
interface ILogConsistencyProtocolParticipant
interface IGrain
interface IAddressable
interface ILogViewAdaptorHost<'GrainState, 'EventBase (requires 'GrainState : null and 'GrainState : (new : unit -> 'GrainState) and 'EventBase : null)>
interface IConnectionIssueListener
type JournaledGrain<'GrainState, 'EventBase (requires 'GrainState : null and 'GrainState : (new : unit -> 'GrainState) and 'EventBase : null)> = class
inherit LogConsistentGrain<'GrainState (requires 'GrainState : null and 'GrainState : (new : unit -> 'GrainState))>
interface ILogConsistencyProtocolParticipant
interface IGrain
interface IAddressable
interface ILogViewAdaptorHost<'GrainState, 'EventBase (requires 'GrainState : null and 'GrainState : (new : unit -> 'GrainState) and 'EventBase : null)>
interface IConnectionIssueListener
Public MustInherit Class JournaledGrain(Of TGrainState, TEventBase)
Inherits LogConsistentGrainBase(Of TGrainState)
Implements ILogConsistencyProtocolParticipant, ILogConsistentGrain, ILogViewAdaptorHost(Of TGrainState, TEventBase)
Public MustInherit Class JournaledGrain(Of TGrainState, TEventBase)
Inherits LogConsistentGrain(Of TGrainState)
Implements IGrain, ILogConsistencyProtocolParticipant, ILogViewAdaptorHost(Of TGrainState, TEventBase)
类型参数
- TGrainState
粒度状态的类型,即事件日志的聚合视图。
- TEventBase
事件的通用基类
- 继承
- 继承
- 继承
- 派生
- 实现
-
IGrain IConnectionIssueListener ILogConsistentGrain ILogViewAdaptorHost<TGrainState,TEventBase> ILogConsistencyProtocolParticipant IAddressable IConnectionIssueListener ILogConsistencyProtocolParticipant ILogViewAdaptorHost<TGrainState,TEventBase>
构造函数
JournaledGrain<TGrainState,TEventBase>() |
初始化 JournaledGrain<TGrainState,TEventBase> 类的新实例。 |
JournaledGrain<TGrainState,TEventBase>(IGrainIdentity, IGrainRuntime) |
此构造函数特别适用于单元测试,其中测试代码可以创建 Grain 并将 IGrainIdentity、IGrainRuntime 和 State 替换为测试双精度 (模拟/存根) 。 |
属性
DefaultAdaptorFactory |
如果未指定日志一致性提供程序,请使用默认存储提供程序存储版本控制状态 |
GrainFactory |
获取可用于访问其他粒度的对象。 如果此粒度未与运行时关联,例如直接创建单元测试时,则为 Null。 (继承自 Grain) |
GrainReference |
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。 (继承自 Grain) |
IdentityString |
grain 的 SiloIdentity 的字符串表示形式,包括类型和主键。 (继承自 Grain) |
RuntimeIdentity |
当前 silo 的唯一标识符。 此字符串没有语义内容,但它可能对日志记录很有用。 (继承自 Grain) |
ServiceProvider |
获取运行时管理的 IServiceProvider。 如果此粒度不与运行时关联,则为 Null,例如,直接创建用于单元测试时。 (继承自 Grain) |
State |
获取当前确认状态。 仅包括已确认的事件。 |
TentativeState |
获取当前暂定状态。 包括已确认和未确认的事件。 |
UnconfirmedEvents |
返回未确认事件的当前队列。 |
UnresolvedConnectionIssues |
获取当前所有未解决的连接问题的列表。 |
Version |
获取当前确认状态的版本。 等于已确认事件的总数。 |
方法
ConfirmEvents() |
等待,直到确认之前引发的所有事件。 在引发一个或多个事件后等待此操作,以确保在继续之前保留事件,或保证强一致性 (线性化) 即使有多个此粒度实例 |
DeactivateOnIdle() |
在当前 grain 方法调用完成后,停用 grain 的此激活。 此调用会将当前粒度的此激活标记为在当前方法结束时停用和删除。 下一次调用此粒度将导致使用不同的激活,这通常意味着运行时会自动创建新激活。 (继承自 Grain) |
DelayDeactivation(TimeSpan) |
至少在指定的持续时间内延迟停用此激活。
正 |
DisableStatsCollection() |
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。 |
EnableStatsCollection() |
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。 |
GetLogger() |
返回此 grain 的代码可用于跟踪的记录器对象。 记录器的名称将派生自 grain 类名。 (继承自 Grain) |
GetLogger(String) |
返回此 grain 的代码可用于跟踪的记录器对象。 (继承自 Grain) |
GetReminder(String) |
返回以前注册的提醒。 (继承自 Grain) |
GetReminders() |
返回 grain 注册的所有提醒的列表。 (继承自 Grain) |
GetStats() |
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。 |
GetStreamProvider(String) |
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。 (继承自 Grain) |
GetStreamProviders() |
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。 (继承自 Grain) |
InstallAdaptor(ILogViewAdaptorFactory, Object, String, IGrainStorage, ILogConsistencyProtocolServices) |
在构造 grain 后立即调用 以安装适配器。 日志一致性提供程序包含一个工厂方法,该方法使用为此粒度选择的类型构造适配器 |
InstallAdaptor(ILogViewAdaptorFactory, Object, String, IGrainStorage, ILogConsistencyProtocolServices) |
在构造 grain 后立即调用 以安装适配器。 日志一致性提供程序包含一个工厂方法,该方法使用为此粒度选择的类型构造适配器 |
MigrateOnIdle() |
开始尝试将此实例迁移到另一个位置。 迁移捕获当前 RequestContext,使其可供激活的放置控制器使用,以便在选择新位置时可以考虑它。 当未执行请求时,迁移将以异步方式进行;如果激活的放置控制器未选择备用位置,则不会发生迁移。 (继承自 Grain) |
OnActivateAsync() |
默认情况下,激活后,日志粒度将等待,直到它已从存储加载最新视图。 子类可以替代此行为,并根据需要跳过等待。 |
OnActivateAsync() |
此方法在激活 grain 的过程结束时调用。 在将任何消息调度到 grain 之前调用它。 对于具有声明持久状态的粒度,在填充 State 属性后调用此方法。 (继承自 Grain) |
OnActivateAsync(CancellationToken) |
默认情况下,激活后,日志粒度将等待,直到它已从存储加载最新视图。 子类可以替代此行为,并根据需要跳过等待。 |
OnActivateAsync(CancellationToken) |
此方法在激活 grain 的过程结束时调用。 在将任何消息调度到 grain 之前调用它。 对于具有声明持久状态的粒度,在填充 State 属性后调用此方法。 (继承自 Grain) |
OnConnectionIssue(ConnectionIssue) |
当基础持久性或复制协议遇到某种连接问题时调用。 重写此项以监视日志一致性协议的运行状况和/或自定义重试延迟。 引发的任何异常都由 ILogViewAdaptorFactory捕获和记录。 |
OnConnectionIssue(ConnectionIssue) |
当基础持久性或复制协议遇到某种连接问题时调用。 重写此项以监视日志一致性协议的运行状况和/或自定义重试延迟。 引发的任何异常都由 ILogConsistencyProvider捕获和记录。 |
OnConnectionIssueResolved(ConnectionIssue) |
在解决以前报告的连接问题时调用。 重写此项以监视日志一致性协议的运行状况。 引发的任何异常都由 ILogConsistencyProvider捕获和记录。 |
OnConnectionIssueResolved(ConnectionIssue) |
在解决以前报告的连接问题时调用。 重写此项以监视日志一致性协议的运行状况。 引发的任何异常都由 ILogViewAdaptorFactory捕获和记录。 |
OnDeactivateAsync() |
在停用 grain 的过程开始时调用此方法。 (继承自 Grain) |
OnDeactivateAsync(DeactivationReason, CancellationToken) |
在停用 grain 的过程开始时调用此方法。 (继承自 Grain) |
OnStateChanged() |
在确认状态 (之后调用,即确认的版本号) 更大。 重写此项以响应已确认状态的更改。 |
OnTentativeStateChanged() |
每当由于本地或远程事件而可能更改暂定状态时调用。 重写此项以响应状态的更改。 |
Participate(IGrainLifecycle) |
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。 (继承自 Grain) |
Participate(IGrainLifecycle) |
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。 (继承自 LogConsistentGrain<TView>) |
Participate(IGrainLifecycle) |
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。 (继承自 LogConsistentGrain<TView>) |
RaiseConditionalEvent<TEvent>(TEvent) |
有条件地引发事件。 仅当没有冲突时才会成功,也就是说,在此期间没有引发其他事件。 |
RaiseConditionalEvents<TEvent>(IEnumerable<TEvent>) |
以原子序列的形式有条件地引发多个事件。 仅当没有冲突时才会成功,也就是说,在此期间没有引发其他事件。 |
RaiseEvent<TEvent>(TEvent) |
引发事件。 |
RaiseEvents<TEvent>(IEnumerable<TEvent>) |
作为原子序列引发多个事件。 |
RefreshNow() |
立即检索最新状态,并确认以前引发的所有事件。 实际上,这会强制实施与全局状态的同步。 在读取状态之前等待此操作,以确保 (线性化) 强一致性,即使有多个此粒度实例 |
RegisterOrUpdateReminder(String, TimeSpan, TimeSpan) |
注册持久可靠的提醒,以将常规通知 (提醒) 发送到粒度。
grain 必须实现 |
RegisterTimer(Func<Object,Task>, Object, TimeSpan, TimeSpan) |
注册计时器以向此 grain 发送定期回调。 (继承自 Grain) |
RetrieveConfirmedEvents(Int32, Int32) |
从存储中检索已确认事件序列的段。 NotSupportedException如果事件不可读取,则引发。 事件是否可用以及持续时间取决于使用的提供程序及其配置方式。 |
TransitionState(TGrainState, TEventBase) |
定义如何将事件应用于状态。 除非它在子类中重写,否则它会对状态调用动态“Apply”函数,并将 事件作为参数。 此方法引发的所有异常都由日志视图提供程序捕获和记录。 重写此项可自定义如何转换给定事件的状态。 |
UnregisterReminder(IGrainReminder) |
取消注册以前注册的提醒。 (继承自 Grain) |
显式接口实现
扩展方法
DeactivateOnIdle(IGrainBase) |
在当前 grain 方法调用完成后停用此 grain 激活。 此调用将标记当前粒度的此激活,以在当前方法的末尾停用和删除。 下一次调用此 grain 将导致使用不同的激活,这通常意味着运行时会自动创建新的激活。 |
MigrateOnIdle(IGrainBase) |
开始尝试将此实例迁移到另一个位置。 迁移捕获当前 RequestContext,使其可供激活的放置控制器使用,以便在选择新位置时可以考虑它。 当没有执行请求时,迁移将以异步方式进行;如果激活的放置控制器未选择备用位置,则不会发生迁移。 |
AsReference(IAddressable, Type) |
返回对提供的 grain 的类型化引用。 |
AsReference<TGrainInterface>(IAddressable) |
返回对提供的 grain 的类型化引用。 |
BindGrainReference(IAddressable, IGrainFactory) |
将 grain 引用绑定到提供的 IGrainFactory。 |
Cast(IAddressable, Type) |
返回对提供的 grain 的类型化引用。 |
Cast<TGrainInterface>(IAddressable) |
返回对提供的 grain 的类型化引用。 |
GetGrainId(IAddressable) |
返回与提供的 grain 对应的 grain ID。 |
GetGrainIdentity(IGrain) |
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。 |
GetPrimaryKey(IGrain) |
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。 |
GetPrimaryKey(IGrain, String) |
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。 |
GetPrimaryKey(IAddressable) |
返回 Guid grain 主键的表示形式。 |
GetPrimaryKey(IAddressable, String) |
返回 Guid grain 主键的表示形式。 |
GetPrimaryKeyLong(IGrain) |
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。 |
GetPrimaryKeyLong(IGrain, String) |
使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。 |
GetPrimaryKeyLong(IAddressable) |
返回 |
GetPrimaryKeyLong(IAddressable, String) |
返回 |
GetPrimaryKeyString(IAddressable) |
返回 |
IsPrimaryKeyBasedOnLong(IAddressable) |
返回主键的一部分是否为 类型 |
GetReminder(Grain, String) |
返回以前注册的提醒。 |
GetReminder(IGrainBase, String) |
返回以前注册的提醒。 |
GetReminders(Grain) |
返回 grain 注册的所有提醒的列表。 |
GetReminders(IGrainBase) |
返回 grain 注册的所有提醒的列表。 |
RegisterOrUpdateReminder(Grain, String, TimeSpan, TimeSpan) |
注册持久可靠的提醒,以将常规通知 (提醒) 发送到粒度。
grain 必须实现 |
RegisterOrUpdateReminder(IGrainBase, String, TimeSpan, TimeSpan) |
注册持久可靠的提醒,以将常规通知 (提醒) 发送到粒度。
grain 必须实现 |
UnregisterReminder(Grain, IGrainReminder) |
取消注册以前注册的提醒。 |
UnregisterReminder(IGrainBase, IGrainReminder) |
取消注册以前注册的提醒。 |
GetStreamProvider(Grain, String) |
获取具有指定 |
GetStreamProvider(IGrainBase, String) |
获取具有指定 |
GetLogger(Grain) |
返回此 grain 的代码可用于跟踪的记录器对象。 记录器的名称将派生自 grain 类名。 |
GetLogger(Grain, String) |
返回此 grain 的代码可用于跟踪的记录器对象。 |
GetGrainStorage(Grain, IServiceProvider) |
获取与 grain 类型关联的存储提供程序。 |