Interface IServerSelectionProvider

All Known Implementing Classes:
SimpleServerSelectionProvider

public interface IServerSelectionProvider
Interface for persistent query and console server selection implementations. These provide customer-implemented server-selection algorithms. Implementations must have a constructor that takes:
  • log - a Logger that can be used for logging
  • serverGroupProvider - a IrisGroupProvider that can be used to determine allowed servers
  • Method Details

    • getServerGroups

      @NotNull Set<IServerSelectionProvider.ServerGroup> getServerGroups()
      List the available server groups. Each server group will be added to ths list of servers available for query server selection.
      Returns:
      the list of available server groups
    • determineServer

      @NotNull PersistentQueryDbServerConfig determineServer(@NotNull String serverGroupName, @NotNull io.deephaven.enterprise.auth.UserContext UserContext, int heapSizeMB, @NotNull String workerKind, String description, boolean isPersistentQuery) throws IServerSelectionProvider.ResourcesUnavailableException
      Determine the server (dispatcher) on which to request the worker.
      Parameters:
      serverGroupName - the user-chosen host or server group
      UserContext - the user context when available (internally-generated starts may not have a user context)
      heapSizeMB - the requested heap size in MB
      workerKind - the kind of worker that will be created
      description - a text description of the requested worker
      isPersistentQuery - true if the worker is for a persistent query, false otherwise
      Returns:
      a PersistentQueryDbServerConfig that represents the server (dispatcher) on which to request the worker
      Throws:
      IServerSelectionProvider.ResourcesUnavailableException - if a server can't be determined
    • updateServerTotalHeapMB

      void updateServerTotalHeapMB(@NotNull PersistentQueryDbServerConfig serverConfig, int totalHeapMB)
      Update the total heap available for a server. This will be determined by the controller after getting a connection to each dispatcher.
      Parameters:
      serverConfig - the server configuration
      totalHeapMB - the total available heap for the dispatcher
    • setServerUsage

      void setServerUsage(@NotNull PersistentQueryDbServerConfig serverConfig, int usageMB, int workerCount)
      Set the current server usage. This may be on an initial dispatcher connection or after a reconnection, or whenever the utilization changes.
      Parameters:
      serverConfig - the server configuration
      usageMB - the usage in MB
      workerCount - the current number of workers running on that server
    • updateServerAvailability

      void updateServerAvailability(@NotNull PersistentQueryDbServerConfig serverConfig, boolean available)
      Update whether a server is available or not.
      Parameters:
      serverConfig - the server configuration
      available - if true, the server is available; if false, it is not
    • updateServerMaxHeapGB

      void updateServerMaxHeapGB(PersistentQueryDbServerConfig serverConfig, double maxHeapSizeGB)
      Update the max per-worker heap size in GB for a server based on the dispatcher's actual configuration.
      Parameters:
      serverConfig - the server configuration
      maxHeapSizeGB - the new maximum size
    • updateServerInfo

      void updateServerInfo(PersistentQueryDbServerConfig serverConfig, String json)
      Update the server info JSON for a server based on the dispatcher's actual configuration.
      Parameters:
      serverConfig - the server configuration
      json - the server's JSON server info configuration
    • generateReloadableConfigurationElement

      void generateReloadableConfigurationElement(org.jdom2.Element baseElement, com.fishlib.configuration.Configuration config)
      Generate an Element with this server selection provider's configuration. This element will be used to load the configuration indirectly. This element may be generated in a different process than the controller.
      Parameters:
      baseElement - the Element
      config - the Configuration to be used to generate the Element
    • verifyConfiguration

      void verifyConfiguration(@NotNull org.jdom2.Element element, List<PersistentQueryDbServerConfig> serverConfigs) throws ConfigurationVerificationException
      Given the Element generated by generateReloadableConfigurationElement(org.jdom2.Element, com.fishlib.configuration.Configuration), validate and prepare the configuration for use.
      Parameters:
      element - the generated Element containing the configuration
      serverConfigs - the available dispatchers as determined by the controller
      Throws:
      ConfigurationVerificationException - if the provided element can't be used for any reason
    • installConfiguration

      void installConfiguration()
      Install the verified configuration. This will be called after verifyConfiguration(org.jdom2.Element, java.util.List<com.illumon.iris.controller.PersistentQueryDbServerConfig>) is successfully called and indicates that the verified configuration should now be used.