当前位置: 首页>>代码示例>>Java>>正文


Java Keyspace.describeKeyspace方法代码示例

本文整理汇总了Java中com.netflix.astyanax.Keyspace.describeKeyspace方法的典型用法代码示例。如果您正苦于以下问题:Java Keyspace.describeKeyspace方法的具体用法?Java Keyspace.describeKeyspace怎么用?Java Keyspace.describeKeyspace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.netflix.astyanax.Keyspace的用法示例。


在下文中一共展示了Keyspace.describeKeyspace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCompressionOptions

import com.netflix.astyanax.Keyspace; //导入方法依赖的package包/类
@Override
public Map<String, String> getCompressionOptions(String cf) throws BackendException {
    try {
        Keyspace k = keyspaceContext.getClient();

        KeyspaceDefinition kdef = k.describeKeyspace();

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

        ColumnFamilyDefinition cfdef = kdef.getColumnFamily(cf);

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

        return cfdef.getCompressionOptions();
    } catch (ConnectionException e) {
        throw new PermanentBackendException(e);
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:23,代码来源:AstyanaxStoreManager.java

示例2: autotest

import com.netflix.astyanax.Keyspace; //导入方法依赖的package包/类
/**
 * Test if database is ok, else create keyspace and CF as needed
 */
public static void autotest() throws Exception {
	if (initcount > 1) {
		/**
		 * If you have already initialized the class
		 */
		resetinit();
	}
	
	Keyspace keyspace = getkeyspace();
	try {
		keyspace.describeKeyspace();
	} catch (ConnectionException e) {
		if (e.getMessage().endsWith("InvalidRequestException(why:Keyspace '" + default_keyspacename + "' does not exist)")) {
			Loggers.Cassandra.info("Create keyspace " + default_keyspacename);
			createKeyspace(default_keyspacename);
		} else {
			throw e;
		}
	}
}
 
开发者ID:hdsdi3g,项目名称:MyDMAM,代码行数:24,代码来源:CassandraDb.java

示例3: initKeyspace

import com.netflix.astyanax.Keyspace; //导入方法依赖的package包/类
@Override
public void initKeyspace(Keyspace keyspace) throws ConnectionException {
    try {
        keyspace.describeKeyspace();
    } catch (ConnectionException e) {
        Map<String, Object> options = ImmutableMap.<String, Object>builder()
            .put("name", keyspace.getKeyspaceName())
            .put("strategy_class", "SimpleStrategy")
            .put("strategy_options", ImmutableMap.of("replication_factor", "1"))
            .build();
        keyspace.createKeyspace(options);
    }
}
 
开发者ID:spinnaker,项目名称:kork,代码行数:14,代码来源:AstyanaxComponents.java

示例4: AstyanaxMetaDaoImpl

import com.netflix.astyanax.Keyspace; //导入方法依赖的package包/类
@Inject
public AstyanaxMetaDaoImpl(@Named("astmetaks") Keyspace keyspace) {
	this.keyspace = keyspace;
	try {
		keyspace.describeKeyspace();
		logger.info("keyspaces for staash exists already");
		StaashRequestContext.addContext("Meta_Init",
				"keyspace already existed");
	} catch (ConnectionException ex) {
		StaashRequestContext.addContext("Meta_Init",
				"Keyspace did not exist , creating keyspace "+MetaConstants.META_KEY_SPACE
						);
		maybecreateschema();
	}
}
 
开发者ID:Netflix,项目名称:staash,代码行数:16,代码来源:AstyanaxMetaDaoImpl.java


注:本文中的com.netflix.astyanax.Keyspace.describeKeyspace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。