Search in sources :

Example 6 with RepositoriesMetaData

use of org.elasticsearch.cluster.metadata.RepositoriesMetaData in project crate by crate.

the class SysRepositoriesService method clusterChanged.

@Override
public void clusterChanged(ClusterChangedEvent event) {
    if (repositoriesChanged(event)) {
        RepositoriesMetaData repositoriesMetaData = event.state().metaData().custom(RepositoriesMetaData.TYPE);
        repositoriesTable = new HashMap<>(repositoriesMetaData.repositories().size());
        addRepositories(repositoriesMetaData);
    }
}
Also used : RepositoriesMetaData(org.elasticsearch.cluster.metadata.RepositoriesMetaData)

Example 7 with RepositoriesMetaData

use of org.elasticsearch.cluster.metadata.RepositoriesMetaData in project crate by crate.

the class SysRepositoriesService method doStart.

@Override
protected void doStart() {
    // access ClusterService here to avoid guice proxy errors if the ClusterService could not be build
    RepositoriesMetaData repositoriesMetaData = clusterService.state().metaData().custom(RepositoriesMetaData.TYPE);
    addRepositories(repositoriesMetaData);
    clusterService.add(this);
}
Also used : RepositoriesMetaData(org.elasticsearch.cluster.metadata.RepositoriesMetaData)

Example 8 with RepositoriesMetaData

use of org.elasticsearch.cluster.metadata.RepositoriesMetaData in project crate by crate.

the class S3RepositoryPluginAnalyzerTest method prepare.

@Before
public void prepare() {
    RepositoriesMetadata repositoriesMetadata = new RepositoriesMetadata(Collections.singletonList(new RepositoryMetadata("my_repo", "fs", Settings.builder().put("location", "/tmp/my_repo").build())));
    ClusterState clusterState = ClusterState.builder(new ClusterName("testing")).metadata(Metadata.builder().putCustom(RepositoriesMetadata.TYPE, repositoriesMetadata)).build();
    ClusterServiceUtils.setState(clusterService, clusterState);
    e = SQLExecutor.builder(clusterService).build();
    plannerContext = e.getPlannerContext(clusterService.state());
    repositoryParamValidator = new RepositoryParamValidator(Map.of("s3", new TypeSettings(List.of(), S3Repository.optionalSettings())));
}
Also used : RepositoryParamValidator(io.crate.analyze.repositories.RepositoryParamValidator) RepositoriesMetadata(org.elasticsearch.cluster.metadata.RepositoriesMetadata) ClusterState(org.elasticsearch.cluster.ClusterState) RepositoryMetadata(org.elasticsearch.cluster.metadata.RepositoryMetadata) ClusterName(org.elasticsearch.cluster.ClusterName) TypeSettings(io.crate.analyze.repositories.TypeSettings) Before(org.junit.Before)

Example 9 with RepositoriesMetaData

use of org.elasticsearch.cluster.metadata.RepositoriesMetaData in project crate by crate.

the class AzureRepositoryAnalyzerTest method prepare.

@Before
public void prepare() {
    RepositoriesMetadata repositoriesMetadata = new RepositoriesMetadata(Collections.singletonList(new RepositoryMetadata("my_repo", "fs", Settings.builder().put("location", "/tmp/my_repo").build())));
    ClusterState clusterState = ClusterState.builder(new ClusterName("testing")).metadata(Metadata.builder().putCustom(RepositoriesMetadata.TYPE, repositoriesMetadata)).build();
    ClusterServiceUtils.setState(clusterService, clusterState);
    e = SQLExecutor.builder(clusterService).build();
    plannerContext = e.getPlannerContext(clusterService.state());
    repositoryParamValidator = new RepositoryParamValidator(Map.of("azure", new TypeSettings(AzureRepository.mandatorySettings(), AzureRepository.optionalSettings())));
}
Also used : RepositoryParamValidator(io.crate.analyze.repositories.RepositoryParamValidator) RepositoriesMetadata(org.elasticsearch.cluster.metadata.RepositoriesMetadata) ClusterState(org.elasticsearch.cluster.ClusterState) RepositoryMetadata(org.elasticsearch.cluster.metadata.RepositoryMetadata) ClusterName(org.elasticsearch.cluster.ClusterName) TypeSettings(io.crate.analyze.repositories.TypeSettings) Before(org.junit.Before)

Example 10 with RepositoriesMetaData

use of org.elasticsearch.cluster.metadata.RepositoriesMetaData in project crate by crate.

the class SnapshotsService method validate.

/**
 * Validates snapshot request
 *
 * @param repositoryName repository name
 * @param snapshotName snapshot name
 * @param state   current cluster state
 */
private static void validate(String repositoryName, String snapshotName, ClusterState state) {
    RepositoriesMetadata repositoriesMetadata = state.getMetadata().custom(RepositoriesMetadata.TYPE);
    if (repositoriesMetadata == null || repositoriesMetadata.repository(repositoryName) == null) {
        throw new RepositoryMissingException(repositoryName);
    }
    validate(repositoryName, snapshotName);
}
Also used : RepositoriesMetadata(org.elasticsearch.cluster.metadata.RepositoriesMetadata) RepositoryMissingException(org.elasticsearch.repositories.RepositoryMissingException)

Aggregations

RepositoriesMetadata (org.elasticsearch.cluster.metadata.RepositoriesMetadata)15 ClusterState (org.elasticsearch.cluster.ClusterState)14 RepositoriesMetaData (org.elasticsearch.cluster.metadata.RepositoriesMetaData)14 RepositoryMetadata (org.elasticsearch.cluster.metadata.RepositoryMetadata)13 ArrayList (java.util.ArrayList)10 RepositoryMetaData (org.elasticsearch.cluster.metadata.RepositoryMetaData)10 ClusterName (org.elasticsearch.cluster.ClusterName)8 Before (org.junit.Before)7 IOException (java.io.IOException)5 ParameterizedMessage (org.apache.logging.log4j.message.ParameterizedMessage)5 Map (java.util.Map)4 ActionListener (org.elasticsearch.action.ActionListener)4 RepositoryParamValidator (io.crate.analyze.repositories.RepositoryParamValidator)3 TypeSettings (io.crate.analyze.repositories.TypeSettings)3 HashMap (java.util.HashMap)3 DeleteRepositoryRequest (org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest)3 PutRepositoryRequest (org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest)3 RepositoryException (org.elasticsearch.repositories.RepositoryException)3 Path (java.nio.file.Path)2 List (java.util.List)2