Package org.elasticsearch.cluster.metadata

Examples of org.elasticsearch.cluster.metadata.SnapshotId


        public void readFrom(StreamInput in) throws IOException {
            super.readFrom(in);
            int numberOfSnapshots = in.readVInt();
            ImmutableMap.Builder<SnapshotId, ImmutableMap<ShardId, SnapshotIndexShardStatus>> snapshotMapBuilder = ImmutableMap.builder();
            for (int i = 0; i < numberOfSnapshots; i++) {
                SnapshotId snapshotId = SnapshotId.readSnapshotId(in);
                ImmutableMap.Builder<ShardId, SnapshotIndexShardStatus> shardMapBuilder = ImmutableMap.builder();
                int numberOfShards = in.readVInt();
                for (int j = 0; j < numberOfShards; j++) {
                    ShardId shardId =  ShardId.readShardId(in);
                    SnapshotIndexShardStatus status = SnapshotIndexShardStatus.readShardSnapshotStatus(in);
View Full Code Here


        snapshotsService.createSnapshot(snapshotRequest, new SnapshotsService.CreateSnapshotListener() {
            @Override
            public void onResponse() {
                if (request.waitForCompletion()) {
                    snapshotsService.addListener(new SnapshotsService.SnapshotCompletionListener() {
                        SnapshotId snapshotId = new SnapshotId(request.repository(), request.snapshot());

                        @Override
                        public void onSnapshotCompletion(SnapshotId snapshotId, SnapshotInfo snapshot) {
                            if (this.snapshotId.equals(snapshotId)) {
                                listener.onResponse(new CreateSnapshotResponse(snapshot));
View Full Code Here

    @Override
    protected void masterOperation(final GetSnapshotsRequest request, ClusterState state, final ActionListener<GetSnapshotsResponse> listener) throws ElasticsearchException {
        SnapshotId[] snapshotIds = new SnapshotId[request.snapshots().length];
        for (int i = 0; i < snapshotIds.length; i++) {
            snapshotIds[i] = new SnapshotId(request.repository(), request.snapshots()[i]);
        }

        try {
            ImmutableList.Builder<SnapshotInfo> snapshotInfoBuilder = ImmutableList.builder();
            if (snapshotIds.length > 0) {
View Full Code Here

        }
        // Now add snapshots on disk that are not currently running
        if (Strings.hasText(request.repository())) {
            if (request.snapshots() != null && request.snapshots().length > 0) {
                for (String snapshotName : request.snapshots()) {
                    SnapshotId snapshotId = new SnapshotId(request.repository(), snapshotName);
                    if (currentSnapshotIds.contains(snapshotId)) {
                        // This is a snapshot the is currently running - skipping
                        continue;
                    }
                    Snapshot snapshot = snapshotsService.snapshot(snapshotId);
View Full Code Here

        return state.blocks().indexBlockedException(ClusterBlockLevel.METADATA, "");
    }

    @Override
    protected void masterOperation(final DeleteSnapshotRequest request, ClusterState state, final ActionListener<DeleteSnapshotResponse> listener) throws ElasticsearchException {
        SnapshotId snapshotIds = new SnapshotId(request.repository(), request.snapshot());
        snapshotsService.deleteSnapshot(snapshotIds, new SnapshotsService.DeleteSnapshotListener() {
            @Override
            public void onResponse() {
                listener.onResponse(new DeleteSnapshotResponse(true));
            }
View Full Code Here

            @Override
            public void onResponse(RestoreInfo restoreInfo) {
                if (restoreInfo == null) {
                    if (request.waitForCompletion()) {
                        restoreService.addListener(new RestoreService.RestoreCompletionListener() {
                            SnapshotId snapshotId = new SnapshotId(request.repository(), request.snapshot());

                            @Override
                            public void onRestoreCompletion(SnapshotId snapshotId, RestoreInfo snapshot) {
                                if (this.snapshotId.equals(snapshotId)) {
                                    listener.onResponse(new RestoreSnapshotResponse(snapshot));
View Full Code Here

                return readSnapshotList();
            }
            int prefixLength = SNAPSHOT_PREFIX.length();
            for (BlobMetaData md : blobs.values()) {
                String name = md.name().substring(prefixLength);
                snapshots.add(new SnapshotId(repositoryName, name));
            }
            return ImmutableList.copyOf(snapshots);
        } catch (IOException ex) {
            throw new RepositoryException(repositoryName, "failed to list snapshots in repository", ex);
        }
View Full Code Here

                    if (parser.nextToken() == XContentParser.Token.FIELD_NAME) {
                        String currentFieldName = parser.currentName();
                        if ("snapshots".equals(currentFieldName)) {
                            if (parser.nextToken() == XContentParser.Token.START_ARRAY) {
                                while (parser.nextToken() != XContentParser.Token.END_ARRAY) {
                                    snapshots.add(new SnapshotId(repositoryName, parser.text()));
                                }
                            }
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of org.elasticsearch.cluster.metadata.SnapshotId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.