com.taobao.metamorphosis.utils
类 MetaZookeeper

java.lang.Object
  继承者 com.taobao.metamorphosis.utils.MetaZookeeper

public class MetaZookeeper
extends Object

Meta与zookeeper交互的辅助类

作者:
boyan(boyan@taobao.com)

嵌套类摘要
 class MetaZookeeper.ZKGroupDirs
           
 class MetaZookeeper.ZKGroupTopicDirs
           
 
字段摘要
 String brokerIdsPath
           
 String brokerTopicsPath
          已过时。 
 String brokerTopicsPubPath
           
 String brokerTopicsSubPath
           
 String consumersPath
           
 String metaRoot
           
 
构造方法摘要
MetaZookeeper(org.I0Itec.zkclient.ZkClient zkClient, String root)
           
 
方法摘要
 String brokerIdsPathOf(int brokerId, int slaveId)
          brokerId 在zk上注册的path
 String brokerTopicsPathOf(String topic, boolean publish, int brokerId, int slaveId)
          Returns topic path in zk
 String brokerTopicsPathOf(String topic, int brokerId, int slaveId)
          已过时。 
 Set<Broker> getBrokersById(int brokerId)
          从zk查询一个id下的brokers,包含master和一个或多个slave
 Cluster getCluster()
          返回broker集群,包含slave和master
 Broker getMasterBrokerById(int brokerId)
          从zk查询master broker,不存在则返回null
 Map<Integer,String> getMasterBrokersByTopic(String topic)
          返回发布了指定的topic的所有master brokers
 Map<String,List<Partition>> getPartitionsForSubTopicsFromMaster(Collection<String> topics, int brokerId)
          返回一个master 下的topic到partition映射的map
 Map<String,List<Partition>> getPartitionsForTopicsFromMaster(Collection<String> topics)
          返回master的topic到partition映射的map
 Map<String,List<String>> getPartitionStringsForSubTopics(Collection<String> topics)
          返回topic到partition映射的map.
 Map<String,List<String>> getPartitionStringsForSubTopicsFromMaster(Collection<String> topics, int brokerId)
          返回一个master下的topic到partition映射的map
 Set<String> getTopicsByBrokerIdFromMaster(int brokerId)
          返回一个broker发布的所有topics
 org.I0Itec.zkclient.ZkClient getZkClient()
           
 String masterConfigChecksum(int brokerId)
          Master config file checksum path
 void setZkClient(org.I0Itec.zkclient.ZkClient zkClient)
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

metaRoot

public final String metaRoot

consumersPath

public final String consumersPath

brokerIdsPath

public final String brokerIdsPath

brokerTopicsPath

@Deprecated
public final String brokerTopicsPath
已过时。 

brokerTopicsPubPath

public final String brokerTopicsPubPath

brokerTopicsSubPath

public final String brokerTopicsSubPath
构造方法详细信息

MetaZookeeper

public MetaZookeeper(org.I0Itec.zkclient.ZkClient zkClient,
                     String root)
方法详细信息

getZkClient

public org.I0Itec.zkclient.ZkClient getZkClient()

setZkClient

public void setZkClient(org.I0Itec.zkclient.ZkClient zkClient)

getCluster

public Cluster getCluster()
返回broker集群,包含slave和master

参数:
zkClient -
返回:

getBrokersById

public Set<Broker> getBrokersById(int brokerId)
从zk查询一个id下的brokers,包含master和一个或多个slave


getMasterBrokerById

public Broker getMasterBrokerById(int brokerId)
从zk查询master broker,不存在则返回null


getMasterBrokersByTopic

public Map<Integer,String> getMasterBrokersByTopic(String topic)
返回发布了指定的topic的所有master brokers


getPartitionsForTopicsFromMaster

public Map<String,List<Partition>> getPartitionsForTopicsFromMaster(Collection<String> topics)
返回master的topic到partition映射的map

参数:
zkClient -
topics -
返回:

getTopicsByBrokerIdFromMaster

public Set<String> getTopicsByBrokerIdFromMaster(int brokerId)
返回一个broker发布的所有topics


getPartitionsForSubTopicsFromMaster

public Map<String,List<Partition>> getPartitionsForSubTopicsFromMaster(Collection<String> topics,
                                                                       int brokerId)
返回一个master 下的topic到partition映射的map

参数:
zkClient -
topics -
返回:

getPartitionStringsForSubTopicsFromMaster

public Map<String,List<String>> getPartitionStringsForSubTopicsFromMaster(Collection<String> topics,
                                                                          int brokerId)
返回一个master下的topic到partition映射的map

参数:
zkClient -
topics -
返回:

getPartitionStringsForSubTopics

public Map<String,List<String>> getPartitionStringsForSubTopics(Collection<String> topics)
返回topic到partition映射的map. 包括master和slave的所有partitions

参数:
zkClient -
topics -
返回:

brokerIdsPathOf

public String brokerIdsPathOf(int brokerId,
                              int slaveId)
brokerId 在zk上注册的path

参数:
brokerId -
slaveId - slave编号, 小于0表示master

masterConfigChecksum

public String masterConfigChecksum(int brokerId)
Master config file checksum path

参数:
brokerId -
返回:

brokerTopicsPathOf

@Deprecated
public String brokerTopicsPathOf(String topic,
                                            int brokerId,
                                            int slaveId)
已过时。 

topic 在zk上注册的path

参数:
topic -
brokerId -
slaveId - slave编号, 小于0表示master

brokerTopicsPathOf

public String brokerTopicsPathOf(String topic,
                                 boolean publish,
                                 int brokerId,
                                 int slaveId)
Returns topic path in zk

参数:
topic -
brokerId -
slaveId - slave编号, 小于0表示master
从以下版本开始:
1.4.3


Copyright © 2010–2013. All rights reserved.