Class DataSourceService

java.lang.Object
org.elasticsearch.xpack.esql.datasources.datasource.DataSourceService

public class DataSourceService extends Object
Orchestrates create / replace / delete of data sources in cluster state.
  • Field Details

    • MAX_DATA_SOURCES_COUNT_SETTING

      public static final Setting<Integer> MAX_DATA_SOURCES_COUNT_SETTING
    • clusterService

      protected final ClusterService clusterService
  • Constructor Details

  • Method Details

    • getMetadata

      protected DataSourceMetadata getMetadata(ProjectMetadata projectMetadata)
    • validatePutDataSource

      public DataSource validatePutDataSource(ProjectMetadata project, PutDataSourceAction.Request request)
      Validate the put-data-source request and build the domain DataSource.
    • putDataSource

      public void putDataSource(ProjectId projectId, PutDataSourceAction.Request request, ActionListener<AcknowledgedResponse> listener)
      Create or replace a data source. A newly-supplied secret is encrypted master-side (applyEncryption(java.lang.String, org.elasticsearch.xpack.esql.datasources.metadata.DataSourceSettings)) off the CAS task thread, since that's expensive and would otherwise block the master on every concurrent PUT. A secret omitted from the request is instead carried forward from the current entry inside the CAS task (via mergeCarriedForwardSecrets(org.elasticsearch.xpack.esql.datasources.metadata.DataSource, java.lang.String, org.elasticsearch.xpack.esql.datasources.metadata.DataSourceSettings, org.elasticsearch.xpack.esql.datasources.datasource.PutDataSourceAction.Request)), where current is read fresh against authoritative state and carrying the secret forward needs no encryption. The task also re-validates against that same fresh state, so a concurrent change to a secret this request relies on carrying forward fails the PUT instead of silently persisting an incomplete data source. Every other field is a full replace, matching the pre-existing PUT semantics.
    • deleteDataSources

      public void deleteDataSources(ProjectId projectId, TimeValue masterNodeTimeout, TimeValue ackTimeout, Collection<String> names, ActionListener<AcknowledgedResponse> listener)
      Delete data sources by name. Fails with 409 if any dataset references one; 404 if a name doesn't exist.