Exemplo n.º 1
0
 /// <summary>
 /// If isLocalQuorumConsistency flag is true, it allows only "Quorum Read with Eventual Consistency Account".
 /// It goes through a validation where it doesn't allow strong consistency over weaker consistency.
 /// </summary>
 /// <param name="backendConsistency"> Account Level Consistency </param>
 /// <param name="desiredConsistency"> Request/Client Level Consistency</param>
 /// <param name="isLocalQuorumConsistency"> Allows Quorum Read with Eventual Account</param>
 /// <param name="operationType"> <see cref="OperationType"/> </param>
 /// <param name="resourceType"> <see cref="ResourceType"/> </param>
 /// <returns>true/false</returns>
 /// <exception cref="ArgumentException">Invalid Backend Consistency</exception>
 public static bool IsValidConsistencyLevelOverwrite(
     Cosmos.ConsistencyLevel backendConsistency,
     Cosmos.ConsistencyLevel desiredConsistency,
     bool isLocalQuorumConsistency,
     OperationType operationType,
     ResourceType resourceType)
 {
     return(ValidationHelpers.IsValidConsistencyLevelOverwrite(
                backendConsistency: (Documents.ConsistencyLevel)backendConsistency,
                desiredConsistency: (Documents.ConsistencyLevel)desiredConsistency,
                isLocalQuorumConsistency: isLocalQuorumConsistency,
                operationType: operationType,
                resourceType: resourceType));
 }
Exemplo n.º 2
0
        /// <summary>
        /// If isLocalQuorumConsistency flag is true, it allows only "Quorum Read with Eventual Consistency Account".
        /// It goes through a validation where it doesn't allow strong consistency over weaker consistency.
        /// </summary>
        /// <param name="backendConsistency"> Account Level Consistency </param>
        /// <param name="desiredConsistency"> Request/Client Level Consistency</param>
        /// <param name="isLocalQuorumConsistency"> Allows Quorum Read with Eventual Account</param>
        /// <param name="operationType">  <see cref="OperationType"/> </param>
        /// <param name="resourceType"> <see cref="ResourceType"/> </param>
        /// <returns>true/false</returns>
        /// <exception cref="ArgumentException">Invalid Backend Consistency</exception>
        public static bool IsValidConsistencyLevelOverwrite(
            Documents.ConsistencyLevel backendConsistency,
            Documents.ConsistencyLevel desiredConsistency,
            bool isLocalQuorumConsistency,
            OperationType?operationType,
            ResourceType?resourceType)
        {
            if (isLocalQuorumConsistency &&
                ValidationHelpers.IsLocalQuorumConsistency(
                    backendConsistency: backendConsistency,
                    desiredConsistency: desiredConsistency,
                    operationType: operationType,
                    resourceType: resourceType))
            {
                return(true);
            }

            return(ValidationHelpers.IsValidConsistencyLevelOverwrite(
                       backendConsistency: backendConsistency,
                       desiredConsistency: desiredConsistency));
        }
Exemplo n.º 3
0
 public static bool IsValidConsistencyLevelOverwrite(Cosmos.ConsistencyLevel backendConsistency, Cosmos.ConsistencyLevel desiredConsistency)
 {
     return(ValidationHelpers.IsValidConsistencyLevelOverwrite((Documents.ConsistencyLevel)backendConsistency, (Documents.ConsistencyLevel)desiredConsistency));
 }