本文整理汇总了C#中Cassandra.Session.WaitForSchemaAgreement方法的典型用法代码示例。如果您正苦于以下问题:C# Session.WaitForSchemaAgreement方法的具体用法?C# Session.WaitForSchemaAgreement怎么用?C# Session.WaitForSchemaAgreement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cassandra.Session
的用法示例。
在下文中一共展示了Session.WaitForSchemaAgreement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: checkKSMetadata
public void checkKSMetadata()
{
CCMCluster = CCMBridge.CCMCluster.Create(2, Cluster.Builder());
try
{
Session = CCMCluster.Session;
Cluster = CCMCluster.Cluster;
Session.CreateKeyspaceIfNotExists(Keyspace);
Session.ChangeKeyspace(Keyspace);
string keyspacename = "keyspace" + Guid.NewGuid().ToString("N").ToLower();
bool durableWrites = false;
string strgyClass = "SimpleStrategy";
short rplctnFactor = 1;
Session.WaitForSchemaAgreement(
Session.Execute(
string.Format(@"CREATE KEYSPACE {0}
WITH replication = {{ 'class' : '{1}', 'replication_factor' : {2} }}
AND durable_writes={3};"
, keyspacename, strgyClass, rplctnFactor.ToString(), durableWrites.ToString()))
);
Session.ChangeKeyspace(keyspacename);
for (int i = 0; i < 10; i++)
checkPureMetadata("table" + Guid.NewGuid().ToString("N"), keyspacename);
KeyspaceMetadata ksmd = Cluster.Metadata.GetKeyspace(keyspacename);
Assert.True(ksmd.DurableWrites == durableWrites);
Assert.True(ksmd.Replication.Where(opt => opt.Key == "replication_factor").First().Value == rplctnFactor);
Assert.True(ksmd.StrategyClass == strgyClass);
}
finally
{
CCMCluster.Discard();
}
}