Class CLDBRpcCommonUtils

java.lang.Object
com.mapr.baseutils.cldbutils.CLDBRpcCommonUtils

public class CLDBRpcCommonUtils extends Object
  • Field Details

  • Method Details

    • isIpv6Supported

      public Boolean isIpv6Supported()
    • getLocalHost

      public String getLocalHost()
    • getInstance

      public static CLDBRpcCommonUtils getInstance()
    • setPartOfServer

      public void setPartOfServer(boolean partOfServer)
    • getZkConnect

      public String getZkConnect() throws Exception
      Throws:
      Exception
    • getZkConnect

      public String getZkConnect(String clusterName) throws Exception
      Throws:
      Exception
    • initInstanceForCldb

      public void initInstanceForCldb()
    • fetchClusterGroupConfs

      public static List<com.mapr.fs.cldb.proto.CLDBProto.ClusterGroupConf> fetchClusterGroupConfs()
    • addIpAddrFromIPPorts

      public void addIpAddrFromIPPorts(List<com.mapr.fs.proto.Common.IPPort> ipPorts, List<CLDBRpcCommonUtils.IpAddr> ipAddrs)
    • getIpPortsFromCGConf

      public List<CLDBRpcCommonUtils.IpPort> getIpPortsFromCGConf(com.mapr.fs.cldb.proto.CLDBProto.ClusterGroupConf conf)
    • lookupInClusterMaps

      public List<CLDBRpcCommonUtils.IpPort> lookupInClusterMaps(String clusterName)
    • sendRequest

      public byte[] sendRequest(int programId, int procedureId, com.google.protobuf.MessageLite request, Class<? extends com.google.protobuf.MessageLite> responseClass) throws Exception
      Main entrance point to send RPC Request to CLDB for default cluster
      Parameters:
      binding -
      programId -
      procedureId -
      request -
      responseClass -
      Returns:
      Throws:
      Exception
    • sendRequest

      public byte[] sendRequest(int programId, int procedureId, com.google.protobuf.MessageLite request, Class<? extends com.google.protobuf.MessageLite> responseClass, int cldbPort) throws Exception
      Throws:
      Exception
    • sendRequest

      public byte[] sendRequest(String clusterName, int programId, int procedureId, com.google.protobuf.MessageLite request, Class<? extends com.google.protobuf.MessageLite> responseClass) throws Exception
      Main entrance point to send RPC Request to CLDB for a cluster
      Parameters:
      clusterName -
      programId -
      procedureId -
      request -
      responseClass -
      Returns:
      Throws:
      Exception
    • sendRequest

      public byte[] sendRequest(String clusterName, int programId, int procedureId, com.google.protobuf.MessageLite request, Class<? extends com.google.protobuf.MessageLite> responseClass, com.mapr.fs.proto.Security.ServerKeyType keyType) throws Exception
      Full method (so far) to take into consideration ServerKeyType
      Parameters:
      clusterName -
      programId -
      procedureId -
      request -
      responseClass -
      keyType -
      Returns:
      Throws:
      Exception
    • sendRequest

      public byte[] sendRequest(String clusterName, int programId, int procedureId, com.google.protobuf.MessageLite request, Class<? extends com.google.protobuf.MessageLite> responseClass, com.mapr.fs.proto.Security.ServerKeyType keyType, int srcPort) throws Exception
      Throws:
      Exception
    • sendRequest

      public byte[] sendRequest(String clusterName, int programId, int procedureId, com.google.protobuf.MessageLite request, Class<? extends com.google.protobuf.MessageLite> responseClass, com.mapr.fs.proto.Security.ServerKeyType keyType, int srcPort, int cldbPort) throws Exception
      Throws:
      Exception
    • isValidClusterName

      public boolean isValidClusterName(String clusterName)
      Method to validate a given cluster name
      Parameters:
      clusterName -
      Returns:
    • getPathToClustersConfFile

      public String getPathToClustersConfFile()
    • getPathToServerTicketFile

      public String getPathToServerTicketFile()
    • getCurrentValidIpPort

      public CLDBRpcCommonUtils.IpPort getCurrentValidIpPort(String clusterName)
      Get current valid IpPOrt for a particular cluster
      Parameters:
      clusterName -
      Returns:
    • getCurrentValidIpPort

      public CLDBRpcCommonUtils.IpPort getCurrentValidIpPort()
      Get current validIPPort for Default cluster
      Returns:
    • getCurrentClusterName

      public String getCurrentClusterName()
    • getCurrentClusterGroupName

      public String getCurrentClusterGroupName()
    • getClusterGroupConfs

      public List<com.mapr.fs.cldb.proto.CLDBProto.ClusterGroupConf> getClusterGroupConfs()
    • addClusterGroupConf

      public com.mapr.fs.cldb.proto.CLDBProto.ClusterGroupConf addClusterGroupConf(com.mapr.fs.cldb.proto.CLDBProto.ClusterGroupConf cgConf)
    • clearClusterGroupMap

      public void clearClusterGroupMap()
    • removeClusterGroupConf

      public com.mapr.fs.cldb.proto.CLDBProto.ClusterGroupConf removeClusterGroupConf(String clustername)
    • getClusterGroupConf

      public com.mapr.fs.cldb.proto.CLDBProto.ClusterGroupConf getClusterGroupConf(String clusterName)
    • getPrimaryClusterName

      public String getPrimaryClusterName()
    • getEnableS3GNS

      public boolean getEnableS3GNS()
    • getClusterGroupSize

      public int getClusterGroupSize()
    • isExternalServerMember

      public boolean isExternalServerMember(String extName)
    • isGnsMember

      public boolean isGnsMember(String extServerName)
    • getExternalServers

      public List<com.mapr.fs.cldb.proto.CLDBProto.ExternalServer> getExternalServers()
    • getExternalServerNames

      public ArrayList<String> getExternalServerNames()
    • getExternalServer

      public com.mapr.fs.cldb.proto.CLDBProto.ExternalServer getExternalServer(String extServerName)
    • isS3ExternalServer

      public boolean isS3ExternalServer(String extName)
    • isNFSExternalServer

      public boolean isNFSExternalServer(String extName)
    • addExternalServer

      public com.mapr.fs.cldb.proto.CLDBProto.ExternalServer addExternalServer(com.mapr.fs.cldb.proto.CLDBProto.ExternalServer extServer)
    • removeExternalServer

      public com.mapr.fs.cldb.proto.CLDBProto.ExternalServer removeExternalServer(String extServerName)
    • updateExternalNFSExports

      public boolean updateExternalNFSExports(com.mapr.fs.cldb.proto.CLDBProto.ExternalNfsServer server)
    • setCurrentClusterName

      public void setCurrentClusterName(String clusterName)
    • resetCurrentClusterName

      public void resetCurrentClusterName()
    • getClusterMap

      public Map<String,List<CLDBRpcCommonUtils.IpPort>> getClusterMap()
    • reloadClusterMap

      public void reloadClusterMap(String clusterName)
    • getOriginalClusterMap

      public Map<String,List<CLDBRpcCommonUtils.IpPort>> getOriginalClusterMap()
    • getHostMap

      public Map<String,String> getHostMap()
    • getDefaultClusterIpPort

      public List<CLDBRpcCommonUtils.IpPort> getDefaultClusterIpPort()
    • getDefaultClusterName

      public String getDefaultClusterName()
    • getCldbBindings

      public long[] getCldbBindings(String clusterName) throws CLDBRpcCommonUtilsException
      Gets bindings for all the ips present in the clusterMap
      Returns:
      Array of cldb bindings.
      Throws:
      CLDBRpcCommonUtilsException
    • getIPTypeForCluster

      public com.mapr.fs.proto.Common.IPType getIPTypeForCluster(String clusterName)
    • getIPTypeForCluster

      public com.mapr.fs.proto.Common.IPType getIPTypeForCluster(String clusterName, int srcPort)
    • getFlagsForBinding

      public int getFlagsForBinding(String clusterName, boolean isConnectionToMfs)