Exemple #1
0
 public static KSMetaData testMetadata(
     String name,
     Class<? extends AbstractReplicationStrategy> strategyClass,
     Map<String, String> strategyOptions,
     CFMetaData... cfDefs) {
   return new KSMetaData(name, strategyClass, strategyOptions, true, Arrays.asList(cfDefs));
 }
Exemple #2
0
 public static KSMetaData systemKeyspace() {
   List<CFMetaData> cfDefs =
       Arrays.asList(
           CFMetaData.StatusCf,
           CFMetaData.HintsCf,
           CFMetaData.MigrationsCf,
           CFMetaData.SchemaCf,
           CFMetaData.IndexCf,
           CFMetaData.NodeIdCf,
           CFMetaData.VersionCf,
           CFMetaData.SchemaKeyspacesCf,
           CFMetaData.SchemaColumnFamiliesCf,
           CFMetaData.SchemaColumnsCf);
   return new KSMetaData(Table.SYSTEM_TABLE, LocalStrategy.class, optsWithRF(1), true, cfDefs);
 }
Exemple #3
0
  public static KSMetaData fromThrift(KsDef ksd, CFMetaData... cfDefs)
      throws ConfigurationException {
    Class<? extends AbstractReplicationStrategy> cls =
        AbstractReplicationStrategy.getClass(ksd.strategy_class);
    if (cls.equals(LocalStrategy.class))
      throw new ConfigurationException(
          "Unable to use given strategy class: LocalStrategy is reserved for internal use.");

    return new KSMetaData(
        ksd.name,
        cls,
        ksd.strategy_options == null
            ? Collections.<String, String>emptyMap()
            : ksd.strategy_options,
        ksd.durable_writes,
        Arrays.asList(cfDefs));
  }