Class FileDistributor


  • public class FileDistributor
    extends java.lang.Object
    Sends RPC requests to hosts (tenant hosts and config servers) to start download of files. This is used during prepare of an application. Services themselves will also request files, the work done in this class is done so that hosts can start downloading files before services gets new config that needs these files. This also tries to make sure that all config servers (not just the one where the application was deployed) have the files available.
    Author:
    Tony Vaagenes
    • Constructor Summary

      Constructors 
      Constructor Description
      FileDistributor​(com.yahoo.config.application.api.FileRegistry fileRegistry, java.util.List<com.yahoo.config.model.api.ConfigServerSpec> configServerSpecs, boolean isHosted)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Set<com.yahoo.config.FileReference> allFilesToSend()  
      java.lang.String fileSourceHost()
      Returns the host which is the source of the files
      java.util.Set<com.yahoo.config.FileReference> filesToSendToHost​(Host host)
      Returns the files which has been marked for distribution to the given host
      java.util.Set<Host> getTargetHosts()  
      void sendDeployedFiles​(com.yahoo.config.model.api.FileDistribution dbHandler)  
      com.yahoo.config.FileReference sendFileToHost​(java.lang.String relativePath, Host host)
      Adds the given file to the associated application packages' registry of file and marks the file for distribution to the given host.
      com.yahoo.config.FileReference sendUriToHost​(java.lang.String uri, Host host)
      Adds the given file to the associated application packages' registry of file and marks the file for distribution to the given host.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileDistributor

        public FileDistributor​(com.yahoo.config.application.api.FileRegistry fileRegistry,
                               java.util.List<com.yahoo.config.model.api.ConfigServerSpec> configServerSpecs,
                               boolean isHosted)
    • Method Detail

      • sendFileToHost

        public com.yahoo.config.FileReference sendFileToHost​(java.lang.String relativePath,
                                                             Host host)
        Adds the given file to the associated application packages' registry of file and marks the file for distribution to the given host. Note: This class receives ownership of the given collection.
        Returns:
        the reference to the file, created by the application package
      • sendUriToHost

        public com.yahoo.config.FileReference sendUriToHost​(java.lang.String uri,
                                                            Host host)
        Adds the given file to the associated application packages' registry of file and marks the file for distribution to the given host. Note: This class receives ownership of the given collection.
        Returns:
        the reference to the file, created by the application package
      • filesToSendToHost

        public java.util.Set<com.yahoo.config.FileReference> filesToSendToHost​(Host host)
        Returns the files which has been marked for distribution to the given host
      • getTargetHosts

        public java.util.Set<Host> getTargetHosts()
      • fileSourceHost

        public java.lang.String fileSourceHost()
        Returns the host which is the source of the files
      • allFilesToSend

        public java.util.Set<com.yahoo.config.FileReference> allFilesToSend()
      • sendDeployedFiles

        public void sendDeployedFiles​(com.yahoo.config.model.api.FileDistribution dbHandler)