Beispiel #1
0
        public IKeyspace GetKeyspace(string keyspaceName, ConsistencyLevel consistencyLevel, FailoverPolicy failoverPolicy)
        {
            var key = BuildKeyspaceMapName(keyspaceName, consistencyLevel, failoverPolicy);

            IKeyspace keyspace;

            if (keyspaceMap.ContainsKey(key))
            {
                keyspace = keyspaceMap[key];
            }
            else
            {
                if (Keyspaces.Contains(keyspaceName))
                {
                    IDictionary <string, Dictionary <string, string> > keyspaceDesc = null;

                    keyspaceDesc = cassandra.describe_keyspace(keyspaceName);
                    keyspace     = keyspaceFactory.Create(this, keyspaceName, keyspaceDesc,
                                                          consistencyLevel, failoverPolicy, pool);
                    IKeyspace tmp = null;
                    if (!keyspaceMap.ContainsKey(key))
                    {
                        keyspaceMap.Add(key, keyspace);
                        tmp = keyspaceMap[key];
                    }
                    if (tmp != null)
                    {
                        // There was another put that got here before we did.
                        keyspace = tmp;
                    }
                }
                else
                {
                    throw new Exception("Requested key space not exist, keyspaceName=" + keyspaceName);
                }
            }
            return(keyspace);
        }
Beispiel #2
0
 public Apache.Cassandra.KsDef describe_keyspace(string keyspace)
 {
     return(_client.describe_keyspace(keyspace));
 }