Class ZkConfigManager


  • public class ZkConfigManager
    extends Object
    Class that manages named configs in Zookeeper
    • Field Detail

      • UPLOAD_FILENAME_EXCLUDE_PATTERN

        public static final Pattern UPLOAD_FILENAME_EXCLUDE_PATTERN
    • Constructor Detail

      • ZkConfigManager

        public ZkConfigManager​(SolrZkClient zkClient)
        Creates a new ZkConfigManager
        Parameters:
        zkClient - the SolrZkClient to use
    • Method Detail

      • uploadConfigDir

        public void uploadConfigDir​(Path dir,
                                    String configName)
                             throws IOException
        Upload files from a given path to a config in Zookeeper
        Parameters:
        dir - Path to the files
        configName - the name to give the config
        Throws:
        IOException - if an I/O error occurs or the path does not exist
      • uploadConfigDir

        public void uploadConfigDir​(Path dir,
                                    String configName,
                                    Pattern filenameExclusions)
                             throws IOException
        Upload matching files from a given path to a config in Zookeeper
        Parameters:
        dir - Path to the files
        configName - the name to give the config
        filenameExclusions - files matching this pattern will not be uploaded
        Throws:
        IOException - if an I/O error occurs or the path does not exist
      • downloadConfigDir

        public void downloadConfigDir​(String configName,
                                      Path dir)
                               throws IOException
        Download a config from Zookeeper and write it to the filesystem
        Parameters:
        configName - the config to download
        dir - the Path to write files under
        Throws:
        IOException - if an I/O error occurs or the config does not exist
      • configExists

        public Boolean configExists​(String configName)
                             throws IOException
        Check whether a config exists in Zookeeper
        Parameters:
        configName - the config to check existance on
        Returns:
        whether the config exists or not
        Throws:
        IOException - if an I/O error occurs
      • deleteConfigDir

        public void deleteConfigDir​(String configName)
                             throws IOException
        Delete a config in ZooKeeper
        Parameters:
        configName - the config to delete
        Throws:
        IOException - if an I/O error occurs
      • copyConfigDir

        public void copyConfigDir​(String fromConfig,
                                  String toConfig)
                           throws IOException
        Copy a config in ZooKeeper
        Parameters:
        fromConfig - the config to copy from
        toConfig - the config to copy to
        Throws:
        IOException - if an I/O error occurs
      • copyConfigDir

        public void copyConfigDir​(String fromConfig,
                                  String toConfig,
                                  Set<String> copiedToZkPaths)
                           throws IOException
        Copy a config in ZooKeeper
        Parameters:
        fromConfig - the config to copy from
        toConfig - the config to copy to
        copiedToZkPaths - should be an empty Set, will be filled in by function with the paths that were actually copied to.
        Throws:
        IOException - if an I/O error occurs