Package com.netflix.astyanax.ddl

Examples of com.netflix.astyanax.ddl.ColumnFamilyDefinition


      //perhaps the schema is changing and was caused by someone else, let's wait until it stablizes
      waitForNodesToBeUpToDate(null, 300000);
     
      //NOW, the schema appears stable, let's get that column family and load it
      KeyspaceDefinition keySpaceMeta = keyspace.describeKeyspace();
      ColumnFamilyDefinition def = keySpaceMeta.getColumnFamily(realCf);
      if(def == null) {
        if (log.isInfoEnabled())
          log.info("Well, we did NOT find any column family="+realCf+" to load in cassandra(from virt="+virtCf+")");
        return null;
      }
View Full Code Here


    String keysp = keyspace.getKeyspaceName();
    String cfName = meta.getRealColumnFamily().toLowerCase();
    String colFamily = meta.getRealColumnFamily();
    if (log.isInfoEnabled())
      log.info("CREATING colfamily="+cfName+" in keyspace="+keysp);
    ColumnFamilyDefinition def = cluster.makeColumnFamilyDefinition()
          .setName(colFamily)
          .setKeyspace(keysp);

    if (log.isInfoEnabled())
      log.info("keyspace="+def.getKeyspace()+" col family="+def.getName());
    StorageTypeEnum rowKeyType = meta.getIdColumnMeta().getStorageType();
    ColumnType colType = ColumnType.ANY_EXCEPT_COMPOSITE;
    if(meta.isVirtualCf()) {
      rowKeyType = StorageTypeEnum.BYTES;
    } else {
View Full Code Here

    cfNameToCassandra.put(realCfLower, info);
  }
 
  private ColumnFamilyDefinition setColumnNameCompareType(DboTableMeta cf,
      StorageTypeEnum type, ColumnFamilyDefinition def2) {
    ColumnFamilyDefinition def = def2;
    if(type == null) {
      StorageTypeEnum t = cf.getNameStorageType();
      if(t == StorageTypeEnum.STRING)
        def = def.setComparatorType("UTF8Type");
      else if(t == StorageTypeEnum.DECIMAL)
        def = def.setComparatorType("DecimalType");
      else if(t == StorageTypeEnum.INTEGER)
        def = def.setComparatorType("IntegerType");
      else
        throw new UnsupportedOperationException("type="+type+" is not supported at this time");
    } else if(type == StorageTypeEnum.STRING) {
      def = def.setComparatorType("CompositeType(UTF8Type, BytesType)");
    } else if(type == StorageTypeEnum.INTEGER) {
      def = def.setComparatorType("CompositeType(IntegerType, BytesType)");
    } else if(type == StorageTypeEnum.DECIMAL) {
      def = def.setComparatorType("CompositeType(DecimalType, BytesType)");
    }
    else
      throw new UnsupportedOperationException("Not supported yet, we need a BigDecimal comparator type here for sure");
    return def;
  }
View Full Code Here

    return def;
  }

  private ColumnFamilyDefinition addRowKeyValidation(DboTableMeta cf,
      ColumnFamilyDefinition def2) {
    ColumnFamilyDefinition def = def2;
    DboColumnMeta idColumnMeta = cf.getIdColumnMeta();
    StorageTypeEnum rowKeyType = idColumnMeta.getStorageType();
    switch (rowKeyType) {
    case STRING:
      def = def.setKeyValidationClass("UTF8Type");
      break;
    case INTEGER:
      def = def.setKeyValidationClass("IntegerType");
      break;
    case DECIMAL:
      def = def.setKeyValidationClass("DecimalType");
      break;
    case BYTES:
      break;
    default:
      throw new UnsupportedOperationException("type="+rowKeyType+" is not supported at this time");
View Full Code Here

      //perhaps the schema is changing and was caused by someone else, let's wait until it stablizes
      waitForNodesToBeUpToDate(null, 300000);
     
      //NOW, the schema appears stable, let's get that column family and load it
      KeyspaceDefinition keySpaceMeta = keyspace.describeKeyspace();
      ColumnFamilyDefinition def = keySpaceMeta.getColumnFamily(realCf);
      if(def == null) {
        log.info("Well, we did NOT find any column family="+realCf+" to load in cassandra(from virt="+virtCf+")");
        return null;
      }
      log.info("coooool, we found a new column family="+realCf+"(virt="+virtCf+") to load so we are going to load that for you so every future operation is FAST");
View Full Code Here

  private void createColFamilyInCassandra(DboTableMeta meta) {
    String keysp = keyspace.getKeyspaceName();
    String cfName = meta.getRealColumnFamily().toLowerCase();
    String colFamily = meta.getRealColumnFamily();
    log.info("CREATING colfamily="+cfName+" in keyspace="+keysp);
    ColumnFamilyDefinition def = cluster.makeColumnFamilyDefinition()
          .setName(colFamily)
          .setKeyspace(keysp);

    log.info("keyspace="+def.getKeyspace()+" col family="+def.getName());
    StorageTypeEnum rowKeyType = meta.getIdColumnMeta().getStorageType();
    ColumnType colType = ColumnType.ANY_EXCEPT_COMPOSITE;
    if(meta.isVirtualCf()) {
      rowKeyType = StorageTypeEnum.BYTES;
    } else {
View Full Code Here

    cfNameToCassandra.put(realCfLower, info);
  }
 
  private ColumnFamilyDefinition setColumnNameCompareType(DboTableMeta cf,
      StorageTypeEnum type, ColumnFamilyDefinition def2) {
    ColumnFamilyDefinition def = def2;
    if(type == null) {
      StorageTypeEnum t = cf.getNameStorageType();
      if(t == StorageTypeEnum.STRING)
        def = def.setComparatorType("UTF8Type");
      else if(t == StorageTypeEnum.DECIMAL)
        def = def.setComparatorType("DecimalType");
      else if(t == StorageTypeEnum.INTEGER)
        def = def.setComparatorType("IntegerType");
      else
        throw new UnsupportedOperationException("type="+type+" is not supported at this time");
    } else if(type == StorageTypeEnum.STRING) {
      def = def.setComparatorType("CompositeType(UTF8Type, BytesType)");
    } else if(type == StorageTypeEnum.INTEGER) {
      def = def.setComparatorType("CompositeType(IntegerType, BytesType)");
    } else if(type == StorageTypeEnum.DECIMAL) {
      def = def.setComparatorType("CompositeType(DecimalType, BytesType)");
    }
    else
      throw new UnsupportedOperationException("Not supported yet, we need a BigDecimal comparator type here for sure");
    return def;
  }
View Full Code Here

      //perhaps the schema is changing and was caused by someone else, let's wait until it stablizes
      waitForNodesToBeUpToDate(null, 300000);
     
      //NOW, the schema appears stable, let's get that column family and load it
      KeyspaceDefinition keySpaceMeta = keyspace.describeKeyspace();
      ColumnFamilyDefinition def = keySpaceMeta.getColumnFamily(realCf);
      if(def == null) {
        if (log.isInfoEnabled())
          log.info("Well, we did NOT find any column family="+realCf+" to load in cassandra(from virt="+virtCf+")");
        return null;
      }
View Full Code Here

    String cfName = meta.getRealColumnFamily().toLowerCase();
   
    String colFamily = meta.getRealColumnFamily();
    if (log.isInfoEnabled())
      log.info("CREATING colfamily="+cfName+" in keyspace="+keysp);
    ColumnFamilyDefinition def = cluster.makeColumnFamilyDefinition();
   
    if(callback != null)
      def = (ColumnFamilyDefinition) callback.modifyColumnFamily(colFamily, def);

    def = def.setName(colFamily)
          .setKeyspace(keysp);

    if (log.isInfoEnabled())
      log.info("keyspace="+def.getKeyspace()+" col family="+def.getName());
    StorageTypeEnum rowKeyType = meta.getIdColumnMeta().getStorageType();
    ColumnType colType = ColumnType.ANY_EXCEPT_COMPOSITE;
    if(meta.isVirtualCf()) {
      rowKeyType = StorageTypeEnum.BYTES;
    } else {
      StorageTypeEnum type = meta.getColNamePrefixType();
      def = addRowKeyValidation(meta, def);
      def = setColumnNameCompareType(meta, type, def);
     
      if(type == StorageTypeEnum.STRING)
        colType = ColumnType.COMPOSITE_STRINGPREFIX;
      else if(type == StorageTypeEnum.INTEGER)
        colType = ColumnType.COMPOSITE_INTEGERPREFIX;
      else if(type == StorageTypeEnum.DECIMAL)
        colType = ColumnType.COMPOSITE_DECIMALPREFIX;
    }
   
    if(meta.isTimeSeries()) {
      //override for special case of time series data
      def = def.setComparatorType("IntegerType");
    }

    addColumnFamily(def);
    String virtual = meta.getColumnFamily();
    String realCf = meta.getRealColumnFamily();
View Full Code Here

    cfNameToCassandra.put(realCfLower, info);
  }
 
  private ColumnFamilyDefinition setColumnNameCompareType(DboTableMeta cf,
      StorageTypeEnum type, ColumnFamilyDefinition def2) {
    ColumnFamilyDefinition def = def2;
    if(type == null) {
      StorageTypeEnum t = cf.getNameStorageType();
      if(t == StorageTypeEnum.STRING)
        def = def.setComparatorType("UTF8Type");
      else if(t == StorageTypeEnum.DECIMAL)
        def = def.setComparatorType("DecimalType");
      else if(t == StorageTypeEnum.INTEGER)
        def = def.setComparatorType("IntegerType");
      else
        throw new UnsupportedOperationException("type="+type+" is not supported at this time");
    } else if(type == StorageTypeEnum.STRING) {
      def = def.setComparatorType("CompositeType(UTF8Type, BytesType)");
    } else if(type == StorageTypeEnum.INTEGER) {
      def = def.setComparatorType("CompositeType(IntegerType, BytesType)");
    } else if(type == StorageTypeEnum.DECIMAL) {
      def = def.setComparatorType("CompositeType(DecimalType, BytesType)");
    }
    else
      throw new UnsupportedOperationException("Not supported yet, we need a BigDecimal comparator type here for sure");
    return def;
  }
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.ddl.ColumnFamilyDefinition

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.