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

The following examples show how to use org.elasticsearch.Version#readVersion() . 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: ShardUpsertRequest.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    id = in.readString();
    int assignmentsSize = in.readVInt();
    if (assignmentsSize > 0) {
        updateAssignments = new Symbol[assignmentsSize];
        for (int i = 0; i < assignmentsSize; i++) {
            updateAssignments[i] = Symbol.fromStream(in);
        }
    }
    int missingAssignmentsSize = in.readVInt();
    if (missingAssignmentsSize > 0) {
        this.insertValues = new Object[missingAssignmentsSize];
        for (int i = 0; i < missingAssignmentsSize; i++) {
            insertValues[i] = insertValuesStreamer[i].readValueFrom(in);
        }
    }
    this.version = Version.readVersion(in).id;
    versionType = VersionType.fromValue(in.readByte());
    opType = IndexRequest.OpType.fromId(in.readByte());
    if (in.readBoolean()) {
        source = in.readBytesReference();
    }
}
 
Example 2
Source File: DiscoveryNode.java    From crate with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new {@link DiscoveryNode} by reading from the stream provided as argument
 * @param in the stream
 * @throws IOException if there is an error while reading from the stream
 */
public DiscoveryNode(StreamInput in) throws IOException {
    this.nodeName = in.readString().intern();
    this.nodeId = in.readString().intern();
    this.ephemeralId = in.readString().intern();
    this.hostName = in.readString().intern();
    this.hostAddress = in.readString().intern();
    this.address = new TransportAddress(in);
    int size = in.readVInt();
    this.attributes = new HashMap<>(size);
    for (int i = 0; i < size; i++) {
        this.attributes.put(in.readString(), in.readString());
    }
    int rolesSize = in.readVInt();
    this.roles = EnumSet.noneOf(Role.class);
    for (int i = 0; i < rolesSize; i++) {
        this.roles.add(in.readEnum(Role.class));
    }
    this.version = Version.readVersion(in);
}
 
Example 3
Source File: NodeStatsContext.java    From crate with Apache License 2.0 5 votes vote down vote up
public NodeStatsContext(StreamInput in, boolean complete) throws IOException {
    this.complete = complete;
    this.id = DataTypes.STRING.readValueFrom(in);
    this.name = DataTypes.STRING.readValueFrom(in);
    this.hostname = DataTypes.STRING.readValueFrom(in);
    this.timestamp = in.readLong();
    this.version = in.readBoolean() ? Version.readVersion(in) : null;
    this.build = in.readBoolean() ? Build.readBuild(in) : null;
    this.restUrl = DataTypes.STRING.readValueFrom(in);
    this.pgPort = in.readOptionalVInt();
    this.httpPort = in.readOptionalVInt();
    this.transportPort = in.readOptionalVInt();
    this.jvmStats = in.readOptionalWriteable(JvmStats::new);
    this.osInfo = in.readOptionalWriteable(OsInfo::new);
    this.processStats = in.readOptionalWriteable(ProcessStats::new);
    this.osStats = in.readOptionalWriteable(OsStats::new);
    this.fsInfo = in.readOptionalWriteable(FsInfo::new);
    this.extendedOsStats = in.readOptionalWriteable(ExtendedOsStats::new);
    this.threadPools = in.readOptionalWriteable(ThreadPoolStats::new);
    this.httpStats = in.readOptionalWriteable(HttpStats::new);
    this.psqlStats = in.readOptionalWriteable(ConnectionStats::new);
    this.openTransportConnections = in.readLong();
    this.clusterStateVersion = in.readLong();

    this.osName = DataTypes.STRING.readValueFrom(in);
    this.osArch = DataTypes.STRING.readValueFrom(in);
    this.osVersion = DataTypes.STRING.readValueFrom(in);
    this.javaVersion = DataTypes.STRING.readValueFrom(in);
    this.jvmName = DataTypes.STRING.readValueFrom(in);
    this.jvmVendor = DataTypes.STRING.readValueFrom(in);
    this.jvmVersion = DataTypes.STRING.readValueFrom(in);
}
 
Example 4
Source File: DiscoveryNode.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    nodeName = in.readString().intern();
    nodeId = in.readString().intern();
    hostName = in.readString().intern();
    hostAddress = in.readString().intern();
    address = TransportAddressSerializers.addressFromStream(in);
    int size = in.readVInt();
    ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
    for (int i = 0; i < size; i++) {
        builder.put(in.readString().intern(), in.readString().intern());
    }
    attributes = builder.build();
    version = Version.readVersion(in);
}
 
Example 5
Source File: SnapshotInfo.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 size = in.readVInt();
    List<String> indicesListBuilder = new ArrayList<>();
    for (int i = 0; i < size; i++) {
        indicesListBuilder.add(in.readString());
    }
    indices = Collections.unmodifiableList(indicesListBuilder);
    state = SnapshotState.fromValue(in.readByte());
    reason = in.readOptionalString();
    startTime = in.readVLong();
    endTime = in.readVLong();
    totalShards = in.readVInt();
    successfulShards = in.readVInt();
    size = in.readVInt();
    if (size > 0) {
        List<SnapshotShardFailure> failureBuilder = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            failureBuilder.add(SnapshotShardFailure.readSnapshotShardFailure(in));
        }
        shardFailures = Collections.unmodifiableList(failureBuilder);
    } else {
        shardFailures = Collections.emptyList();
    }
    version = Version.readVersion(in);
}
 
Example 6
Source File: UpgradeSettingsRequest.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();
    versions = newHashMap();
    for (int i=0; i<size; i++) {
        String index = in.readString();
        Version upgradeVersion = Version.readVersion(in);
        String oldestLuceneSegment = in.readString();
        versions.put(index, new Tuple<>(upgradeVersion, oldestLuceneSegment));
    }
    readTimeout(in);
}
 
Example 7
Source File: ShardUpgradeResult.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);
    primary = in.readBoolean();
    upgradeVersion = Version.readVersion(in);
    try {
        oldestLuceneSegment = org.apache.lucene.util.Version.parse(in.readString());
    } catch (ParseException ex) {
        throw new IOException("failed to parse lucene version [" + oldestLuceneSegment + "]", ex);
    }

}
 
Example 8
Source File: UpgradeResponse.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();
    versions = newHashMap();
    for (int i=0; i<size; i++) {
        String index = in.readString();
        Version upgradeVersion = Version.readVersion(in);
        String oldestLuceneSegment = in.readString();
        versions.put(index, new Tuple<>(upgradeVersion, oldestLuceneSegment));
    }
}
 
Example 9
Source File: NodeInfo.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);
    version = Version.readVersion(in);
    build = Build.readBuild(in);
    if (in.readBoolean()) {
        ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
        int size = in.readVInt();
        for (int i = 0; i < size; i++) {
            builder.put(in.readString(), in.readString());
        }
        serviceAttributes = builder.build();
    }
    if (in.readBoolean()) {
        settings = Settings.readSettingsFromStream(in);
    }
    if (in.readBoolean()) {
        os = OsInfo.readOsInfo(in);
    }
    if (in.readBoolean()) {
        process = ProcessInfo.readProcessInfo(in);
    }
    if (in.readBoolean()) {
        jvm = JvmInfo.readJvmInfo(in);
    }
    if (in.readBoolean()) {
        threadPool = ThreadPoolInfo.readThreadPoolInfo(in);
    }
    if (in.readBoolean()) {
        transport = TransportInfo.readTransportInfo(in);
    }
    if (in.readBoolean()) {
        http = HttpInfo.readHttpInfo(in);
    }
    if (in.readBoolean()) {
        plugins = new PluginsAndModules();
        plugins.readFrom(in);
    }
}
 
Example 10
Source File: UpgradeResponse.java    From crate with Apache License 2.0 5 votes vote down vote up
public UpgradeResponse(StreamInput in) throws IOException {
    super(in);
    int size = in.readVInt();
    versions = new HashMap<>();
    for (int i = 0; i < size; i++) {
        String index = in.readString();
        Version upgradeVersion = Version.readVersion(in);
        String oldestLuceneSegment = in.readString();
        versions.put(index, new Tuple<>(upgradeVersion, oldestLuceneSegment));
    }
}
 
Example 11
Source File: ShardUpgradeResult.java    From crate with Apache License 2.0 5 votes vote down vote up
public ShardUpgradeResult(StreamInput in) throws IOException {
    shardId = new ShardId(in);
    primary = in.readBoolean();
    upgradeVersion = Version.readVersion(in);
    String luceneVersion = in.readString();
    try {
        oldestLuceneSegment = org.apache.lucene.util.Version.parse(luceneVersion);
    } catch (ParseException ex) {
        throw new IOException("failed to parse lucene version [" + luceneVersion + "]", ex);
    }
}
 
Example 12
Source File: SnapshotInfo.java    From crate with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs snapshot information from stream input
 */
public SnapshotInfo(final StreamInput in) throws IOException {
    snapshotId = new SnapshotId(in);
    int size = in.readVInt();
    List<String> indicesListBuilder = new ArrayList<>();
    for (int i = 0; i < size; i++) {
        indicesListBuilder.add(in.readString());
    }
    indices = Collections.unmodifiableList(indicesListBuilder);
    state = in.readBoolean() ? SnapshotState.fromValue(in.readByte()) : null;
    reason = in.readOptionalString();
    startTime = in.readVLong();
    endTime = in.readVLong();
    totalShards = in.readVInt();
    successfulShards = in.readVInt();
    size = in.readVInt();
    if (size > 0) {
        List<SnapshotShardFailure> failureBuilder = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            failureBuilder.add(new SnapshotShardFailure(in));
        }
        shardFailures = Collections.unmodifiableList(failureBuilder);
    } else {
        shardFailures = Collections.emptyList();
    }
    version = in.readBoolean() ? Version.readVersion(in) : null;
    includeGlobalState = in.readOptionalBoolean();
}
 
Example 13
Source File: UpgradeSettingsRequest.java    From crate with Apache License 2.0 5 votes vote down vote up
public UpgradeSettingsRequest(StreamInput in) throws IOException {
    super(in);
    int size = in.readVInt();
    versions = new HashMap<>();
    for (int i = 0; i < size; i++) {
        String index = in.readString();
        Version upgradeVersion = Version.readVersion(in);
        String oldestLuceneSegment = in.readString();
        versions.put(index, new Tuple<>(upgradeVersion, oldestLuceneSegment));
    }
}
 
Example 14
Source File: TransportService.java    From crate with Apache License 2.0 4 votes vote down vote up
public HandshakeResponse(StreamInput in) throws IOException {
    discoveryNode = in.readOptionalWriteable(DiscoveryNode::new);
    clusterName = new ClusterName(in);
    version = Version.readVersion(in);
}
 
Example 15
Source File: RecoverySource.java    From crate with Apache License 2.0 4 votes vote down vote up
SnapshotRecoverySource(StreamInput in) throws IOException {
    snapshot = new Snapshot(in);
    version = Version.readVersion(in);
    index = in.readString();
}
 
Example 16
Source File: TcpTransport.java    From crate with Apache License 2.0 4 votes vote down vote up
public VersionHandshakeResponse(StreamInput in) throws IOException {
    version = Version.readVersion(in);
}
 
Example 17
Source File: RestoreSource.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    snapshotId = SnapshotId.readSnapshotId(in);
    version = Version.readVersion(in);
    index = in.readString();
}