Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.CfDef$CfDefTupleScheme


  public void createColumnFamily(String keyspace, String columnFamilyName,
      String keyValidationClass, String comparatorType,
      String defaultValidationClass) throws Exception {

    CfDef columnFamily = new CfDef(keyspace, columnFamilyName);
    columnFamily.setKey_validation_class(keyValidationClass);
    columnFamily.setComparator_type(comparatorType);
    columnFamily.setDefault_validation_class(defaultValidationClass);
    server.system_add_column_family(columnFamily);
  }
View Full Code Here


  public void createColumnFamily(String keyspace, String columnFamilyName,
      String keyValidationClass, String comparatorType,
      String defaultValidationClass) throws Exception {

    CfDef columnFamily = new CfDef(keyspace, columnFamilyName);
    columnFamily.setKey_validation_class(keyValidationClass);
    columnFamily.setComparator_type(comparatorType);
    columnFamily.setDefault_validation_class(defaultValidationClass);

    tr = new TFramedTransport(new TSocket(cassandraHost, cassandraPort));
    proto = new TBinaryProtocol(tr);
    client = new Cassandra.Client(proto);
View Full Code Here

    if ("Standard".equals(type)) {
      subComparator = "";
    }
   
    // creating definition.
    CfDef cfdef = new CfDef(keyspaceName, name);
    cfdef.setComment(comment);
    cfdef.setColumn_type(type);
    cfdef.setComparator_type(comparator);
    if (subComparator != null && subComparator.length() > 0) {
      cfdef.setSubcomparator_type(subComparator);
    }
    cfdef.setKey_cache_size(keyCache);
    cfdef.setRow_cache_size(rowCache);
   
    client.system_add_column_family(cfdef);
   
    // redirecting to keyspace page.
    model.clear();
View Full Code Here

           .mergeShardsChance(0.0)
           .columnMetadata(indexes);

        // we'll be adding this one later. make sure it's not already there.
        assert cfm.getColumn_metadata().get(ByteBuffer.wrap(new byte[] { 5 })) == null;
        CfDef cfDef = cfm.toThrift();
       
        // add one.
        ColumnDef addIndexDef = new ColumnDef();
        addIndexDef.index_name = "5";
        addIndexDef.index_type = IndexType.KEYS;
View Full Code Here

        assert Schema.instance.getTableDefinition(cf.ksName) != null;
        assert Schema.instance.getTableDefinition(cf.ksName) == ksm;
        assert Schema.instance.getCFMetaData(cf.ksName, cf.cfName) != null;
       
        // updating certain fields should fail.
        CfDef cf_def = cf.toThrift();
        cf_def.column_metadata = new ArrayList<ColumnDef>();
        cf_def.default_validation_class ="BytesType";
        cf_def.min_compaction_threshold = 5;
        cf_def.max_compaction_threshold = 31;
       
View Full Code Here

                continue;

            String[] attr = comparator.getString(column.name()).split(":");
            assert attr.length == 2;

            CfDef cfDef = cfs.get(attr[0]);

            if (cfDef == null)
            {
                cfDef = new CfDef();
                cfs.put(attr[0], cfDef);
            }

            CfDef._Fields field = CfDef._Fields.findByName(attr[1]);
            cfDef.setFieldValue(field, deserializeValue(column.value(), getValueClass(CfDef.class, field.getFieldName())));
        }

        for (CfDef cfDef : cfs.values())
        {
            for (ColumnDef columnDef : ColumnDefinition.fromSchema(ColumnDefinition.readSchema(cfDef.keyspace, cfDef.name)))
                cfDef.addToColumn_metadata(columnDef);
        }

        return cfs;
    }
View Full Code Here

    }

    public UpdateColumnFamily generateMutation(String keyspace)
    throws InvalidRequestException, ConfigurationException, IOException
    {
        CfDef cfDef = null;

        KSMetaData ksm = Schema.instance.getTableDefinition(keyspace);

        for (CFMetaData cfm : ksm.cfMetaData().values())
        {
View Full Code Here

     *
     * @throws ConfigurationException if any of the attributes didn't pass validation
     */
    public RowMutation diff(CfDef newState, long modificationTimestamp) throws ConfigurationException
    {
        CfDef curState = toThrift();
        RowMutation m = new RowMutation(Table.SYSTEM_TABLE, SystemTable.getSchemaKSKey(ksName));

        for (CfDef._Fields field : CfDef._Fields.values())
        {
            if (field.equals(CfDef._Fields.COLUMN_METADATA))
                continue; // deal with columns after main attributes

            Object curValue = curState.isSet(field) ? curState.getFieldValue(field) : null;
            Object newValue = newState.isSet(field) ? newState.getFieldValue(field) : null;

            if (Objects.equal(curValue, newValue))
                continue;

View Full Code Here

     *
     * @throws IOException on any I/O related error
     */
    public static CfDef fromSchema(ColumnFamily serializedCfDef) throws IOException
    {
        CfDef cfDef = fromSchemaNoColumnDefinition(serializedCfDef);

        ColumnFamily serializedColumnDefinitions = ColumnDefinition.readSchema(cfDef.keyspace, cfDef.name);
        return addColumnDefinitionSchema(cfDef, serializedColumnDefinitions);
    }
View Full Code Here

    // Package protected for use by tests
    static CfDef fromSchemaNoColumnDefinition(ColumnFamily serializedCfDef)
    {
        assert serializedCfDef != null;

        CfDef cfDef = new CfDef();

        AbstractType sysComparator = serializedCfDef.getComparator();

        for (IColumn cfAttr : serializedCfDef.getSortedColumns())
        {
            if (cfAttr == null || cfAttr.isMarkedForDelete())
                continue;

            // column name format is <cf>:<attribute name>
            String[] attr = sysComparator.getString(cfAttr.name()).split(":");
            assert attr.length == 2;

            CfDef._Fields field = CfDef._Fields.findByName(attr[1]);
            cfDef.setFieldValue(field, deserializeValue(cfAttr.value(), getValueClass(CfDef.class, field.getFieldName())));
        }
        return cfDef;
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.CfDef$CfDefTupleScheme

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.