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


Java ShardTable类代码示例

本文整理汇总了Java中com.mysql.fabric.ShardTable的典型用法代码示例。如果您正苦于以下问题:Java ShardTable类的具体用法?Java ShardTable怎么用?Java ShardTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getShardTables

import com.mysql.fabric.ShardTable; //导入依赖的package包/类
private FabricStateResponse<Set<ShardTable>> getShardTables(String shardMappingId) throws FabricCommunicationException {
	int version = 0;
	Object args[] = new Object[] {version, shardMappingId};
	DumpResponse tablesResponse = callDumpMethod("dump.shard_tables", args);
	Set<ShardTable> tables = new HashSet<ShardTable>();
	// construct the tables
	for (List rawTable : (List<List>) tablesResponse.getReturnValue()) {
		String database = (String)rawTable.get(0);
		String table = (String)rawTable.get(1);
		String column = (String)rawTable.get(2);
		String mappingId = (String)rawTable.get(3);
		ShardTable st = new ShardTable(database, table, column);
		tables.add(st);
	}
	return new FabricStateResponse<Set<ShardTable>>(tables, tablesResponse.getTtl());
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:17,代码来源:XmlRpcClient.java

示例2: getShardTables

import com.mysql.fabric.ShardTable; //导入依赖的package包/类
private FabricStateResponse<Set<ShardTable>> getShardTables(int shardMappingId) throws FabricCommunicationException {
    int version = 0;
    Object args[] = new Object[] { version, String.valueOf(shardMappingId) };
    Response tablesResponse = errorSafeCallMethod(METHOD_DUMP_SHARD_TABLES, args);
    Set<ShardTable> tables = new HashSet<ShardTable>();
    // construct the tables
    for (Map<String, ?> rawTable : tablesResponse.getResultSet()) {
        String database = (String) rawTable.get(FIELD_SCHEMA_NAME);
        String table = (String) rawTable.get(FIELD_TABLE_NAME);
        String column = (String) rawTable.get(FIELD_COLUMN_NAME);
        ShardTable st = new ShardTable(database, table, column);
        tables.add(st);
    }
    return new FabricStateResponse<Set<ShardTable>>(tables, tablesResponse.getTtl());
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:16,代码来源:XmlRpcClient.java

示例3: getShardMappings

import com.mysql.fabric.ShardTable; //导入依赖的package包/类
/**
 * Retrieve a set of complete shard mappings. The returned mappings include all information
 * available about the mapping.
 * 
 * @param shardMappingIdPattern
 *            the shard mapping id to retrieve
 */
public FabricStateResponse<Set<ShardMapping>> getShardMappings(String shardMappingIdPattern) throws FabricCommunicationException {
    int version = 0;
    Object args[] = new Object[] { version, shardMappingIdPattern }; // common to all calls
    Response mapsResponse = errorSafeCallMethod(METHOD_DUMP_SHARD_MAPS, args);
    // use the lowest ttl of all the calls
    long minExpireTimeMillis = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(mapsResponse.getTtl());
    int baseTtl = mapsResponse.getTtl();

    // construct the maps
    Set<ShardMapping> mappings = new HashSet<ShardMapping>();
    for (Map<String, ?> rawMapping : mapsResponse.getResultSet()) {
        int mappingId = (Integer) rawMapping.get(FIELD_MAPPING_ID);
        ShardingType shardingType = ShardingType.valueOf((String) rawMapping.get(FIELD_TYPE_NAME));
        String globalGroupName = (String) rawMapping.get(FIELD_GLOBAL_GROUP_ID);

        FabricStateResponse<Set<ShardTable>> tables = getShardTables(mappingId);
        FabricStateResponse<Set<ShardIndex>> indices = getShardIndices(mappingId);

        if (tables.getExpireTimeMillis() < minExpireTimeMillis) {
            minExpireTimeMillis = tables.getExpireTimeMillis();
        }
        if (indices.getExpireTimeMillis() < minExpireTimeMillis) {
            minExpireTimeMillis = indices.getExpireTimeMillis();
        }

        ShardMapping m = new ShardMappingFactory().createShardMapping(mappingId, shardingType, globalGroupName, tables.getData(), indices.getData());
        mappings.add(m);
    }

    return new FabricStateResponse<Set<ShardMapping>>(mappings, baseTtl, minExpireTimeMillis);
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:39,代码来源:XmlRpcClient.java

示例4: getShardTables

import com.mysql.fabric.ShardTable; //导入依赖的package包/类
private FabricStateResponse<Set<ShardTable>> getShardTables(int shardMappingId) throws FabricCommunicationException {
    int version = 0;
    Object args[] = new Object[] { version, String.valueOf(shardMappingId) };
    Response tablesResponse = errorSafeCallMethod(METHOD_DUMP_SHARD_TABLES, args);
    Set<ShardTable> tables = new HashSet<ShardTable>();
    // construct the tables
    for (Map rawTable : tablesResponse.getResultSet()) {
        String database = (String) rawTable.get(FIELD_SCHEMA_NAME);
        String table = (String) rawTable.get(FIELD_TABLE_NAME);
        String column = (String) rawTable.get(FIELD_COLUMN_NAME);
        ShardTable st = new ShardTable(database, table, column);
        tables.add(st);
    }
    return new FabricStateResponse<Set<ShardTable>>(tables, tablesResponse.getTtl());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:XmlRpcClient.java

示例5: getShardMappings

import com.mysql.fabric.ShardTable; //导入依赖的package包/类
/**
 * Retrieve a set of complete shard mappings. The returned mappings include all information
 * available about the mapping.
 * 
 * @param shardMappingIdPattern
 *            the shard mapping id to retrieve
 */
public FabricStateResponse<Set<ShardMapping>> getShardMappings(String shardMappingIdPattern) throws FabricCommunicationException {
    int version = 0;
    Object args[] = new Object[] { version, shardMappingIdPattern }; // common to all calls
    Response mapsResponse = errorSafeCallMethod(METHOD_DUMP_SHARD_MAPS, args);
    // use the lowest ttl of all the calls
    long minExpireTimeMillis = System.currentTimeMillis() + (1000 * mapsResponse.getTtl());

    // construct the maps
    Set<ShardMapping> mappings = new HashSet<ShardMapping>();
    for (Map rawMapping : mapsResponse.getResultSet()) {
        int mappingId = (Integer) rawMapping.get(FIELD_MAPPING_ID);
        ShardingType shardingType = ShardingType.valueOf((String) rawMapping.get(FIELD_TYPE_NAME));
        String globalGroupName = (String) rawMapping.get(FIELD_GLOBAL_GROUP_ID);

        FabricStateResponse<Set<ShardTable>> tables = getShardTables(mappingId);
        FabricStateResponse<Set<ShardIndex>> indices = getShardIndices(mappingId);

        if (tables.getExpireTimeMillis() < minExpireTimeMillis) {
            minExpireTimeMillis = tables.getExpireTimeMillis();
        }
        if (indices.getExpireTimeMillis() < minExpireTimeMillis) {
            minExpireTimeMillis = indices.getExpireTimeMillis();
        }

        ShardMapping m = new ShardMappingFactory().createShardMapping(mappingId, shardingType, globalGroupName, tables.getData(), indices.getData());
        mappings.add(m);
    }

    return new FabricStateResponse<Set<ShardMapping>>(mappings, minExpireTimeMillis);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:38,代码来源:XmlRpcClient.java

示例6: getShardMappings

import com.mysql.fabric.ShardTable; //导入依赖的package包/类
/**
 * Retrieve a set of complete shard mappings. The returned mappings include all information
 * available about the mapping.
 * @param shardMappingIdPattern the shard mapping id to retrieve
 */
public FabricStateResponse<Set<ShardMapping>> getShardMappings(String shardMappingIdPattern) throws FabricCommunicationException {
	int version = 0;
	Object args[] = new Object[] {version, shardMappingIdPattern}; // common to all calls
	DumpResponse mapsResponse = callDumpMethod("dump.shard_maps", args);
	// use the lowest ttl of all the calls
	long minExpireTimeMillis = System.currentTimeMillis() + (1000 * mapsResponse.getTtl());

	// construct the maps
	Set<ShardMapping> mappings = new HashSet<ShardMapping>();
	for (List rawMapping : (List<List>) mapsResponse.getReturnValue()) {
		String mappingId = (String)rawMapping.get(0);
		ShardingType shardingType = ShardingType.valueOf((String)rawMapping.get(1));
		String globalGroupName = (String)rawMapping.get(2);

		FabricStateResponse<Set<ShardTable>> tables = getShardTables(mappingId);
		FabricStateResponse<Set<ShardIndex>> indices = getShardIndices(mappingId);

		if (tables.getExpireTimeMillis() < minExpireTimeMillis)
			minExpireTimeMillis = tables.getExpireTimeMillis();
		if (indices.getExpireTimeMillis() < minExpireTimeMillis)
			minExpireTimeMillis = indices.getExpireTimeMillis();

		ShardMapping m = new ShardMappingFactory().createShardMapping(mappingId, shardingType, globalGroupName,
																	  tables.getData(), indices.getData());
		mappings.add(m);
	}

	return new FabricStateResponse<Set<ShardMapping>>(mappings, minExpireTimeMillis);
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:35,代码来源:XmlRpcClient.java


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