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);
}
}
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);
}
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())));
}
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())));
}
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);
}
Aggregations