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

The following examples show how to use org.elasticsearch.common.io.stream.StreamInput#readNamedWriteable() . 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: ClusterState.java    From crate with Apache License 2.0 6 votes vote down vote up
public static ClusterState readFrom(StreamInput in, DiscoveryNode localNode) throws IOException {
    ClusterName clusterName = new ClusterName(in);
    Builder builder = new Builder(clusterName);
    builder.version = in.readLong();
    builder.uuid = in.readString();
    builder.metaData = MetaData.readFrom(in);
    builder.routingTable = RoutingTable.readFrom(in);
    builder.nodes = DiscoveryNodes.readFrom(in, localNode);
    builder.blocks = new ClusterBlocks(in);
    int customSize = in.readVInt();
    for (int i = 0; i < customSize; i++) {
        Custom customIndexMetaData = in.readNamedWriteable(Custom.class);
        builder.putCustom(customIndexMetaData.getWriteableName(), customIndexMetaData);
    }
    return builder.build();
}
 
Example 2
Source File: MetaData.java    From crate with Apache License 2.0 6 votes vote down vote up
public static MetaData readFrom(StreamInput in) throws IOException {
    Builder builder = new Builder();
    builder.version = in.readLong();
    builder.clusterUUID = in.readString();
    builder.clusterUUIDCommitted = in.readBoolean();
    builder.coordinationMetaData(new CoordinationMetaData(in));
    builder.transientSettings(readSettingsFromStream(in));
    builder.persistentSettings(readSettingsFromStream(in));
    int size = in.readVInt();
    for (int i = 0; i < size; i++) {
        builder.put(IndexMetaData.readFrom(in), false);
    }
    size = in.readVInt();
    for (int i = 0; i < size; i++) {
        builder.put(IndexTemplateMetaData.readFrom(in));
    }
    int customSize = in.readVInt();
    for (int i = 0; i < customSize; i++) {
        Custom customIndexMetaData = in.readNamedWriteable(Custom.class);
        builder.putCustom(customIndexMetaData.getWriteableName(), customIndexMetaData);
    }
    return builder.build();
}
 
Example 3
Source File: FeatureStoreAction.java    From elasticsearch-learning-to-rank with Apache License 2.0 5 votes vote down vote up
public FeatureStoreRequest(StreamInput in) throws IOException {
    super(in);
    store = in.readString();
    routing = in.readOptionalString();
    action = Action.values()[in.readVInt()];
    storableElement = in.readNamedWriteable(StorableElement.class);
    validation = in.readOptionalWriteable(FeatureValidation::new);
}
 
Example 4
Source File: AbstractNamedDiffable.java    From crate with Apache License 2.0 5 votes vote down vote up
/**
 * Read simple diff from the stream
 */
CompleteNamedDiff(Class<? extends T> tClass, String name, StreamInput in) throws IOException {
    if (in.readBoolean()) {
        this.part = in.readNamedWriteable(tClass, name);
        this.minimalSupportedVersion = part.getMinimalSupportedVersion();
    } else {
        this.part = null;
        this.minimalSupportedVersion = null; // We just read this diff, so it's not going to be written
    }
    this.name = name;
}
 
Example 5
Source File: ExplorerQueryBuilder.java    From elasticsearch-learning-to-rank with Apache License 2.0 4 votes vote down vote up
public ExplorerQueryBuilder(StreamInput in) throws IOException {
    super(in);
    query = in.readNamedWriteable(QueryBuilder.class);
    type = in.readString();
}
 
Example 6
Source File: PositionMatchQueryBuilder.java    From elasticsearch-position-similarity with Apache License 2.0 4 votes vote down vote up
public PositionMatchQueryBuilder(StreamInput in) throws IOException {
    super(in);
    queryBuilder = in.readNamedWriteable(QueryBuilder.class);
}
 
Example 7
Source File: DateHierarchyAggregationBuilder.java    From elasticsearch-aggregation-pathhierarchy with MIT License 4 votes vote down vote up
public RoundingInfo(StreamInput in) throws IOException {
    rounding = Rounding.read(in);
    interval = in.readString();
    format = in.readNamedWriteable(DocValueFormat.class);
}
 
Example 8
Source File: ExactPhraseQueryBuilder.java    From elasticsearch-plugin-bundle with GNU Affero General Public License v3.0 4 votes vote down vote up
public ExactPhraseQueryBuilder(StreamInput in) throws IOException {
    super(in);
    query = in.readNamedWriteable(QueryBuilder.class);
}
 
Example 9
Source File: NamedDiffableValueSerializer.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public T read(StreamInput in, String key) throws IOException {
    return in.readNamedWriteable(tClass, key);
}
 
Example 10
Source File: NamedDiffableValueSerializer.java    From crate with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public Diff<T> readDiff(StreamInput in, String key) throws IOException {
    return in.readNamedWriteable(NamedDiff.class, key);
}
 
Example 11
Source File: RerouteExplanation.java    From crate with Apache License 2.0 4 votes vote down vote up
public static RerouteExplanation readFrom(StreamInput in) throws IOException {
    AllocationCommand command = in.readNamedWriteable(AllocationCommand.class);
    Decision decisions = Decision.readFrom(in);
    return new RerouteExplanation(command, decisions);
}
 
Example 12
Source File: ConcurrentSeqNoVersioningIT.java    From crate with Apache License 2.0 4 votes vote down vote up
private static LinearizabilityChecker.Event readEvent(StreamInput input) throws IOException {
    return new LinearizabilityChecker.Event(input.readEnum(LinearizabilityChecker.EventType.class),
                                            input.readNamedWriteable(NamedWriteable.class), input.readInt());
}