private void Connect()
        {
            var config = GetConnectionConfig();

            _cluster = new Cluster(config);
            _bucket = _cluster.OpenBucket();
        }
 public VolunteerController(IDisaster disasterSvc, ICluster clusterSvc, IAdmin adminSvc, IMessageService messageSvc)
 {
     _disasterSvc = disasterSvc;
     _clusterSvc = clusterSvc;
     _adminSvc = adminSvc;
     _messageSvc = messageSvc;
 }
        public ICqlCommand Create(ICluster cluster, IDataMapperFactory factoryIn, IDataMapperFactory factoryOut)
        {
            factoryIn.CheckArgumentNotNull("factoryIn");
            factoryOut.CheckArgumentNotNull("factoryOut");

            return new CqlCommand(cluster, factoryIn, factoryOut);
        }
Exemple #4
0
        protected override void InternalRun(ICluster cluster)
        {
            ICqlCommand cmd = cluster.CreatePocoCommand();

            const string insertNerdMovie = "INSERT INTO videos.NerdMovies (movie, director, main_actor, year)" +
                                           "VALUES ('Serenity', 'Joss Whedon', 'Nathan Fillion', 2005) " +
                                           "USING TTL 86400";
            Console.WriteLine(insertNerdMovie);
            cmd.Execute(insertNerdMovie).AsFuture().Wait();
            Console.WriteLine();

            const string selectNerdMovies = "select * from videos.NerdMovies";
            Console.WriteLine(selectNerdMovies);
            var taskSelectStartMovies = cmd.Execute<NerdMovie>(selectNerdMovies).AsFuture().ContinueWith(res => DisplayMovies(res.Result));
            taskSelectStartMovies.Wait();
            Console.WriteLine();

            const string selectAllFrom = "select * from videos.NerdMovies where director=? ALLOW FILTERING";
            Console.WriteLine(selectAllFrom);
            var preparedAllFrom = cmd.Prepare<NerdMovie>(selectAllFrom);
            var ds = new {Director = "Joss Whedon"};
            var taskSelectWhere =
                    preparedAllFrom.Execute(ds).AsFuture().ContinueWith(res => DisplayMovies(res.Result));
            taskSelectWhere.Wait();
            Console.WriteLine();
        }
 public AccountController(IVolunteerService volunteerSvc, ICluster clusterSvc, IWebSecurityWrapper webSecurity, IMessageService messageService)
 {
     _clusterSvc = clusterSvc;
     _webSecurity = webSecurity;
     _volunteerSvc = volunteerSvc;
     _messageService = messageService;
 }
Exemple #6
0
        public VerifyAllClusters(List<String> listClusters, List<String> listPath, ICluster listener)
        {
            do
            {
                InitializeComponent();
                listPathDirectory.AddRange(listPath);
                mListener = listener;
                if (listClusters.Count == 0)
                {
                    Verify_Btn.Enabled = false;
                    VerifyAll_Btn.Enabled = false;
                    break;
                }

                //add items listview resultVerify
                for (int i = 0; i < listClusters.Count; i++)
                {
                    resultVerifyGridView.Rows.Add(listClusters[i], null, null);
                    //resultVerify.Items[i].SubItems.Add("null");
                    //resultGridView.Rows.Add(listClusters[i],"null");
                }
                Verify_Btn.Enabled = true;
                VerifyAll_Btn.Enabled = true;
            } while (false);
        }
        public void SetUp()
        {
            CassandraSharpConfig cassandraSharpConfig = new CassandraSharpConfig();
            ClusterManager.Configure(cassandraSharpConfig);

            var config = new ClusterConfig
            {
                Endpoints = new EndpointsConfig { Servers = new[] { "localhost" } },
                DefaultKeyspace =
                    new KeyspaceConfig
                    {
                        Name = TestKeyspace,
                        DurableWrites = false,
                        Replication = new ReplicationConfig
                        {
                            Options = new Dictionary<string, string>
                                            {
                                                { "class", "SimpleStrategy" },
                                                { "replication_factor", "1" },
                                            }
                        }
                    }
            };

            cluster = ClusterManager.GetCluster(config);
        }
        public override void ActivateOptions()
        {
            _cluster = ClusterManager.GetCluster(ClusterName);

            string insertCQL =
                    string.Format(
                            "insert into {0}.{1} " +
                            "(id," +
                            "app_name," +
                            "app_start_time," +
                            "class_name," +
                            "file_name," +
                            "host_ip," +
                            "host_name," +
                            "level," +
                            "line_number," +
                            "log_timestamp," +
                            "logger_name," +
                            "message," +
                            "method_name," +
                            "thread_name," +
                            "throwable_str_rep) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
                            Keyspace, ColumnFamily);

            _insert = _cluster.CreatePocoCommand()
                              .WithConsistencyLevel(ConsistencyLevel)
                              .Prepare(insertCQL);
        }
 /// <summary>
 /// Gets the display label that the given cluster should use
 /// </summary>
 /// <param name="cluster"></param>
 /// <returns></returns>
 public override string GetClusterDisplayLabel(ICluster cluster)
 {
     string s = Column.ConvertGroupKeyToTitle(cluster.ClusterKey);
     if (String.IsNullOrEmpty(s))
         s = EMPTY_LABEL;
     return ApplyDisplayFormat(cluster, s);
 }
        protected override void InternalRun(ICluster cluster)
        {
            ICqlCommand cmd = cluster.CreatePocoCommand();

            const string insertBatch = "INSERT INTO Foo.Bar (id, Baz) VALUES (?, ?)";
            var preparedInsert = cmd.Prepare(insertBatch);

            const int times = 10;

            var random = new Random();

            for (int i = 0; i < times; i++)
            {
                long running = Interlocked.Increment(ref _running);

                Console.WriteLine("Current {0} Running {1}", i, running);

                var data = new byte[30000];
                // var data = (float)random.NextDouble();
                preparedInsert.Execute(new {id = i, Baz = data}, ConsistencyLevel.ONE).AsFuture()
                              .ContinueWith(_ => Interlocked.Decrement(ref _running));
            }

            while (Thread.VolatileRead(ref _running) > 0)
            {
                Console.WriteLine("Running {0}", _running);
                Thread.Sleep(1000);
            }

            var result = cmd.Execute<Foo>("select * from Foo.Bar where id = 50").AsFuture().Result;
            foreach (var res in result)
            {
                Console.WriteLine("{0} len={1}", res.Id, res.Baz.Length);
            }
        }
 internal DseCluster(ICluster coreCluster, DseConfiguration config)
 {
     _coreCluster = coreCluster;
     _config = config;
     _coreCluster.HostAdded += OnCoreHostAdded;
     _coreCluster.HostRemoved += OnCoreHostRemoved;
 }
Exemple #12
0
 private void expandCluster(ICluster cluster)
 {
     string north = null, east = null, west = null, south = null, center = null;
     string northImg = "null", eastImg = "null", westImg = "null", southImg = "null", centerImg = "null";
     if (cluster.up == null)
         northImg = cluster.upImg;
     else
         north = cluster.up;
     if (cluster.right == null)
         eastImg = cluster.rightImg;
     else
         east = cluster.right;
     if (cluster.left == null)
         westImg = cluster.leftImg;
     else
         west = cluster.left;
     if (cluster.down == null)
         southImg = cluster.downImg;
     else
         south = cluster.down;
     if (cluster.center == null)
         centerImg = cluster.centerImg;
     else
         center = cluster.center;
     userScreen.clusterSection.east.SetElements(null, null, null, null, null, east);
     userScreen.clusterSection.west.SetElements(null, null, null, null, null, west);
     userScreen.clusterSection.south.SetElements(null, null, null, null, null, south);
     userScreen.clusterSection.center.SetElements(null, null, null, null, null, center);
     userScreen.clusterSection.north.SetElements(null, null, null, null, null, north);
     userScreen.clusterSection.east.SetImgElements("null", "null", "null", "null", "null", eastImg);
     userScreen.clusterSection.west.SetImgElements("null", "null", "null", "null", "null", westImg);
     userScreen.clusterSection.south.SetImgElements("null", "null", "null", "null", "null", southImg);
     userScreen.clusterSection.center.SetImgElements("null", "null", "null", "null", "null", centerImg);
     userScreen.clusterSection.north.SetImgElements("null", "null", "null", "null", "null", northImg);
 }
 public MembershipEvent(ICluster cluster, IMember member, int eventType, ICollection<IMember> members)
     : base(cluster)
 {
     this.member = member;
     this.eventType = eventType;
     this.members = members;
 }
Exemple #14
0
        protected override void DropKeyspace(ICluster cluster)
        {
            ICqlCommand cmd = cluster.CreatePocoCommand();

            const string dropExcelsor = "drop keyspace videos";
            cmd.Execute(dropExcelsor).AsFuture().Wait();
        }
		protected NodeBase(ICluster owner, IPEndPoint endpoint, IFailurePolicy failurePolicy, ISocket socket)
		{
			this.owner = owner;
			this.endpoint = endpoint;
			this.socket = socket;
			this.failurePolicy = failurePolicy;
			this.name = endpoint.ToString();

			failLock = new Object();
			writeQueue = new ConcurrentQueue<Data>();
			readQueue = new Queue<Data>();

			mustReconnect = true;
			IsAlive = true;

			counterEnqueuePerSec = Metrics.Meter("node write enqueue/sec", endpoint.ToString(), Interval.Seconds);
			counterDequeuePerSec = Metrics.Meter("node write dequeue/sec", endpoint.ToString(), Interval.Seconds);
			counterOpReadPerSec = Metrics.Meter("node op read/sec", endpoint.ToString(), Interval.Seconds);
			counterWriteQueue = Metrics.Counter("write queue length", endpoint.ToString());
			counterReadQueue = Metrics.Counter("read queue length", endpoint.ToString());

			counterWritePerSec = Metrics.Meter("node write/sec", endpoint.ToString(), Interval.Seconds);
			counterErrorPerSec = Metrics.Meter("node in error/sec", endpoint.ToString(), Interval.Seconds);
			counterItemCount = Metrics.Counter("commands", endpoint.ToString());
			gaugeSendSpeed = Metrics.Gauge("send speed", endpoint.ToString());
		}
 public void Setup()
 {
     var config = Utils.TestConfiguration.GetCurrentConfiguration();
     config.BucketConfigs.First().Value.UseEnhancedDurability = false;
     _cluster = new Cluster(config);
     _bucket = _cluster.OpenBucket();
 }
Exemple #17
0
 private async static Task ClearData(ICluster cluster)
 {
     using (var binding = new WritableServerBinding(cluster))
     {
         var commandOp = new DropDatabaseOperation(_database);
         await commandOp.ExecuteAsync(binding);
     }
 }
 public void TestFixtureTearDown()
 {
     if (_cluster != null)
     {
         _cluster.Dispose();
         _cluster = null;
     }
 }
 private void Disconnect()
 {
     _cluster.CloseBucket(_bucket);
     _bucket.Dispose();
     _bucket = null;
     _cluster.Dispose();
     _cluster = null;
 }
 public void OneTimeTearDown()
 {
     if (_cluster != null)
     {
         _cluster.Dispose();
         _cluster = null;
     }
 }
 // constructors
 /// <summary>
 /// Initializes a new instance of the <see cref="MongoServerInstance"/> class.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="address">The address.</param>
 /// <param name="cluster">The cluster.</param>
 internal MongoServerInstance(MongoServerSettings settings, MongoServerAddress address, ICluster cluster)
 {
     _settings = settings;
     _address = address;
     _cluster = cluster;
     _sequentialId = Interlocked.Increment(ref __nextSequentialId);
     _endPoint = new DnsEndPoint(address.Host, address.Port);
 }
Exemple #22
0
 private void HandleEvent(ICluster cluster)
 {
     string UIActionRequest = userScreen.HandleClusterEvent(cluster, wordCompletionSwitch.IsOn);
     if (UIActionRequest != null)
     {
         ExecuteUIAction(UIActionRequest);
     }
 }
        // constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="GridFSBucket" /> class.
        /// </summary>
        /// <param name="database">The database.</param>
        /// <param name="options">The options.</param>
        public GridFSBucket(IMongoDatabase database, GridFSBucketOptions options = null)
        {
            _database = Ensure.IsNotNull(database, nameof(database));
            _options = options == null ? ImmutableGridFSBucketOptions.Defaults : new ImmutableGridFSBucketOptions(options);

            _cluster = database.Client.Cluster;
            _ensuredIndexes = 0;
        }
        // constructors
        /// <inheritdoc />
        public GridFSBucket(IMongoDatabase database, GridFSBucketOptions.Immutable options = null)
        {
            _database = Ensure.IsNotNull(database, "database");
            _options = options ?? GridFSBucketOptions.Immutable.Defaults;

            _cluster = database.Client.Cluster;
            _ensuredIndexes = 0;
        }
 // constructors
 /// <summary>
 /// Initializes a new instance of the <see cref="MongoServerInstance" /> class.
 /// </summary>
 /// <param name="settings">The settings.</param>
 /// <param name="address">The address.</param>
 /// <param name="cluster">The cluster.</param>
 /// <param name="endPoint">The end point.</param>
 internal MongoServerInstance(MongoServerSettings settings, MongoServerAddress address, ICluster cluster, EndPoint endPoint)
 {
     _settings = settings;
     _address = address;
     _cluster = cluster;
     _sequentialId = Interlocked.Increment(ref __nextSequentialId);
     _endPoint = endPoint;
 }
        protected override void CreateKeyspace(ICluster cluster)
        {
            const string createKeyspaceFoo = "CREATE KEYSPACE Foo WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 1}";
            cluster.ExecuteNonQuery(createKeyspaceFoo).Wait();

            const string createBar = "CREATE TABLE Foo.Bar (id int, Baz blob, PRIMARY KEY (id))";
            cluster.ExecuteNonQuery(createBar).Wait();
        }
Exemple #27
0
 internal Session(ICluster cluster, Configuration configuration, string keyspace, Serializer serializer)
 {
     _serializer = serializer;
     Cluster = cluster;
     Configuration = configuration;
     Keyspace = keyspace;
     UserDefinedTypes = new UdtMappingDefinitions(this, serializer);
     _connectionPool = new ConcurrentDictionary<IPEndPoint, HostConnectionPool>();
 }
 public VolunteerController(IDisaster disasterSvc, ICluster clusterSvc, IAdmin adminSvc, IMessageService messageSvc, IVolunteerService volunteerSvc, IWebSecurityWrapper webSecurity)
 {
     _disasterSvc = disasterSvc;
     _clusterSvc = clusterSvc;
     _adminSvc = adminSvc;
     _messageSvc = messageSvc;
     _volunteerSvc = volunteerSvc;
     _webSecurity = webSecurity;
 }
        protected override void InternalRun(ICluster cluster)
        {
            const string cqlKeyspaces = "SELECT * from system.schema_columns";

            var req = from t in cluster.Execute<SchemaColumns>(cqlKeyspaces).Result
                      where t.KeyspaceName == "system"
                      select t;
            DisplayResult(req);
        }
 public MemberAttributeEvent(ICluster cluster, IMember member, MemberAttributeOperationType operationType,
     string key, object value)
     : base(cluster, member, MemberAttributeChanged, null)
 {
     _member = (Member) member;
     _operationType = operationType;
     _key = key;
     _value = value;
 }
        private void BinaryProtocolRunWritePerformanceParallel(string transportType)
        {
            //run Write Performance Test using cassandra-sharp driver
            CassandraSharpConfig cassandraSharpConfig = new CassandraSharpConfig();

            ClusterManager.Configure(cassandraSharpConfig);

            ClusterConfig clusterConfig = new ClusterConfig
            {
                Endpoints = new EndpointsConfig
                {
                    Servers = new[] { "cassandra1" }
                },
                Transport = new TransportConfig
                {
                    Type = transportType
                }
            };

            using (ICluster cluster = ClusterManager.GetCluster(clusterConfig))
            {
                ICqlCommand cmd = cluster.CreatePocoCommand();

                const string dropFoo = "drop keyspace Endurance";
                try
                {
                    cmd.Execute(dropFoo).AsFuture().Wait();
                }
                catch
                {
                }

                const string createFoo = "CREATE KEYSPACE Endurance WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 1}";
                Console.WriteLine("============================================================");
                Console.WriteLine(createFoo);
                Console.WriteLine("============================================================");

                var resCount = cmd.Execute(createFoo);
                resCount.AsFuture().Wait();
                Console.WriteLine();
                Console.WriteLine();

                const string createBar = "CREATE TABLE Endurance.stresstest (strid varchar,intid int,PRIMARY KEY (strid))";
                Console.WriteLine("============================================================");
                Console.WriteLine(createBar);
                Console.WriteLine("============================================================");
                resCount = cmd.Execute(createBar);
                resCount.AsFuture().Wait();
                Console.WriteLine();
                Console.WriteLine();

                const string insertPerf = "UPDATE Endurance.stresstest SET intid = ? WHERE strid = ?";
                Console.WriteLine("============================================================");
                Console.WriteLine(" Cassandra-Sharp Driver write performance test single thread ");
                Console.WriteLine("============================================================");
                var prepared = cmd.Prepare(insertPerf);

                var timer = Stopwatch.StartNew();

                int running = 0;
                for (int i = 0; i < 100000; i++)
                {
                    if (0 == i % 1000)
                    {
                        Console.WriteLine("Sent {0} requests - pending requests {1}", i, Interlocked.CompareExchange(ref running, 0, 0));
                    }

                    Interlocked.Increment(ref running);
                    prepared.Execute(new { intid = i, strid = i.ToString("X") }).AsFuture().ContinueWith(_ => Interlocked.Decrement(ref running));
                }

                while (0 != Interlocked.CompareExchange(ref running, 0, 0))
                {
                    Console.WriteLine("{0} requests still running", running);
                    Thread.Sleep(1 * 1000);
                }
                timer.Stop();
                Console.WriteLine("Endurance ran in {0} ms", timer.ElapsedMilliseconds);

                Console.WriteLine("============================================================");
                Console.WriteLine(dropFoo);
                Console.WriteLine("============================================================");

                cmd.Execute(dropFoo).AsFuture().Wait();
            }

            ClusterManager.Shutdown();
        }
 public Task <ISession> GetConnectionAsync(ICluster cluster)
 {
     return(cluster.ConnectAsync());
 }
Exemple #33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SplitReadWriteBinding"/> class.
 /// </summary>
 /// <param name="cluster">The cluster.</param>
 /// <param name="readPreference">The read preference.</param>
 public SplitReadWriteBinding(ICluster cluster, ReadPreference readPreference)
     : this(new ReadPreferenceBinding(cluster, readPreference), new WritableServerBinding(cluster))
 {
 }
 public string GetKeyspaceDefinition(ICluster cluster, string keyspaceName)
 {
     return(cluster.Metadata.GetKeyspace(keyspaceName).AsCqlQuery());
 }
 public static int _state(this ICluster cluster) => (int)((InterlockedInt32)Reflector.GetFieldValue(cluster, nameof(_state))).Value;
Exemple #36
0
 public ClusterController(ICluster cluster, ClientConfiguration clientConfig)
     : this(clientConfig)
 {
     Cluster = cluster;
 }
 internal CqlCommandBuilder(ICluster cluster)
 {
     _cluster = cluster;
 }
 public CouchbaseCacheStore(ICluster cluster, string bucketname)
 {
     _cluster    = cluster;
     _bucketname = bucketname;
 }
Exemple #39
0
 public CqlCommand(ICluster cluster, IDataMapperFactory factoryIn, IDataMapperFactory factoryOut)
 {
     _cluster    = cluster;
     _factoryIn  = factoryIn;
     _factoryOut = factoryOut;
 }
Exemple #40
0
 public void Initialize(ICluster cluster)
 {
     _cluster = cluster;
 }
 private void Connect()
 {
     _cluster = new Cluster("couchbaseClients/couchbase");
     _bucket  = _cluster.OpenBucket();
 }
        // constructors
        public MongoDatabaseImpl(IMongoClient client, DatabaseNamespace databaseNamespace, MongoDatabaseSettings settings, ICluster cluster, IOperationExecutor operationExecutor)
        {
            _client            = Ensure.IsNotNull(client, nameof(client));
            _databaseNamespace = Ensure.IsNotNull(databaseNamespace, nameof(databaseNamespace));
            _settings          = Ensure.IsNotNull(settings, nameof(settings)).Freeze();
            _cluster           = Ensure.IsNotNull(cluster, nameof(cluster));
            _operationExecutor = Ensure.IsNotNull(operationExecutor, nameof(operationExecutor));

            _messageEncoderSettings = new MessageEncoderSettings
            {
                { MessageEncoderSettingsName.ReadEncoding, _settings.ReadEncoding ?? Utf8Encodings.Strict },
                { MessageEncoderSettingsName.WriteEncoding, _settings.WriteEncoding ?? Utf8Encodings.Strict }
            };
#pragma warning disable 618
            if (BsonDefaults.GuidRepresentationMode == GuidRepresentationMode.V2)
            {
                _messageEncoderSettings.Add(MessageEncoderSettingsName.GuidRepresentation, _settings.GuidRepresentation);
            }
#pragma warning restore 618
        }
Exemple #43
0
 internal ClusterInfo(ICluster cluster) : this(cluster.Index,
                                               cluster.Title, cluster.Count, cluster.TotalItemsEnqueueCount, cluster.TotalItemsDequeueCount,
                                               cluster.WorkingMode, cluster.Id)
 {
 }
 public void OneTimeSetUp()
 {
     _cluster = new Cluster(TestConfiguration.GetConfiguration("ssl"));
     _cluster.SetupEnhancedAuth();
     _bucket = _cluster.OpenBucket();
 }
Exemple #45
0
 public void TearDown()
 {
     _cluster?.Dispose();
     _cluster = null;
 }
Exemple #46
0
 public void Initialize(ICluster cluster)
 {
     _hosts = cluster.AllHosts();
 }
 /// <summary>
 /// Creates a new BucketQueryExecutor.
 /// </summary>
 /// <param name="cluster"><see cref="ICluster"/> to query.</param>
 public ClusterQueryExecutor(ICluster cluster)
 {
     _cluster = cluster;
     _logger  = cluster.ClusterServices.GetRequiredService <ILogger <ClusterQueryExecutor> >();
     _clusterVersionProvider = cluster.ClusterServices.GetRequiredService <IClusterVersionProvider>();
 }
 public void Initialize(ICluster cluster)
 {
     this._cluster = cluster;
     this._index   = StaticRandom.Instance.Next(cluster.AllHosts().Count);
 }
 public void OneTimeSetUp()
 {
     _cluster = new Cluster(Utils.TestConfiguration.GetConfiguration("basic"));
     _cluster.SetupEnhancedAuth();
     _clusterManager = _cluster.CreateManager(TestConfiguration.Settings.AdminUsername, TestConfiguration.Settings.AdminPassword);
 }
Exemple #50
0
        public void RecoveryTest()
        {
            CassandraSharpConfig cassandraSharpConfig = new CassandraSharpConfig
            {
                Logger = new LoggerConfig {
                    Type = typeof(ResilienceLogger).AssemblyQualifiedName
                },
                Recovery = new RecoveryConfig {
                    Interval = 2
                }
            };

            ClusterManager.Configure(cassandraSharpConfig);

            ClusterConfig clusterConfig = new ClusterConfig
            {
                Endpoints = new EndpointsConfig
                {
                    Servers = new[] { "localhost" },
                },
                Transport = new TransportConfig
                {
                    Port           = 666,
                    ReceiveTimeout = 10 * 1000,
                }
            };

            DisconnectingProxy proxy = new DisconnectingProxy(666, 9042);

            proxy.Start();

            using (ICluster cluster = ClusterManager.GetCluster(clusterConfig))
            {
                ICqlCommand cmd = cluster.CreatePocoCommand();

                const string dropFoo = "drop keyspace data";
                try
                {
                    cmd.Execute(dropFoo).AsFuture().Wait();
                }
                catch
                {
                }

                const string createFoo = "CREATE KEYSPACE data WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 1}";
                cmd.Execute(createFoo).AsFuture().Wait();

                const string createBar = "CREATE TABLE data.test (time text PRIMARY KEY)";
                cmd.Execute(createBar).AsFuture().Wait();

                proxy.EnableKiller();

                for (int i = 0; i < 100000; ++i)
                {
                    int attempt = 0;
                    while (true)
                    {
                        var    now    = DateTime.Now;
                        string insert = String.Format("insert into data.test(time) values ('{0}');", now);
                        Console.WriteLine("{0}.{1}) {2}", i, ++attempt, insert);

                        try
                        {
                            cmd.Execute(insert).AsFuture().Wait();
                            break;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("Failed with error {0}", ex.Message);
                            Thread.Sleep(1000);
                        }
                    }
                }

                Console.WriteLine("Stress test done");

                ClusterManager.Shutdown();
            }

            proxy.Stop();
        }
 public AppointmentController(ICluster cluster)
 {
     _bucket = cluster.OpenBucket("default");
 }
 // constructors
 public WritableServerBinding(ICluster cluster)
 {
     _cluster = Ensure.IsNotNull(cluster, "cluster");
 }
Exemple #53
0
        internal ClientSession(long sessionId, int responseStreamId, string responseChannel, byte[] encodedPrincipal, ICluster cluster)
        {
            _id = sessionId;
            _responseStreamId = responseStreamId;
            _responseChannel  = responseChannel;
            _encodedPrincipal = encodedPrincipal;
            _cluster          = cluster;

            UnsafeBuffer headerBuffer = new UnsafeBuffer(new byte[SESSION_HEADER_LENGTH]);

            _sessionHeaderEncoder.WrapAndApplyHeader(headerBuffer, 0, new MessageHeaderEncoder()).ClusterSessionId(sessionId);

            _vectors[0] = new DirectBufferVector(headerBuffer, 0, SESSION_HEADER_LENGTH);
            _vectors[1] = _messageBuffer;
        }
 /// <summary>
 /// Sets the current policy as extended retry policy.
 /// If the current policy is not <see cref="IExtendedRetryPolicy"/>, it creates a wrapper to delegate
 /// the methods that were not implemented to a default policy.
 /// </summary>
 internal void InitializeRetryPolicy(ICluster cluster)
 {
     _extendedRetryPolicy = _retryPolicy.Wrap(null);
 }
 // constructors
 public MongoDatabaseImpl(DatabaseNamespace databaseNamespace, MongoDatabaseSettings settings, ICluster cluster, IOperationExecutor operationExecutor)
 {
     _databaseNamespace = Ensure.IsNotNull(databaseNamespace, "databaseNamespace");
     _settings          = Ensure.IsNotNull(settings, "settings").Freeze();
     _cluster           = Ensure.IsNotNull(cluster, "cluster");
     _operationExecutor = Ensure.IsNotNull(operationExecutor, "operationExecutor");
 }
 // private methods
 private static bool AreSessionsSupported(ICluster cluster)
 {
     SpinWait.SpinUntil(() => cluster.Description.Servers.Any(s => s.State == ServerState.Connected), TimeSpan.FromSeconds(30));
     return(AreSessionsSupported(cluster.Description));
 }
 public CouchbaseCache(ClientConfiguration clientConfig, string bucketName)
 {
     this._cluster = new Cluster(clientConfig);
     this._bucket  = this._cluster.OpenBucket(bucketName);
 }
 // constructors
 public MongoDatabaseImpl(IMongoClient client, DatabaseNamespace databaseNamespace, MongoDatabaseSettings settings, ICluster cluster, IOperationExecutor operationExecutor)
 {
     _client            = Ensure.IsNotNull(client, nameof(client));
     _databaseNamespace = Ensure.IsNotNull(databaseNamespace, nameof(databaseNamespace));
     _settings          = Ensure.IsNotNull(settings, nameof(settings)).Freeze();
     _cluster           = Ensure.IsNotNull(cluster, nameof(cluster));
     _operationExecutor = Ensure.IsNotNull(operationExecutor, nameof(operationExecutor));
 }
Exemple #59
0
 public void Initialize(ICluster cluster)
 {
 }
Exemple #60
0
 public void Initialize(ICluster cluster)
 {
     _childPolicy.Initialize(cluster);
 }