• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ConsistencyLevel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: AddCoordinator

 ///  Coordinator management/count
 public void AddCoordinator(string coordinator, ConsistencyLevel consistencyLevel)
 {
     if (!Coordinators.ContainsKey(coordinator))
         Coordinators.Add(coordinator, 0);
     int n = Coordinators[coordinator];
     Coordinators[coordinator] = n + 1;
     AchievedConsistencies.Add(consistencyLevel);
 }
开发者ID:mtf30rob,项目名称:csharp-driver,代码行数:9,代码来源:PolicyTestTools.cs


示例17: WriteTimeoutException

 public WriteTimeoutException(ConsistencyLevel consistency, int received, int required,
                              string writeType)
     : base(string.Format("Cassandra timeout during write query at consitency {0} ({1} replica acknowledged the write over {2} required)", consistency.ToString().ToUpper(), received, required),
       consistency,
       received,
       required)
 {
     this.WriteType = writeType;
 }
开发者ID:joaquincasares,项目名称:csharp-driver,代码行数:9,代码来源:WriteTimeoutException.cs


示例18: ExecutePreparedQuery

 internal static void ExecutePreparedQuery(Session session, PreparedStatement prepared, object[] values, ConsistencyLevel consistency = ConsistencyLevel.Default, string messageInstead = null)
 {
     if (messageInstead != null)
         Console.WriteLine("CQL<\t" + messageInstead);
     else
         Console.WriteLine("CQL< Executing Prepared Query:\t");
     session.Execute(prepared.Bind(values).SetConsistencyLevel(consistency));
     Console.WriteLine("CQL> (OK).");
 }
开发者ID:abhijitchanda,项目名称:csharp-driver,代码行数:9,代码来源:QueryTools.cs


示例19: CreateQuery

 internal static IObservable<object> CreateQuery(IConnection connection, string cql, ConsistencyLevel cl, IDataMapperFactory factory,
                                                 ExecutionFlags executionFlags)
 {
     Action<IFrameWriter> writer = fw => WriteQueryRequest(fw, cql, cl, MessageOpcodes.Query);
     Func<IFrameReader, IEnumerable<object>> reader = fr => ReadRowSet(fr, factory);
     InstrumentationToken token = InstrumentationToken.Create(RequestType.Query, executionFlags, cql);
     Query query = new Query(writer, reader, token, connection);
     return query;
 }
开发者ID:Hamdiakoguz,项目名称:cassandra-sharp,代码行数:9,代码来源:CQLCommandHelpers.cs


示例20: ExecuteSyncQuery

 internal static void ExecuteSyncQuery(ISession session, string query, ConsistencyLevel consistency, List<object[]> expectedValues = null,
                                       string messageInstead = null)
 {   
     var ret = session.Execute(query, consistency);
     if (expectedValues != null)
     {
         valueComparator(ret, expectedValues);
     }
 }
开发者ID:mtf30rob,项目名称:csharp-driver,代码行数:9,代码来源:QueryTools.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Console类代码示例发布时间:2022-05-24
下一篇:
C# ConsList类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap