Java Code Examples for org.elasticsearch.index.shard.ShardId#readShardId()

The following examples show how to use org.elasticsearch.index.shard.ShardId#readShardId() . These examples are extracted from open source projects. 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
@Override
public SnapshotsInProgress readFrom(StreamInput in) throws IOException {
    Entry[] entries = new Entry[in.readVInt()];
    for (int i = 0; i < entries.length; i++) {
        SnapshotId snapshotId = SnapshotId.readSnapshotId(in);
        boolean includeGlobalState = in.readBoolean();
        State state = State.fromValue(in.readByte());
        int indices = in.readVInt();
        List<String> indexBuilder = new ArrayList<>();
        for (int j = 0; j < indices; j++) {
            indexBuilder.add(in.readString());
        }
        long startTime = in.readLong();
        ImmutableMap.Builder<ShardId, ShardSnapshotStatus> builder = ImmutableMap.builder();
        int shards = in.readVInt();
        for (int j = 0; j < shards; j++) {
            ShardId shardId = ShardId.readShardId(in);
            String nodeId = in.readOptionalString();
            State shardState = State.fromValue(in.readByte());
            builder.put(shardId, new ShardSnapshotStatus(nodeId, shardState));
        }
        entries[i] = new Entry(snapshotId, includeGlobalState, state, Collections.unmodifiableList(indexBuilder), startTime, builder.build());
    }
    return new SnapshotsInProgress(entries);
}
 
Example 2
Source Project: Elasticsearch   File: RestoreInProgress.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public RestoreInProgress readFrom(StreamInput in) throws IOException {
    Entry[] entries = new Entry[in.readVInt()];
    for (int i = 0; i < entries.length; i++) {
        SnapshotId snapshotId = SnapshotId.readSnapshotId(in);
        State state = State.fromValue(in.readByte());
        int indices = in.readVInt();
        List<String> indexBuilder = new ArrayList<>();
        for (int j = 0; j < indices; j++) {
            indexBuilder.add(in.readString());
        }
        ImmutableMap.Builder<ShardId, ShardRestoreStatus> builder = ImmutableMap.<ShardId, ShardRestoreStatus>builder();
        int shards = in.readVInt();
        for (int j = 0; j < shards; j++) {
            ShardId shardId = ShardId.readShardId(in);
            ShardRestoreStatus shardState = ShardRestoreStatus.readShardRestoreStatus(in);
            builder.put(shardId, shardState);
        }
        entries[i] = new Entry(snapshotId, state, Collections.unmodifiableList(indexBuilder), builder.build());
    }
    return new RestoreInProgress(entries);
}
 
Example 3
@Override
public void readFrom(StreamInput in) throws IOException {
    int size = in.readVInt();
    for (int i = 0; i < size; i++) {
        ShardId shardId = ShardId.readShardId(in);
        int size2 = in.readVInt();
        List<NodeExplanation> ne = new ArrayList<>(size2);
        for (int j = 0; j < size2; j++) {
            DiscoveryNode node = null;
            if (in.readBoolean()) {
                node = DiscoveryNode.readNode(in);
            }
            ne.add(new NodeExplanation(node, in.readString()));
        }
        explanations.put(shardId, ne);
    }
}
 
Example 4
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    recoveryId = in.readLong();
    shardId = ShardId.readShardId(in);
    currentOffset = in.readLong();
}
 
Example 5
@Override
public void readFrom(StreamInput in) throws IOException {
    failureReason = in.readOptionalString();
    int numResponses = in.readInt();
    shardResponses = new HashMap<>();
    for (int i = 0; i < numResponses; i++) {
        ShardRouting shardRouting = ShardRouting.readShardRoutingEntry(in);
        SyncedFlushService.ShardSyncedFlushResponse response = SyncedFlushService.ShardSyncedFlushResponse.readSyncedFlushResponse(in);
        shardResponses.put(shardRouting, response);
    }
    syncId = in.readOptionalString();
    shardId = ShardId.readShardId(in);
    totalShards = in.readInt();
}
 
Example 6
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    index = in.readString();
    timeout = TimeValue.readTimeValue(in);
    ingestId = in.readLong();
    shardId = ShardId.readShardId(in);
    int size = in.readVInt();
    actionRequests = new LinkedList<>();
    for (int i = 0; i < size; i++) {
        boolean exists = in.readBoolean();
        if (exists) {
            boolean b = in.readBoolean();
            if (b) {
                IndexRequest indexRequest = new IndexRequest();
                indexRequest.readFrom(in);
                actionRequests.add(indexRequest);
            } else {
                DeleteRequest deleteRequest = new DeleteRequest();
                deleteRequest.readFrom(in);
                actionRequests.add(deleteRequest);
            }
        } else {
            actionRequests.add(null);
        }
    }
}
 
Example 7
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    recoveryId = in.readLong();
    shardId = ShardId.readShardId(in);
    operations = Translog.readOperations(in);
    totalTranslogOps = in.readVInt();
}
 
Example 8
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    if (in.readBoolean()) {
        internalShardId = ShardId.readShardId(in);
    }
    index = in.readOptionalString();
    // no need to pass threading over the network, they are always false when coming throw a thread pool
}
 
Example 9
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    recoveryId = in.readLong();
    shardId = ShardId.readShardId(in);
    sourceNode = DiscoveryNode.readNode(in);
    targetNode = DiscoveryNode.readNode(in);
    markAsRelocated = in.readBoolean();
    metadataSnapshot = new Store.MetadataSnapshot(in);
    recoveryType = RecoveryState.Type.fromId(in.readByte());

}
 
Example 10
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    recoveryId = in.readLong();
    shardId = ShardId.readShardId(in);
    snapshotFiles = new Store.MetadataSnapshot(in);
    totalTranslogOps = in.readVInt();
}
 
Example 11
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    snapshotId = SnapshotId.readSnapshotId(in);
    shardId = ShardId.readShardId(in);
    status = SnapshotsInProgress.ShardSnapshotStatus.readShardSnapshotStatus(in);
}
 
Example 12
Source Project: Elasticsearch   File: IndicesStore.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    clusterName = ClusterName.readClusterName(in);
    indexUUID = in.readString();
    shardId = ShardId.readShardId(in);
    timeout = new TimeValue(in.readLong(), TimeUnit.MILLISECONDS);
}
 
Example 13
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    tookInMillis = in.readLong();
    ingestId = in.readLong();
    if (in.readBoolean()) {
        shardId = ShardId.readShardId(in);
    }
    successCount = in.readVInt();
    quorumShards = in.readVInt();
    actionRequests = new LinkedList<>();
    int size = in.readVInt();
    for (int i = 0; i < size; i++) {
        boolean exists = in.readBoolean();
        if (exists) {
            boolean b = in.readBoolean();
            if (b) {
                IndexRequest indexRequest = new IndexRequest();
                indexRequest.readFrom(in);
                actionRequests.add(indexRequest);
            } else {
                DeleteRequest deleteRequest = new DeleteRequest();
                deleteRequest.readFrom(in);
                actionRequests.add(deleteRequest);
            }
        } else {
            actionRequests.add(null);
        }
    }
    failures = new LinkedList<>();
    size = in.readVInt();
    for (int i = 0; i < size; i++) {
        failures.add(IngestActionFailure.from(in));
    }
}
 
Example 14
@Override
public MoveAllocationCommand readFrom(StreamInput in) throws IOException {
    return new MoveAllocationCommand(ShardId.readShardId(in), in.readString(), in.readString());
}
 
Example 15
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    shardId = ShardId.readShardId(in);
}
 
Example 16
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    this.shardId = ShardId.readShardId(in);
}
 
Example 17
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    shardId = ShardId.readShardId(in);
}
 
Example 18
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    shardId = ShardId.readShardId(in);
    originalIndices = OriginalIndices.readOriginalIndices(in);
}
 
Example 19
@Override
public void readFrom(StreamInput in) throws IOException {
    allocated = in.readBoolean();
    shardId = ShardId.readShardId(in);
    this.metadataSnapshot = new Store.MetadataSnapshot(in);
}
 
Example 20
@Override
public CancelAllocationCommand readFrom(StreamInput in) throws IOException {
    return new CancelAllocationCommand(ShardId.readShardId(in), in.readString(), in.readBoolean());
}