Java Code Examples for org.elasticsearch.common.io.stream.StreamInput#readVInt()

The following examples show how to use org.elasticsearch.common.io.stream.StreamInput#readVInt() . 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: JoinPhase.java    From crate with Apache License 2.0 6 votes vote down vote up
JoinPhase(StreamInput in) throws IOException {
    super(in);
    distributionInfo = new DistributionInfo(in);

    int numExecutionNodes = in.readVInt();
    if (numExecutionNodes > 0) {
        executionNodes = new HashSet<>(numExecutionNodes);
        for (int i = 0; i < numExecutionNodes; i++) {
            executionNodes.add(in.readString());
        }
    } else {
        executionNodes = null;
    }

    leftMergePhase = in.readOptionalWriteable(MergePhase::new);
    rightMergePhase = in.readOptionalWriteable(MergePhase::new);
    numLeftOutputs = in.readVInt();
    numRightOutputs = in.readVInt();

    if (in.readBoolean()) {
        joinCondition = Symbols.fromStream(in);
    } else {
        joinCondition = null;
    }
    joinType = JoinType.values()[in.readVInt()];
}
 
Example 2
Source File: TransportNodesSnapshotsStatus.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
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);
            shardMapBuilder.put(shardId, status);
        }
        snapshotMapBuilder.put(snapshotId, shardMapBuilder.build());
    }
    status = snapshotMapBuilder.build();
}
 
Example 3
Source File: DoubleTerms.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
protected void doReadFrom(StreamInput in) throws IOException {
    if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta1)) {
        this.docCountError = in.readLong();
    } else {
        this.docCountError = -1;
    }
    this.order = InternalOrder.Streams.readOrder(in);
    this.formatter = ValueFormatterStreams.readOptional(in);
    this.requiredSize = readSize(in);
    this.shardSize = readSize(in);
    this.showTermDocCountError = in.readBoolean();
    this.minDocCount = in.readVLong();
    this.otherDocCount = in.readVLong();
    int size = in.readVInt();
    List<InternalTerms.Bucket> buckets = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        Bucket bucket = new Bucket(formatter, showTermDocCountError);
        bucket.readFrom(in);
        buckets.add(bucket);
    }
    this.buckets = buckets;
    this.bucketMap = null;
}
 
Example 4
Source File: ActionWriteResponse.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    index = in.readString();
    shardId = in.readVInt();
    nodeId = in.readOptionalString();
    cause = in.readThrowable();
    status = RestStatus.readFrom(in);
    primary = in.readBoolean();
}
 
Example 5
Source File: ClearFilterJoinCacheResponse.java    From siren-join with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
  super.readFrom(in);
  nodes = new ClearFilterJoinCacheNodeResponse[in.readVInt()];
  for (int i = 0; i < nodes.length; i++) {
    nodes[i] = ClearFilterJoinCacheNodeResponse.readNodeInfo(in);
  }
}
 
Example 6
Source File: AnalyzeResponse.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    int size = in.readVInt();
    tokens = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        tokens.add(AnalyzeToken.readAnalyzeToken(in));
    }
    if (in.getVersion().onOrAfter(Version.V_2_2_0)) {
        detail = in.readOptionalStreamable(new DetailAnalyzeResponse());
    }
}
 
Example 7
Source File: ColumnIdent.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    name = in.readString();
    int numParts = in.readVInt();
    if (numParts > 0) {
        path = new ArrayList<>(numParts);
        for (int i = 0; i < numParts; i++) {
            path.add(in.readString());
        }
    } else {
        path = ImmutableList.of();
    }

}
 
Example 8
Source File: DataTypes.java    From crate with Apache License 2.0 5 votes vote down vote up
public static DataType<?> fromStream(StreamInput in) throws IOException {
    int i = in.readVInt();
    try {
        return TYPE_REGISTRY.get(i).read(in);
    } catch (NullPointerException e) {
        LOGGER.error(String.format(Locale.ENGLISH, "%d is missing in TYPE_REGISTRY", i), e);
        throw e;
    }
}
 
Example 9
Source File: FsInfo.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    timestamp = in.readVLong();
    paths = new Path[in.readVInt()];
    for (int i = 0; i < paths.length; i++) {
        paths[i] = Path.readInfoFrom(in);
    }
}
 
Example 10
Source File: IndexShardStats.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    shardId = ShardId.readShardId(in);
    int shardSize = in.readVInt();
    shards = new ShardStats[shardSize];
    for (int i = 0; i < shardSize; i++) {
        shards[i] = ShardStats.readShardStats(in);
    }
}
 
Example 11
Source File: FunctionIdent.java    From crate with Apache License 2.0 5 votes vote down vote up
public FunctionIdent(StreamInput in) throws IOException {
    fqnName = new FunctionName(in);
    int numTypes = in.readVInt();
    argumentTypes = new ArrayList<>(numTypes);
    for (int i = 0; i < numTypes; i++) {
        argumentTypes.add(DataTypes.fromStream(in));
    }
}
 
Example 12
Source File: RoutingTable.java    From crate with Apache License 2.0 5 votes vote down vote up
public static RoutingTable readFrom(StreamInput in) throws IOException {
    Builder builder = new Builder();
    builder.version = in.readLong();
    int size = in.readVInt();
    for (int i = 0; i < size; i++) {
        IndexRoutingTable index = IndexRoutingTable.readFrom(in);
        builder.add(index);
    }

    return builder.build();
}
 
Example 13
Source File: TransportBroadcastByNodeAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    indicesLevelRequest = readRequestFrom(in);
    int size = in.readVInt();
    shards = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        shards.add(ShardRouting.readShardRoutingEntry(in));
    }
    nodeId = in.readString();
}
 
Example 14
Source File: ThreadPoolStats.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    int size = in.readVInt();
    stats = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        Stats stats1 = new Stats();
        stats1.readFrom(in);
        stats.add(stats1);
    }
}
 
Example 15
Source File: ShapeBuilder.java    From crate with Apache License 2.0 5 votes vote down vote up
/** ctor from serialized stream input */
protected ShapeBuilder(StreamInput in) throws IOException {
    int size = in.readVInt();
    coordinates = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        coordinates.add(readFromStream(in));
    }
}
 
Example 16
Source File: MultiTermVectorsResponse.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    responses = new MultiTermVectorsItemResponse[in.readVInt()];
    for (int i = 0; i < responses.length; i++) {
        responses[i] = MultiTermVectorsItemResponse.readItemResponse(in);
    }
}
 
Example 17
Source File: RoutingTableValidation.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    valid = in.readBoolean();
    int size = in.readVInt();
    if (size == 0) {
        failures = Collections.emptyList();
    } else {
        failures = new ArrayList<>(size);
        for (int i = 0; i < size; i++) {
            failures.add(in.readString());
        }
    }
    size = in.readVInt();
    if (size == 0) {
        indicesFailures = ImmutableMap.of();
    } else {
        indicesFailures = newHashMap();
        for (int i = 0; i < size; i++) {
            String index = in.readString();
            int size2 = in.readVInt();
            List<String> indexFailures = new ArrayList<>(size2);
            for (int j = 0; j < size2; j++) {
                indexFailures.add(in.readString());
            }
            indicesFailures.put(index, indexFailures);
        }
    }
}
 
Example 18
Source File: CompressedXContent.java    From crate with Apache License 2.0 4 votes vote down vote up
public static CompressedXContent readCompressedString(StreamInput in) throws IOException {
    int crc32 = in.readInt();
    byte[] compressed = new byte[in.readVInt()];
    in.readBytes(compressed, 0, compressed.length);
    return new CompressedXContent(compressed, crc32);
}
 
Example 19
Source File: ListStoresAction.java    From elasticsearch-learning-to-rank with Apache License 2.0 4 votes vote down vote up
public IndexStoreInfo(StreamInput in) throws IOException {
    storeName = in.readString();
    indexName = in.readString();
    version = in.readVInt();
    counts = in.readMap(StreamInput::readString, StreamInput::readVInt);
}
 
Example 20
Source File: CachesStatsAction.java    From elasticsearch-learning-to-rank with Apache License 2.0 4 votes vote down vote up
public Stat(StreamInput in) throws IOException {
    ram = in.readVLong();
    count = in.readVInt();
}