Ejemplo n.º 1
0
        /// <summary>
        /// Creates a simple SLA with a single desired consistency and a large latency.
        /// This forces reads to be performed at the closest replica with that consistency.
        /// </summary>
        /// <param name="cons"></param>
        /// <returns></returns>
        public static ServiceLevelAgreement CreateConsistencySla(Consistency cons)
        {
            ServiceLevelAgreement sla = new ServiceLevelAgreement(cons.ToString("g"));
            SubSLA subSla1            = new SubSLA(2000, cons, 0, 1);

            sla.Add(subSla1);
            return(sla);
        }
Ejemplo n.º 2
0
 public static CodeAttributeDeclaration ReliabilityContractDeclaration(Consistency consistency, Cer cer)
 {
     return(new CodeAttributeDeclaration(
                new CodeTypeReference(typeof(ReliabilityContractAttribute)),
                new CodeAttributeArgument(
                    new CodePropertyReferenceExpression(
                        new CodeTypeReferenceExpression(typeof(Consistency)),
                        consistency.ToString())),
                new CodeAttributeArgument(
                    new CodePropertyReferenceExpression(
                        new CodeTypeReferenceExpression(typeof(Cer)),
                        cer.ToString()))));
 }