Java Code Examples for org.elasticsearch.Version#writeVersion()

The following examples show how to use org.elasticsearch.Version#writeVersion() . 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: SnapshotInfo.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(name);
    out.writeVInt(indices.size());
    for (String index : indices) {
        out.writeString(index);
    }
    out.writeByte(state.value());
    out.writeOptionalString(reason);
    out.writeVLong(startTime);
    out.writeVLong(endTime);
    out.writeVInt(totalShards);
    out.writeVInt(successfulShards);
    out.writeVInt(shardFailures.size());
    for (SnapshotShardFailure failure : shardFailures) {
        failure.writeTo(out);
    }
    Version.writeVersion(version, out);
}
 
Example 2
Source File: DiscoveryNode.java    From crate with Apache License 2.0 6 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(nodeName);
    out.writeString(nodeId);
    out.writeString(ephemeralId);
    out.writeString(hostName);
    out.writeString(hostAddress);
    address.writeTo(out);
    out.writeVInt(attributes.size());
    for (Map.Entry<String, String> entry : attributes.entrySet()) {
        out.writeString(entry.getKey());
        out.writeString(entry.getValue());
    }
    out.writeVInt(roles.size());
    for (Role role : roles) {
        out.writeEnum(role);
    }
    Version.writeVersion(version, out);
}
 
Example 3
Source File: ShardUpsertRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(id);
    if (updateAssignments != null) {
        out.writeVInt(updateAssignments.length);
        for (Symbol updateAssignment : updateAssignments) {
            Symbol.toStream(updateAssignment, out);
        }
    } else {
        out.writeVInt(0);
    }
    // Stream References
    if (insertValues != null) {
        out.writeVInt(insertValues.length);
        for (int i = 0; i < insertValues.length; i++) {
            insertValuesStreamer[i].writeValueTo(out, insertValues[i]);
        }
    } else {
        out.writeVInt(0);
    }

    Version.writeVersion(Version.fromId((int) version), out);
    out.writeByte(versionType.getValue());
    out.writeByte(opType.id());
    boolean sourceAvailable = source != null;
    out.writeBoolean(sourceAvailable);
    if (sourceAvailable) {
        out.writeBytesReference(source);
    }
}
 
Example 4
Source File: DiscoveryNode.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeString(nodeName);
    out.writeString(nodeId);
    out.writeString(hostName);
    out.writeString(hostAddress);
    addressToStream(out, address);
    out.writeVInt(attributes.size());
    for (Map.Entry<String, String> entry : attributes.entrySet()) {
        out.writeString(entry.getKey());
        out.writeString(entry.getValue());
    }
    Version.writeVersion(version, out);
}
 
Example 5
Source File: UpgradeSettingsRequest.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeVInt(versions.size());
    for(Map.Entry<String, Tuple<Version, String>> entry : versions.entrySet()) {
        out.writeString(entry.getKey());
        Version.writeVersion(entry.getValue().v1(), out);
        out.writeString(entry.getValue().v2());
    }
    writeTimeout(out);
}
 
Example 6
Source File: ShardUpgradeResult.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    shardId.writeTo(out);
    out.writeBoolean(primary);
    Version.writeVersion(upgradeVersion, out);
    out.writeString(oldestLuceneSegment.toString());
}
 
Example 7
Source File: UpgradeResponse.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeVInt(versions.size());
    for(Map.Entry<String, Tuple<Version, String>> entry : versions.entrySet()) {
        out.writeString(entry.getKey());
        Version.writeVersion(entry.getValue().v1(), out);
        out.writeString(entry.getValue().v2());
    }
}
 
Example 8
Source File: ClusterStatsNodes.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    counts.writeTo(out);
    out.writeVInt(versions.size());
    for (Version v : versions) Version.writeVersion(v, out);
    os.writeTo(out);
    process.writeTo(out);
    jvm.writeTo(out);
    fs.writeTo(out);
    out.writeVInt(plugins.size());
    for (PluginInfo p : plugins) {
        p.writeTo(out);
    }
}
 
Example 9
Source File: SnapshotInfo.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(final StreamOutput out) throws IOException {
    snapshotId.writeTo(out);
    out.writeVInt(indices.size());
    for (String index : indices) {
        out.writeString(index);
    }
    if (state != null) {
        out.writeBoolean(true);
        out.writeByte(state.value());
    } else {
        out.writeBoolean(false);
    }
    out.writeOptionalString(reason);
    out.writeVLong(startTime);
    out.writeVLong(endTime);
    out.writeVInt(totalShards);
    out.writeVInt(successfulShards);
    out.writeVInt(shardFailures.size());
    for (SnapshotShardFailure failure : shardFailures) {
        failure.writeTo(out);
    }
    if (version != null) {
        out.writeBoolean(true);
        Version.writeVersion(version, out);
    } else {
        out.writeBoolean(false);
    }
    out.writeOptionalBoolean(includeGlobalState);
}
 
Example 10
Source File: UpgradeSettingsRequest.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeVInt(versions.size());
    for (Map.Entry<String, Tuple<Version, String>> entry : versions.entrySet()) {
        out.writeString(entry.getKey());
        Version.writeVersion(entry.getValue().v1(), out);
        out.writeString(entry.getValue().v2());
    }
}
 
Example 11
Source File: ShardUpgradeResult.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    shardId.writeTo(out);
    out.writeBoolean(primary);
    Version.writeVersion(upgradeVersion, out);
    out.writeString(oldestLuceneSegment.toString());
}
 
Example 12
Source File: UpgradeResponse.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeVInt(versions.size());
    for (Map.Entry<String, Tuple<Version, String>> entry : versions.entrySet()) {
        out.writeString(entry.getKey());
        Version.writeVersion(entry.getValue().v1(), out);
        out.writeString(entry.getValue().v2());
    }
}
 
Example 13
Source File: NodeStatsContext.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    DataTypes.STRING.writeValueTo(out, id);
    DataTypes.STRING.writeValueTo(out, name);
    DataTypes.STRING.writeValueTo(out, hostname);
    out.writeLong(timestamp);
    out.writeBoolean(version != null);
    if (version != null) {
        Version.writeVersion(version, out);
    }
    out.writeBoolean(build != null);
    if (build != null) {
        Build.writeBuildTo(build, out);
    }
    DataTypes.STRING.writeValueTo(out, restUrl);
    out.writeOptionalVInt(pgPort);
    out.writeOptionalVInt(httpPort);
    out.writeOptionalVInt(transportPort);
    out.writeOptionalWriteable(jvmStats);
    out.writeOptionalWriteable(osInfo);
    out.writeOptionalWriteable(processStats);
    out.writeOptionalWriteable(osStats);
    out.writeOptionalWriteable(fsInfo);
    out.writeOptionalWriteable(extendedOsStats);
    out.writeOptionalWriteable(threadPools);
    out.writeOptionalWriteable(httpStats);
    out.writeOptionalWriteable(psqlStats);
    out.writeLong(openTransportConnections);
    out.writeLong(clusterStateVersion);

    DataTypes.STRING.writeValueTo(out, osName);
    DataTypes.STRING.writeValueTo(out, osArch);
    DataTypes.STRING.writeValueTo(out, osVersion);
    DataTypes.STRING.writeValueTo(out, javaVersion);
    DataTypes.STRING.writeValueTo(out, jvmName);
    DataTypes.STRING.writeValueTo(out, jvmVendor);
    DataTypes.STRING.writeValueTo(out, jvmVersion);
}
 
Example 14
Source File: RestoreSource.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    snapshotId.writeTo(out);
    Version.writeVersion(version, out);
    out.writeString(index);
}
 
Example 15
Source File: TransportService.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public void writeTo(StreamOutput out) throws IOException {
    out.writeOptionalWriteable(discoveryNode);
    clusterName.writeTo(out);
    Version.writeVersion(version, out);
}
 
Example 16
Source File: RecoverySource.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
protected void writeAdditionalFields(StreamOutput out) throws IOException {
    snapshot.writeTo(out);
    Version.writeVersion(version, out);
    out.writeString(index);
}