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

The following examples show how to use org.elasticsearch.common.io.stream.StreamInput#readInt() . 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: ImportResponse.java    From elasticsearch-inout-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    int responsesCount = in.readInt();
    this.responses = new ArrayList<NodeImportResponse>(responsesCount);
    for (int i = 0; i < responsesCount; i++) {
        responses.add(NodeImportResponse.readNew(in));
    }
    int failuresCount = in.readInt();
    this.nodeFailures = new ArrayList<FailedNodeException>(failuresCount);
    for (int i = 0; i < failuresCount; i++) {
        String nodeId = in.readString();
        String msg = in.readOptionalString();
        FailedNodeException e = new FailedNodeException(nodeId, msg, null);
        nodeFailures.add(e);
    }
}
 
Example 2
Source File: PutIndexTemplateRequest.java    From crate with Apache License 2.0 6 votes vote down vote up
public PutIndexTemplateRequest(StreamInput in) throws IOException {
    super(in);
    cause = in.readString();
    name = in.readString();

    indexPatterns = in.readList(StreamInput::readString);
    order = in.readInt();
    create = in.readBoolean();
    settings = readSettingsFromStream(in);
    int size = in.readVInt();
    for (int i = 0; i < size; i++) {
        final String type = in.readString();
        String mappingSource = in.readString();
        mappings.put(type, mappingSource);
    }
    int aliasesSize = in.readVInt();
    for (int i = 0; i < aliasesSize; i++) {
        aliases.add(new Alias(in));
    }
    version = in.readOptionalVInt();
}
 
Example 3
Source File: ThreadPool.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    name = in.readString();
    type = ThreadPoolType.fromType(in.readString());
    min = in.readInt();
    max = in.readInt();
    if (in.readBoolean()) {
        keepAlive = TimeValue.readTimeValue(in);
    }
    if (in.readBoolean()) {
        queueSize = SizeValue.readSizeValue(in);
    }
    in.readBoolean(); // here to conform with removed waitTime
    in.readBoolean(); // here to conform with removed rejected setting
    in.readBoolean(); // here to conform with queue type
}
 
Example 4
Source File: IndexMetaData.java    From crate with Apache License 2.0 6 votes vote down vote up
IndexMetaDataDiff(StreamInput in) throws IOException {
    index = in.readString();
    routingNumShards = in.readInt();
    version = in.readLong();
    mappingVersion = in.readVLong();
    settingsVersion = in.readVLong();
    state = State.fromId(in.readByte());
    settings = Settings.readSettingsFromStream(in);
    primaryTerms = in.readVLongArray();
    mappings = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), MappingMetaData::new,
        MappingMetaData::readDiffFrom);
    aliases = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), AliasMetaData::new,
        AliasMetaData::readDiffFrom);
    customData = DiffableUtils.readImmutableOpenMapDiff(in, DiffableUtils.getStringKeySerializer(), DiffableStringMap::new,
        DiffableStringMap::readDiffFrom);
    inSyncAllocationIds = DiffableUtils.readImmutableOpenIntMapDiff(in, DiffableUtils.getVIntKeySerializer(),
        DiffableUtils.StringSetValueSerializer.getInstance());
}
 
Example 5
Source File: ForceMergeRequest.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);
    maxNumSegments = in.readInt();
    onlyExpungeDeletes = in.readBoolean();
    flush = in.readBoolean();
}
 
Example 6
Source File: ObjectType.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, Object> readValueFrom(StreamInput in) throws IOException {
    if (in.readBoolean()) {
        int size = in.readInt();
        HashMap<String, Object> m = new HashMap<>(size);
        for (int i = 0; i < size; i++) {
            String key = in.readString();
            DataType innerType = innerTypes.getOrDefault(key, UndefinedType.INSTANCE);
            Object val = innerType.streamer().readValueFrom(in);
            m.put(key, val);
        }
        return m;
    }
    return null;
}
 
Example 7
Source File: Lucene.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public static FieldDoc readFieldDoc(StreamInput in) throws IOException {
    Comparable[] cFields = new Comparable[in.readVInt()];
    for (int j = 0; j < cFields.length; j++) {
        byte type = in.readByte();
        if (type == 0) {
            cFields[j] = null;
        } else if (type == 1) {
            cFields[j] = in.readString();
        } else if (type == 2) {
            cFields[j] = in.readInt();
        } else if (type == 3) {
            cFields[j] = in.readLong();
        } else if (type == 4) {
            cFields[j] = in.readFloat();
        } else if (type == 5) {
            cFields[j] = in.readDouble();
        } else if (type == 6) {
            cFields[j] = in.readByte();
        } else if (type == 7) {
            cFields[j] = in.readShort();
        } else if (type == 8) {
            cFields[j] = in.readBoolean();
        } else if (type == 9) {
            cFields[j] = in.readBytesRef();
        } else {
            throw new IOException("Can't match type [" + type + "]");
        }
    }
    return new FieldDoc(in.readVInt(), in.readFloat(), cFields);
}
 
Example 8
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 {
    name = in.readString();
    threads = in.readInt();
    queue = in.readInt();
    active = in.readInt();
    rejected = in.readLong();
    largest = in.readInt();
    completed = in.readLong();
}
 
Example 9
Source File: OsInfo.java    From crate with Apache License 2.0 5 votes vote down vote up
public OsInfo(StreamInput in) throws IOException {
    this.refreshInterval = in.readLong();
    this.availableProcessors = in.readInt();
    this.allocatedProcessors = in.readInt();
    this.name = in.readOptionalString();
    this.arch = in.readOptionalString();
    this.version = in.readOptionalString();
}
 
Example 10
Source File: NodesHotThreadsRequest.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);
    threads = in.readInt();
    ignoreIdleThreads = in.readBoolean();
    type = in.readString();
    interval = TimeValue.readTimeValue(in);
    snapshots = in.readInt();
}
 
Example 11
Source File: ExtendedAnalyzeResponse.java    From elasticsearch-extended-analyze with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    term = in.readString();
    startOffset = in.readInt();
    endOffset = in.readInt();
    position = in.readVInt();
    type = in.readOptionalString();
    extendedAttributes = (Map<String, Map<String, Object>>) in.readGenericValue();
}
 
Example 12
Source File: ThreadPoolStats.java    From crate with Apache License 2.0 5 votes vote down vote up
public Stats(StreamInput in) throws IOException {
    name = in.readString();
    threads = in.readInt();
    queue = in.readInt();
    active = in.readInt();
    rejected = in.readLong();
    largest = in.readInt();
    completed = in.readLong();
}
 
Example 13
Source File: AllocatedNodeInfo.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public AllocatedNodeInfo readFrom(StreamInput in) throws IOException {
    String ipAddress = in.readString();
    int port = in.readInt();
    AllocatedNodeStatus allocatedNodeStatus = AllocatedNodeStatus.fromValue(in.readInt());
    return new AllocatedNodeInfo(ipAddress, port, allocatedNodeStatus);
}
 
Example 14
Source File: ClusterHealthResponse.java    From crate with Apache License 2.0 5 votes vote down vote up
public ClusterHealthResponse(StreamInput in) throws IOException {
    clusterName = in.readString();
    clusterHealthStatus = ClusterHealthStatus.fromValue(in.readByte());
    clusterStateHealth = new ClusterStateHealth(in);
    numberOfPendingTasks = in.readInt();
    timedOut = in.readBoolean();
    numberOfInFlightFetch = in.readInt();
    delayedUnassignedShards = in.readInt();
    taskMaxWaitingTime = in.readTimeValue();
}
 
Example 15
Source File: RecoveryEngineException.java    From crate with Apache License 2.0 4 votes vote down vote up
public RecoveryEngineException(StreamInput in) throws IOException {
    super(in);
    phase = in.readInt();
}
 
Example 16
Source File: SyncedFlushResponse.java    From crate with Apache License 2.0 4 votes vote down vote up
public ShardCounts(StreamInput in) throws IOException {
    total = in.readInt();
    successful = in.readInt();
    failed = in.readInt();
}
 
Example 17
Source File: DateHierarchyAggregator.java    From elasticsearch-aggregation-pathhierarchy with MIT License 4 votes vote down vote up
/**
 * Read from a stream.
 */
public BucketCountThresholds(StreamInput in) throws IOException {
    requiredSize = in.readInt();
    shardSize = in.readInt();
}
 
Example 18
Source File: SyncedFlushResponse.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    total = in.readInt();
    successful = in.readInt();
    failed = in.readInt();
}
 
Example 19
Source File: CompressedXContent.java    From Elasticsearch 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 20
Source File: QueryParsingException.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public QueryParsingException(StreamInput in) throws IOException{
    super(in);
    lineNumber = in.readInt();
    columnNumber = in.readInt();
}