예제 #1
0
        public static SimulacronCluster CreateNew(SimulacronOptions options)
        {
            var simulacronManager = SimulacronManager.Instance;

            simulacronManager.Start();
            var path = string.Format(CreateClusterPathFormat, options.Nodes, options.GetCassandraVersion(), options.GetDseVersion(), options.Name,
                                     options.ActivityLog, options.NumberOfTokens);
            var data    = TaskHelper.WaitToComplete(Post(path, null));
            var cluster = new SimulacronCluster(data["id"].ToString());

            cluster.Data        = data;
            cluster.DataCenters = new List <SimulacronDataCenter>();
            var dcs = (JArray)cluster.Data["data_centers"];

            foreach (var dc in dcs)
            {
                var dataCenter = new SimulacronDataCenter(cluster.Id + "/" + dc["id"]);
                cluster.DataCenters.Add(dataCenter);
                dataCenter.Nodes = new List <SimulacronNode>();
                var nodes = (JArray)dc["nodes"];
                foreach (var nodeJObject in nodes)
                {
                    var node = new SimulacronNode(dataCenter.Id + "/" + nodeJObject["id"]);
                    dataCenter.Nodes.Add(node);
                    node.ContactPoint = nodeJObject["address"].ToString();
                }
            }
            return(cluster);
        }
예제 #2
0
        public static async Task <SimulacronCluster> CreateNewAsync(SimulacronOptions options)
        {
            var simulacronManager = SimulacronManager.Instance;

            simulacronManager.Start();
            var path = string.Format(CreateClusterPathFormat, options.Nodes, options.GetCassandraVersion(),
                                     options.GetDseVersion(), options.Name, options.ActivityLog, options.NumberOfTokens);
            var data = await Post(path, null).ConfigureAwait(false);

            return(CreateFromData(data));
        }
예제 #3
0
        public static SimulacronCluster CreateNew(SimulacronOptions options)
        {
            var simulacronManager = SimulacronManager.Instance;

            simulacronManager.Start();
            var path = string.Format(CreateClusterPathFormat, options.Nodes, options.GetCassandraVersion(),
                                     options.GetDseVersion(), options.Name, options.ActivityLog, options.NumberOfTokens);
            var data = TaskHelper.WaitToComplete(Post(path, null));

            return(CreateFromData(data));
        }
예제 #4
0
 public static Task <SimulacronCluster> CreateNewAsync(SimulacronOptions options)
 {
     SimulacronManager.DefaultInstance.Start();
     return(CreateNewAsync(SimulacronManager.DefaultInstance, options));
 }
예제 #5
0
 public static SimulacronCluster CreateNew(SimulacronManager simulacronManager, SimulacronOptions options)
 {
     return(TaskHelper.WaitToComplete(CreateNewAsync(simulacronManager, options)));
 }
예제 #6
0
 public static SimulacronCluster CreateNew(SimulacronOptions options)
 {
     return(SimulacronManager.DefaultInstance.CreateNew(options));
 }
예제 #7
0
 public static Task <SimulacronCluster> CreateNewAsync(SimulacronOptions options)
 {
     return(SimulacronManager.DefaultInstance.CreateNewAsync(options));
 }