internal virtual bool ValidateAndTrackOperation(LocalOperationId operationId) { if (!IsValidOperation(operationId)) { return(false); } LastSequenceNumberPerSession[operationId.LocalSessionId()] = operationId.SequenceNumber(); return(true); }
/// <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); }