/// <summary> /// Checks to see if The observed document was lost during a hard failover, because the document did not reach the replica in time. /// </summary> /// <param name="response">The <see cref="ObserveSeqno"/>response.</param> /// <exception cref="DocumentMutationLostException">Thrown if the observed document was lost during /// a hard failover because the document did not reach the replica in time.</exception> public void CheckMutationLost(ObserveSeqnoResponse response) { if (response.IsHardFailover && response.LastSeqnoReceived < Token.SequenceNumber) { throw new DocumentMutationLostException(ExceptionUtil.DocumentMutationLostMsg); } }
/// <summary> /// Determines whether the specified response has replicated, /// increases the <see cref="_replicatedToCount"/> by one. /// </summary> /// <param name="response">The response.</param> /// <returns></returns> public void CheckReplicated(ObserveSeqnoResponse response) { var replicated = response.CurrentSeqno >= Token.SequenceNumber; if (replicated) { Interlocked.Increment(ref _replicatedToCount); } }
/// <summary> /// Determines whether the specified response has persisted and if it has, /// increases the <see cref="_persistedToCount"/> by one. /// </summary> /// <param name="response">The response.</param> /// <returns></returns> public void CheckPersisted(ObserveSeqnoResponse response) { var persisted = response.LastPersistedSeqno >= Token.SequenceNumber; if (persisted) { Interlocked.Increment(ref _persistedToCount); } }