JournaledGrain<TGrainState,TEventBase> 类

定义

使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。

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

事件的通用基类

继承
JournaledGrain<TGrainState,TEventBase>
继承
LogConsistentGrain<TGrainState>
JournaledGrain<TGrainState,TEventBase>
继承
LogConsistentGrain<TGrainState>
JournaledGrain<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)

至少在指定的持续时间内延迟停用此激活。 正 timeSpan 值表示“阻止该时间跨度内此激活的 GC”。 负 timeSpan 值表示“取消 DelayDeactivation 调用的上一设置,使此激活行为基于常规激活垃圾回收设置”。 DeactivateOnIdle 方法将撤消/替代任何当前“保持活动”设置,使此粒度立即可用于停用。

(继承自 Grain)
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 必须实现 Orleans.IRemindable 接口,并且此 grain 的提醒将发送到 ReceiveReminder 回调方法。 如果在计时器触发时停用当前粒度,则将创建此 grain 的新激活来接收此提醒。 如果已存在同名的现有提醒,则此新提醒将覆盖该提醒。 此 grain 的一次激活始终会收到提醒,即使此 grain 存在多个激活也是如此。

(继承自 Grain)
RegisterTimer(Func<Object,Task>, Object, TimeSpan, TimeSpan)

注册计时器以向此 grain 发送定期回调。

(继承自 Grain)
RetrieveConfirmedEvents(Int32, Int32)

从存储中检索已确认事件序列的段。 NotSupportedException如果事件不可读取,则引发。 事件是否可用以及持续时间取决于使用的提供程序及其配置方式。

TransitionState(TGrainState, TEventBase)

定义如何将事件应用于状态。 除非它在子类中重写,否则它会对状态调用动态“Apply”函数,并将 事件作为参数。 此方法引发的所有异常都由日志视图提供程序捕获和记录。

重写此项可自定义如何转换给定事件的状态。

UnregisterReminder(IGrainReminder)

取消注册以前注册的提醒。

(继承自 Grain)

显式接口实现

IConnectionIssueListener.OnConnectionIssue(ConnectionIssue)

适配器针对连接问题调用。

IConnectionIssueListener.OnConnectionIssue(ConnectionIssue)

适配器针对连接问题调用。

IConnectionIssueListener.OnConnectionIssueResolved(ConnectionIssue)

在解决连接问题时由适配器调用。

IConnectionIssueListener.OnConnectionIssueResolved(ConnectionIssue)

在解决连接问题时由适配器调用。

IGrainBase.GrainContext

使用标准事件溯源术语的日志一致性粒度的基类。 所有操作都是可重入安全的。

(继承自 Grain)
ILogConsistencyProtocolParticipant.DeactivateProtocolParticipant()

通知日志视图适配器停用

ILogConsistencyProtocolParticipant.DeactivateProtocolParticipant()

通知日志视图适配器停用

ILogConsistencyProtocolParticipant.OnMultiClusterConfigurationChange(MultiClusterConfiguration)

接收配置更改,并传递到日志视图适配器。

ILogConsistencyProtocolParticipant.OnProtocolMessageReceived(ILogConsistencyProtocolMessage)

接收来自其他群集的协议消息,并传递到日志视图适配器。

ILogConsistencyProtocolParticipant.PostActivateProtocolParticipant()

在用户级别 OnActivate) 之后调用激活 (通知日志视图适配器

ILogConsistencyProtocolParticipant.PostActivateProtocolParticipant()

在用户级别 OnActivate) 之后调用激活 (通知日志视图适配器

ILogConsistencyProtocolParticipant.PreActivateProtocolParticipant()

在用户级别 OnActivate) 之前,通知日志视图适配器激活 (调用

ILogConsistencyProtocolParticipant.PreActivateProtocolParticipant()

在用户级别 OnActivate) 之前,通知日志视图适配器激活 (调用

ILogConsistentGrain.DefaultAdaptorFactory

如果未指定日志一致性提供程序,请使用默认存储提供程序存储版本控制状态

ILogConsistentGrain.InstallAdaptor(ILogViewAdaptorFactory, Object, String, IStorageProvider, ILogConsistencyProtocolServices)

在构造 grain 后立即调用 以安装适配器。 日志一致性提供程序包含一个工厂方法,该方法使用为此粒度选择的类型构造适配器

ILogViewAdaptorHost<TGrainState,TEventBase>.OnViewChanged(Boolean, Boolean)

由适配器在状态更改时调用。

ILogViewAdaptorHost<TGrainState,TEventBase>.OnViewChanged(Boolean, Boolean)

在状态更改时由适配器调用。

ILogViewAdaptorHost<TGrainState,TEventBase>.UpdateView(TGrainState, TEventBase)

由适配器调用以在追加条目时更新视图。

ILogViewAdaptorHost<TGrainState,TEventBase>.UpdateView(TGrainState, TEventBase)

由适配器调用以在追加条目时更新视图。

扩展方法

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)

返回 long grain 主键的表示形式。

GetPrimaryKeyLong(IAddressable, String)

返回 long grain 主键的表示形式。

GetPrimaryKeyString(IAddressable)

返回 string grain 的主键。

IsPrimaryKeyBasedOnLong(IAddressable)

返回主键的一部分是否为 类型 long

GetReminder(Grain, String)

返回以前注册的提醒。

GetReminder(IGrainBase, String)

返回以前注册的提醒。

GetReminders(Grain)

返回 grain 注册的所有提醒的列表。

GetReminders(IGrainBase)

返回 grain 注册的所有提醒的列表。

RegisterOrUpdateReminder(Grain, String, TimeSpan, TimeSpan)

注册持久可靠的提醒,以将常规通知 (提醒) 发送到粒度。 grain 必须实现 Orleans.IRemindable 接口,并且此 grain 的提醒将发送到 ReceiveReminder 回调方法。 如果在计时器触发时停用当前粒度,则将创建此 grain 的新激活来接收此提醒。 如果已存在同名的现有提醒,则此新提醒将覆盖该提醒。 此 grain 的一次激活始终会收到提醒,即使此 grain 存在多个激活也是如此。

RegisterOrUpdateReminder(IGrainBase, String, TimeSpan, TimeSpan)

注册持久可靠的提醒,以将常规通知 (提醒) 发送到粒度。 grain 必须实现 Orleans.IRemindable 接口,并且此 grain 的提醒将发送到 ReceiveReminder 回调方法。 如果在计时器触发时停用当前粒度,则将创建此 grain 的新激活来接收此提醒。 如果已存在同名的现有提醒,则此新提醒将覆盖该提醒。 此 grain 的一次激活始终会收到提醒,即使此 grain 存在多个激活也是如此。

UnregisterReminder(Grain, IGrainReminder)

取消注册以前注册的提醒。

UnregisterReminder(IGrainBase, IGrainReminder)

取消注册以前注册的提醒。

GetStreamProvider(Grain, String)

获取具有指定 name的流提供程序。

GetStreamProvider(IGrainBase, String)

获取具有指定 name的流提供程序。

GetLogger(Grain)

返回此 grain 的代码可用于跟踪的记录器对象。 记录器的名称将派生自 grain 类名。

GetLogger(Grain, String)

返回此 grain 的代码可用于跟踪的记录器对象。

GetGrainStorage(Grain, IServiceProvider)

获取与 grain 类型关联的存储提供程序。

适用于