public static void IncrementDoingVersion <K>(this IFollowSnapshot <K> state, Type grainType) { if (state.DoingVersion != state.Version) { throw new StateInsecurityException(state.StateId.ToString(), grainType, state.DoingVersion, state.Version); } state.DoingVersion += 1; }
public static void UnsafeUpdateVersion <PrimaryKey>(this IFollowSnapshot <PrimaryKey> snapshot, IEventBase eventBase) { snapshot.DoingVersion = eventBase.Version; snapshot.Version = eventBase.Version; if (snapshot.StartTimestamp == 0 || eventBase.Timestamp < snapshot.StartTimestamp) { snapshot.StartTimestamp = eventBase.Timestamp; } }
public static void UpdateVersion <PrimaryKey>(this IFollowSnapshot <PrimaryKey> snapshot, IEventBase eventBase, Type grainType) { if (snapshot.Version + 1 != eventBase.Version) { throw new EventVersionNotMatchStateException(snapshot.StateId.ToString(), grainType, eventBase.Version, snapshot.Version); } snapshot.Version = eventBase.Version; if (snapshot.StartTimestamp == 0 || eventBase.Timestamp < snapshot.StartTimestamp) { snapshot.StartTimestamp = eventBase.Timestamp; } }