Search in sources :

Example 1 with DefaultXpipeMetaManager

use of com.ctrip.xpipe.redis.core.meta.impl.DefaultXpipeMetaManager in project x-pipe by ctripcorp.

the class ConfigCheck method fromXpipe.

private CheckCluster fromXpipe(XpipeMeta xpipeMeta, String checkCluster) {
    XpipeMetaManager xpm = new DefaultXpipeMetaManager(xpipeMeta);
    CheckCluster result = new CheckCluster(checkCluster);
    for (String dc : dcs) {
        ClusterMeta clusterMeta = xpm.getClusterMeta(dc, checkCluster);
        if (clusterMeta == null) {
            continue;
        }
        for (ShardMeta shardMeta : clusterMeta.getShards().values()) {
            CheckShard orShard = result.getOrCreate(shardMeta.getId());
            shardMeta.getRedises().forEach(redis -> {
                orShard.addRedis(new CheckRedis(redis.getIp(), redis.getPort(), dc));
            });
        }
    }
    return result;
}
Also used : DefaultXpipeMetaManager(com.ctrip.xpipe.redis.core.meta.impl.DefaultXpipeMetaManager) XpipeMetaManager(com.ctrip.xpipe.redis.core.meta.XpipeMetaManager) DefaultXpipeMetaManager(com.ctrip.xpipe.redis.core.meta.impl.DefaultXpipeMetaManager)

Example 2 with DefaultXpipeMetaManager

use of com.ctrip.xpipe.redis.core.meta.impl.DefaultXpipeMetaManager in project x-pipe by ctripcorp.

the class ClientConfigMonitor method fromXPipe.

private CheckCluster fromXPipe(XpipeMeta xpipeMeta, String checkCluster) {
    XpipeMetaManager xpm = new DefaultXpipeMetaManager(xpipeMeta);
    CheckCluster result = new CheckCluster(checkCluster);
    for (String dc : xpipeMeta.getDcs().keySet()) {
        ClusterMeta clusterMeta = xpm.getClusterMeta(dc, checkCluster);
        if (clusterMeta == null) {
            continue;
        }
        for (ShardMeta shardMeta : clusterMeta.getShards().values()) {
            CheckShard orShard = result.getOrCreate(shardMeta.getId());
            shardMeta.getRedises().forEach(redis -> {
                orShard.addRedis(new CheckRedis(redis.getIp(), redis.getPort(), dc));
            });
        }
    }
    return result;
}
Also used : DefaultXpipeMetaManager(com.ctrip.xpipe.redis.core.meta.impl.DefaultXpipeMetaManager) ClusterMeta(com.ctrip.xpipe.redis.core.entity.ClusterMeta) ShardMeta(com.ctrip.xpipe.redis.core.entity.ShardMeta) XpipeMetaManager(com.ctrip.xpipe.redis.core.meta.XpipeMetaManager) DefaultXpipeMetaManager(com.ctrip.xpipe.redis.core.meta.impl.DefaultXpipeMetaManager)

Aggregations

XpipeMetaManager (com.ctrip.xpipe.redis.core.meta.XpipeMetaManager)2 DefaultXpipeMetaManager (com.ctrip.xpipe.redis.core.meta.impl.DefaultXpipeMetaManager)2 ClusterMeta (com.ctrip.xpipe.redis.core.entity.ClusterMeta)1 ShardMeta (com.ctrip.xpipe.redis.core.entity.ShardMeta)1