Java Code Examples for org.elasticsearch.cluster.metadata.RepositoriesMetaData#repository()

The following examples show how to use org.elasticsearch.cluster.metadata.RepositoriesMetaData#repository() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositoryService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Nullable
public RepositoryMetaData getRepository(String repositoryName) {
    RepositoriesMetaData repositories = clusterService.state().metaData().custom(RepositoriesMetaData.TYPE);
    if (repositories != null) {
        return repositories.repository(repositoryName);
    }
    return null;
}
 
Example 2
Source File: SnapshotsService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
/**
 * Validates snapshot request
 *
 * @param request snapshot request
 * @param state   current cluster state
 */
private void validate(SnapshotRequest request, ClusterState state) {
    RepositoriesMetaData repositoriesMetaData = state.getMetaData().custom(RepositoriesMetaData.TYPE);
    if (repositoriesMetaData == null || repositoriesMetaData.repository(request.repository()) == null) {
        throw new RepositoryMissingException(request.repository());
    }
    validate(new SnapshotId(request.repository(), request.name()));
}
 
Example 3
Source File: SnapshotsService.java    From crate with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 4
Source File: RepositoryService.java    From crate with Apache License 2.0 5 votes vote down vote up
@Nullable
public RepositoryMetaData getRepository(String repositoryName) {
    RepositoriesMetaData repositories = clusterService.state().metaData().custom(RepositoriesMetaData.TYPE);
    if (repositories != null) {
        return repositories.repository(repositoryName);
    }
    return null;
}