Exemple #1
0
            internal virtual bool ValidateAndTrackOperation(LocalOperationId operationId)
            {
                if (!IsValidOperation(operationId))
                {
                    return(false);
                }

                LastSequenceNumberPerSession[operationId.LocalSessionId()] = operationId.SequenceNumber();
                return(true);
            }
Exemple #2
0
            /// <summary>
            /// The sequence numbers under a single local session must come strictly in order and are only valid once only.
            /// </summary>
            internal virtual bool IsValidOperation(LocalOperationId operationId)
            {
                long?lastSequenceNumber = LastSequenceNumberPerSession[operationId.LocalSessionId()];

                if (lastSequenceNumber == null)
                {
                    if (operationId.SequenceNumber() != 0)
                    {
                        return(false);
                    }
                }
                else if (operationId.SequenceNumber() != lastSequenceNumber + 1)
                {
                    return(false);
                }

                return(true);
            }