Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.KsDef


        {
            // Don't expose CF that cannot be correctly handle by thrift; see CASSANDRA-4377 for further details
            if (!cfm.isThriftIncompatible())
                cfDefs.add(cfm.toThrift());
        }
        KsDef ksdef = new KsDef(name, strategyClass.getName(), cfDefs);
        ksdef.setStrategy_options(strategyOptions);
        ksdef.setDurable_writes(durableWrites);

        return ksdef;
    }
View Full Code Here


        {
            // Don't expose CF that cannot be correctly handle by thrift; see CASSANDRA-4377 for further details
            if (cfm.isThriftCompatible())
                cfDefs.add(cfm.toThrift());
        }
        KsDef ksdef = new KsDef(name, strategyClass.getName(), cfDefs);
        ksdef.setStrategy_options(strategyOptions);
        ksdef.setDurable_writes(durableWrites);

        return ksdef;
    }
View Full Code Here

        {
            // Don't expose CF that cannot be correctly handle by thrift; see CASSANDRA-4377 for further details
            if (cfm.isThriftCompatible())
                cfDefs.add(cfm.toThrift());
        }
        KsDef ksdef = new KsDef(name, strategyClass.getName(), cfDefs);
        ksdef.setStrategy_options(strategyOptions);
        ksdef.setDurable_writes(durableWrites);

        return ksdef;
    }
View Full Code Here

    public KsDef toThrift()
    {
        List<CfDef> cfDefs = new ArrayList<CfDef>();
        for (CFMetaData cfm : cfMetaData().values())
            cfDefs.add(cfm.toThrift());
        KsDef ksdef = new KsDef(name, strategyClass.getName(), cfDefs);
        ksdef.setStrategy_options(strategyOptions);
        ksdef.setDurable_writes(durableWrites);

        return ksdef;
    }
View Full Code Here

        {
            // Don't expose CF that cannot be correctly handle by thrift; see CASSANDRA-4377 for further details
            if (cfm.isThriftCompatible())
                cfDefs.add(cfm.toThrift());
        }
        KsDef ksdef = new KsDef(name, strategyClass.getName(), cfDefs);
        ksdef.setStrategy_options(strategyOptions);
        ksdef.setDurable_writes(durableWrites);

        return ksdef;
    }
View Full Code Here

    public KsDef toThrift()
    {
        List<CfDef> cfDefs = new ArrayList<CfDef>(cfMetaData.size());
        for (CFMetaData cfm : cfMetaData().values())
            cfDefs.add(cfm.toThrift());
        KsDef ksdef = new KsDef(name, strategyClass.getName(), cfDefs);
        ksdef.setStrategy_options(strategyOptions);
        ksdef.setDurable_writes(durableWrites);

        return ksdef;
    }
View Full Code Here

        {
            // Don't expose CF that cannot be correctly handle by thrift; see CASSANDRA-4377 for further details
            if (!cfm.isThriftIncompatible())
                cfDefs.add(cfm.toThrift());
        }
        KsDef ksdef = new KsDef(name, strategyClass.getName(), cfDefs);
        ksdef.setStrategy_options(strategyOptions);
        ksdef.setDurable_writes(durableWrites);

        return ksdef;
    }
View Full Code Here

    response.getResults().put(operation.getId(), Arrays.asList(m));
  }

  public static void createKeyspace(String name, int replication){
    Collection<CFMetaData> cfDefs = new ArrayList<CFMetaData>(0);
    KsDef def = new KsDef();
    def.setName(name);
    def.setStrategy_class("SimpleStrategy");
    Map<String, String> strat = new HashMap<String, String>();
    strat.put("replication_factor", Integer.toString(replication));
    def.setStrategy_options(strat);
    KSMetaData ksm = null;
    try {
        ksm = KSMetaData.fromThrift(def,
            cfDefs.toArray(new CFMetaData[cfDefs.size()]));
        MigrationManager.announceNewKeyspace(ksm);
View Full Code Here

         // check if the keyspace exists
         try {
            cassandraClient.describe_keyspace(config.keySpace);
            return;
         } catch (NotFoundException e) {
            KsDef keySpace = new KsDef();
            keySpace.setName(config.keySpace);
            keySpace.setStrategy_class("org.apache.cassandra.locator.SimpleStrategy");
            Map<String, String> strategy_options = new HashMap<String, String>();
            strategy_options.put("replication_factor", "1");
            keySpace.setStrategy_options(strategy_options);

            CfDef entryCF = new CfDef();
            entryCF.setName(config.entryColumnFamily);
            entryCF.setKeyspace(config.keySpace);
            entryCF.setComparator_type("BytesType");
            keySpace.addToCf_defs(entryCF);

            CfDef expirationCF = new CfDef();
            expirationCF.setName(config.expirationColumnFamily);
            expirationCF.setKeyspace(config.keySpace);
            expirationCF.setColumn_type("Super");
            expirationCF.setComparator_type("LongType");
            expirationCF.setSubcomparator_type("BytesType");
            keySpace.addToCf_defs(expirationCF);

            cassandraClient.system_add_keyspace(keySpace);
         }
      } catch (Exception e) {
         throw new CacheLoaderException("Could not create keyspace/column families", e);
View Full Code Here

            {
                partitioner = FBUtilities.newPartitioner(client.describe_partitioner());

                // Get the Keyspace metadata, then get the specific CF metadata
                // in order to populate the sub/comparator.
                KsDef ks_def = client.describe_keyspace(keyspace);
                List<String> cfnames = new ArrayList<String>();
                for (CfDef cfd : ks_def.cf_defs)
                    cfnames.add(cfd.name);
                int idx = cfnames.indexOf(cfName);
                CfDef cf_def = ks_def.cf_defs.get(idx);
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.KsDef

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.