当前位置: 首页>>代码示例>>C#>>正文


C# ConsistencyLevel类代码示例

本文整理汇总了C#中ConsistencyLevel的典型用法代码示例。如果您正苦于以下问题:C# ConsistencyLevel类的具体用法?C# ConsistencyLevel怎么用?C# ConsistencyLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConsistencyLevel类属于命名空间,在下文中一共展示了ConsistencyLevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TimeOutException

 protected TimeOutException(ErrorCodes code, string message, ConsistencyLevel consistencyLevel, int received, int blockFor)
         : base(code, message)
 {
     ConsistencyLevel = consistencyLevel;
     Received = received;
     BlockFor = blockFor;
 }
开发者ID:Jacky1,项目名称:cassandra-sharp,代码行数:7,代码来源:TimeOutException.cs

示例2: UnavailableException

 public UnavailableException(ConsistencyLevel consistency, int required, int alive)
     : base(string.Format("Not enough replica available for query at consistency {0} ({1} required but only {2} alive)", consistency, required, alive))
 {
     this.Consistency = consistency;
     this.RequiredReplicas = required;
     this.AliveReplicas = alive;
 }
开发者ID:hjarraya,项目名称:csharp-driver,代码行数:7,代码来源:UnavailableException.cs

示例3: RegisterComponents

        public static void RegisterComponents()
        {
            var container = new UnityContainer();

            var documentUri = ConfigurationManager.AppSettings["DocumentUri"];
            string authKey = ConfigurationManager.AppSettings["AuthorizationKey"];
            string redisConnection = ConfigurationManager.AppSettings["RedisConnection"];

            // register all your components with the container here
            // it is NOT necessary to register your controllers

            // e.g. container.RegisterType<ITestService, TestService>();
            Uri uri = new Uri(documentUri);
            ConnectionPolicy connectionPolicy = new ConnectionPolicy() { ConnectionMode = ConnectionMode.Direct, ConnectionProtocol = Protocol.Tcp };
            ConsistencyLevel consistencyLevel = new ConsistencyLevel();
            consistencyLevel = ConsistencyLevel.Session;

            container.RegisterType<IApplicationUserStore, ApplicatonUserStore>();
            container.RegisterType<DocumentClient>(new ContainerControlledLifetimeManager(), new InjectionConstructor(uri, authKey, connectionPolicy, consistencyLevel));

            ConnectionMultiplexer connectionMulp = ConnectionMultiplexer.Connect(redisConnection);
            container.RegisterInstance<IConnectionMultiplexer>(ConnectionMultiplexer.Connect(redisConnection));

            container.RegisterType<IRedisRepository, RedisRepository>();
            container.RegisterType<IUserRepository, UserRepository>();

            var repo = container.Resolve<IRedisRepository>();

            container.RegisterType<RefreshTokenProvider>(new InjectionConstructor(repo));

            GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container);
        }
开发者ID:pplavetzki,项目名称:LanguageExchange,代码行数:32,代码来源:UnityConfig.cs

示例4: UnavailableException

 public UnavailableException(string message, ConsistencyLevel consistencyLevel, int required, int alive)
         : base(ErrorCodes.Unavailable, message)
 {
     ConsistencyLevel = consistencyLevel;
     Required = required;
     Alive = alive;
 }
开发者ID:Jacky1,项目名称:cassandra-sharp,代码行数:7,代码来源:UnavailableException.cs

示例5: Execute

        public Task<IEnumerable<object>> Execute(ConsistencyLevel cl, IDataMapperFactory factory)
        {
            IConnection connection;
            if (null == (connection = _connection))
            {
                lock (_lock)
                {
                    if (null == (connection = _connection))
                    {
                        connection = _cluster.GetConnection(null);
                        connection.OnFailure += ConnectionOnOnFailure;

                        Action<IFrameWriter> writer = fw => CQLCommandHelpers.WritePrepareRequest(fw, _cql);
                        Func<IFrameReader, IEnumerable<object>> reader = fr => CQLCommandHelpers.ReadPreparedQuery(fr, connection);

                        connection.Execute(writer, reader).ContinueWith(ReadPreparedQueryInfo).Wait();

                        Thread.MemoryBarrier();

                        _connection = connection;
                    }
                }
            }

            Action<IFrameWriter> execWriter = fw => WriteExecuteRequest(fw, cl, factory);
            Func<IFrameReader, IEnumerable<object>> execReader = fr => CQLCommandHelpers.ReadRowSet(fr, factory);

            return connection.Execute(execWriter, execReader);
        }
开发者ID:lbucao,项目名称:cassandra-sharp,代码行数:29,代码来源:PreparedQuery.cs

示例6: QueryProtocolOptions

 internal QueryProtocolOptions(ConsistencyLevel consistency,
                               object[] values,
                               bool skipMetadata,
                               int pageSize,
                               byte[] pagingState,
                               ConsistencyLevel serialConsistency)
 {
     Consistency = consistency;
     Values = values;
     _skipMetadata = skipMetadata;
     if (pageSize <= 0)
     {
         PageSize = QueryOptions.DefaultPageSize;
     }
     else if (pageSize == int.MaxValue)
     {
         PageSize = -1;
     }
     else
     {
         PageSize = pageSize;
     }
     PagingState = pagingState;
     SerialConsistency = serialConsistency;
 }
开发者ID:mtf30rob,项目名称:csharp-driver,代码行数:25,代码来源:QueryProtocolOptions.cs

示例7: BeginExecuteQuery

        public IAsyncResult BeginExecuteQuery(int _streamId, byte[] Id, string cql, RowSetMetadata Metadata, object[] values,
                                              AsyncCallback callback, object state, object owner,
                                              ConsistencyLevel consistency, bool isTracing)
        {
            var jar = SetupJob(_streamId, callback, state, owner, "EXECUTE");

            BeginJob(jar, SetupKeyspace(jar, SetupPreparedQuery(jar, Id, cql, () =>
               {
                   Evaluate(new ExecuteRequest(jar.StreamId, Id, Metadata, values, consistency, isTracing), jar.StreamId,
                            new Action<ResponseFrame>((frame2) =>
                                {
                                    var response = FrameParser.Parse(frame2);
                                    if (response is ResultResponse)
                                        JobFinished(jar, (response as ResultResponse).Output);
                                    else
                                        _protocolErrorHandlerAction(new ErrorActionParam()
                                            {
                                                AbstractResponse = response,
                                                Jar = jar
                                            });

                                }));
               })));

            return jar;
        }
开发者ID:ntent-ad,项目名称:csharp-driver,代码行数:26,代码来源:CassandraConnection+Execute.cs

示例8: Create

        public IKeyspace Create(
			ICassandraClient client,
			string keyspaceName,
			IDictionary<string, Dictionary<string, string>> keyspaceDesc,
			ConsistencyLevel consistencyLevel,
			FailoverPolicy failoverPolicy,
			IKeyedObjectPool<Endpoint, ICassandraClient> pool)
        {
            switch (client.Version)
            {
                case CassandraVersion.v0_6_0_beta_3:
                    throw new NotImplementedException("Version 0.6.0 not implimented yet");

                default:
                case CassandraVersion.v0_5_1:
                    return new _051.Keyspace(
                        client,
                        keyspaceName,
                        keyspaceDesc,
                        consistencyLevel,
                        failoverPolicy,
                        pool,
                        monitor
                        );
            }
        }
开发者ID:JustinLah,项目名称:hectorsharp,代码行数:26,代码来源:KeyspaceFactory.cs

示例9: QueryTimeoutException

 public QueryTimeoutException(string message, ConsistencyLevel consistencyLevel, int received, int required)
     : base(message)
 {
     ConsistencyLevel = consistencyLevel;
     ReceivedAcknowledgements = received;
     RequiredAcknowledgements = required;
 }
开发者ID:mtf30rob,项目名称:csharp-driver,代码行数:7,代码来源:QueryTimeoutException.cs

示例10: Execute

        public Task<IEnumerable<object>> Execute(ConsistencyLevel cl, IDataMapperFactory factory)
        {
            Action<IFrameWriter> writer = fw => WriteExecuteRequest(fw, cl, factory);
            Func<IFrameReader, IEnumerable<object>> reader = fr => CQLCommandHelpers.ReadRowSet(fr, factory);

            return _connection.Execute(writer, reader);
        }
开发者ID:kpaskal,项目名称:cassandra-sharp,代码行数:7,代码来源:PreparedQuery.cs

示例11: Execute

        public Task<IEnumerable<object>> Execute(IDataMapperFactory factory, ConsistencyLevel cl)
        {
            IConnection connection;
            if (null == (connection = _connection))
            {
                lock (_lock)
                {
                    if (null == (connection = _connection))
                    {
                        connection = _cluster.GetConnection(null);
                        connection.OnFailure += ConnectionOnOnFailure;

                        Action<IFrameWriter> writer = fw => CQLCommandHelpers.WritePrepareRequest(fw, _cql);
                        Func<IFrameReader, IEnumerable<object>> reader = fr => CQLCommandHelpers.ReadPreparedQuery(fr, connection);

                        InstrumentationToken prepareToken = InstrumentationToken.Create(RequestType.Prepare, _executionFlags, _cql);
                        connection.Execute(writer, reader, _executionFlags, prepareToken).ContinueWith(ReadPreparedQueryInfo).Wait();
                        _connection = connection;
                    }
                }
            }

            Action<IFrameWriter> execWriter = fw => WriteExecuteRequest(fw, cl, factory);
            Func<IFrameReader, IEnumerable<object>> execReader = fr => CQLCommandHelpers.ReadRowSet(fr, factory);

            InstrumentationToken queryToken = InstrumentationToken.Create(RequestType.Query, _executionFlags, _cql);
            return connection.Execute(execWriter, execReader, _executionFlags, queryToken);
        }
开发者ID:hodgesz,项目名称:cassandra-sharp,代码行数:28,代码来源:CQLPreparedQueryHelpers.cs

示例12: GetInsertAction

 public Action GetInsertAction(ISession session, object bindableStatement, ConsistencyLevel consistency, int rowsPerId)
 {
     Action action = () =>
     {
         Trace.TraceInformation("Starting inserting from thread {0}", Thread.CurrentThread.ManagedThreadId);
         var id = Guid.NewGuid();
         for (var i = 0; i < rowsPerId; i++)
         {
             var paramsArray = new object[] { id, DateTime.Now, DateTime.Now.ToString() };
             IStatement statement = null;
             if (bindableStatement is SimpleStatement)
             {
                 statement = ((SimpleStatement)bindableStatement).Bind(paramsArray).SetConsistencyLevel(consistency);
             }
             else if (bindableStatement is PreparedStatement)
             {
                 statement = ((PreparedStatement)bindableStatement).Bind(paramsArray).SetConsistencyLevel(consistency);
             }
             else
             {
                 throw new Exception("Can not bind a statement of type " + bindableStatement.GetType().FullName);
             }
             session.Execute(statement);
         }
         Trace.TraceInformation("Finished inserting from thread {0}", Thread.CurrentThread.ManagedThreadId);
     };
     return action;
 }
开发者ID:rasmus-s,项目名称:csharp-driver,代码行数:28,代码来源:StressTests.cs

示例13: addCoordinator

 ///  Coordinator management/count
 public static void addCoordinator(IPAddress coordinator, ConsistencyLevel cl)
 {
     if (!coordinators.ContainsKey(coordinator))
         coordinators.Add(coordinator, 0);
     var n = coordinators[coordinator];
     coordinators[coordinator] = n + 1;
     achievedConsistencies.Add(cl);
 }
开发者ID:ntent-ad,项目名称:csharp-driver,代码行数:9,代码来源:PolicyTestTools.cs

示例14: QueryRequest

 public QueryRequest(int streamId, string cqlQuery, ConsistencyLevel consistency, bool tracingEnabled)
 {
     this._streamId = streamId;
     this._cqlQuery = cqlQuery;
     this._consistency = consistency;
     if (tracingEnabled)
         this._flags = 0x02;
 }
开发者ID:sdether,项目名称:csharp-driver,代码行数:8,代码来源:QueryRequest.cs

示例15: Reset

 public static void Reset()
 {
     ColumnWidth = 40;
     Formatter = OutputFormatter.Tab;
     DebugLog = false;
     Tracing = false;
     CL = ConsistencyLevel.QUORUM;
 }
开发者ID:Jacky1,项目名称:cassandra-sharp,代码行数:8,代码来源:CommandContext.cs


注:本文中的ConsistencyLevel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。