Package com.netflix.astyanax.ddl

Examples of com.netflix.astyanax.ddl.ColumnFamilyDefinition


  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

    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

    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

    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

                for (ColumnFamilyDefinition cfDef : ksDef.getColumnFamilyList()) {
                    found |= cfDef.getName().equals(name);
                }
            }
            if (!found) {
                ColumnFamilyDefinition cfDef =
                        cl.makeColumnFamilyDefinition()
                                .setName(name)
                                .setKeyspace(keySpaceName)
                                .setComparatorType(comparator);

                ImmutableMap.Builder<String, String> compressionOptions = new ImmutableMap.Builder<String, String>();

                if (compressionEnabled) {
                    compressionOptions.put("sstable_compression", compressionClass)
                            .put("chunk_length_kb", Integer.toString(compressionChunkSizeKB));
                }

                cl.addColumnFamily(cfDef.setCompressionOptions(compressionOptions.build()));
            }
        } catch (ConnectionException e) {
            throw new TemporaryStorageException(e);
        }
    }
View Full Code Here

            if (null == kdef) {
                throw new PermanentStorageException("Keyspace " + k.getKeyspaceName() + " is undefined");
            }

            ColumnFamilyDefinition cfdef = kdef.getColumnFamily(cf);

            if (null == cfdef) {
                throw new PermanentStorageException("Column family " + cf + " is undefined");
            }

            return cfdef.getCompressionOptions();
        } catch (ConnectionException e) {
            throw new PermanentStorageException(e);
        }
    }
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.