@Override public byte readByte() throws IOException { final byte b = delegate.readByte(); digest.update(b); return b; }
public static ValueType readFromStream(StreamInput in) throws IOException { byte id = in.readByte(); for (ValueType valueType : values()) { if (id == valueType.id) { return valueType; } } throw new IOException("No valueType found for id [" + id + "]"); }
/** * Read from a stream. * * @throws IllegalArgumentException if the value is unrecognized */ public static ClusterHealthStatus readFrom(StreamInput in) throws IOException { return fromValue(in.readByte()); }
/** * Reads a boolean. */ public final boolean readBoolean() throws IOException { return readBoolean(readByte()); }
public IllegalIndexShardStateException(StreamInput in) throws IOException{ super(in); currentState = IndexShardState.fromId(in.readByte()); }
/** * Read a {@link TimeValue} from the stream */ public TimeValue readTimeValue() throws IOException { long duration = readZLong(); TimeUnit timeUnit = BYTE_TIME_UNIT_MAP.get(readByte()); return new TimeValue(duration, timeUnit); }
@Nullable public final Boolean readOptionalBoolean() throws IOException { final byte value = readByte(); if (value == 2) { return null; } else { return readBoolean(value); } }
public static RecoverySource readFrom(StreamInput in) throws IOException { Type type = Type.values()[in.readByte()]; switch (type) { case EMPTY_STORE: return EmptyStoreRecoverySource.INSTANCE; case EXISTING_STORE: return new ExistingStoreRecoverySource(in); case PEER: return PeerRecoverySource.INSTANCE; case SNAPSHOT: return new SnapshotRecoverySource(in); case LOCAL_SHARDS: return LocalShardsRecoverySource.INSTANCE; default: throw new IllegalArgumentException("unknown recovery type: " + type.name()); } }
public ShardSnapshotStatus(StreamInput in) throws IOException { nodeId = in.readOptionalString(); state = State.fromValue(in.readByte()); reason = in.readOptionalString(); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); indices = in.readStringArray(); int nStatus = in.readVInt(); statuses = EnumSet.noneOf(ClusterHealthStatus.class); for (int i = 0; i < nStatus; i++) { statuses.add(ClusterHealthStatus.fromValue(in.readByte())); } indicesOptions = IndicesOptions.readIndicesOptions(in); } }
/** * Reads restore status from stream input * * @param in stream input */ public void readFrom(StreamInput in) throws IOException { nodeId = in.readOptionalString(); state = State.fromValue(in.readByte()); reason = in.readOptionalString(); }
public static IndicesOptions readIndicesOptions(StreamInput in) throws IOException { if (in.getVersion().onOrAfter(Version.V_6_4_0)) { return new IndicesOptions(in.readEnumSet(Option.class), in.readEnumSet(WildcardStates.class)); } else { byte id = in.readByte(); if (id >= OLD_VALUES.length) { throw new IllegalArgumentException("No valid missing index type id: " + id); } return OLD_VALUES[id]; } }
TimeUnitRounding(StreamInput in) throws IOException { unit = DateTimeUnit.resolve(in.readByte()); timeZone = DateTimeZone.forID(in.readString()); field = unit.field(timeZone); unitRoundsToMidnight = field.getDurationField().getUnitMillis() > 60L * 60L * 1000L; }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); stage = SnapshotIndexShardStage.fromValue(in.readByte()); stats = SnapshotStats.readSnapshotStats(in); nodeId = in.readOptionalString(); failure = in.readOptionalString(); }
public UnassignedInfo(StreamInput in) throws IOException { this.reason = Reason.values()[(int) in.readByte()]; this.unassignedTimeMillis = in.readLong(); // As System.nanoTime() cannot be compared across different JVMs, reset it to now. // This means that in master fail-over situations, elapsed delay time is forgotten. this.unassignedTimeNanos = System.nanoTime(); this.delayed = in.readBoolean(); this.message = in.readOptionalString(); this.failure = in.readException(); this.failedAllocations = in.readVInt(); this.lastAllocationStatus = AllocationStatus.readFrom(in); }
public ClusterShardHealth(final StreamInput in) throws IOException { shardId = in.readVInt(); status = ClusterHealthStatus.fromValue(in.readByte()); activeShards = in.readVInt(); relocatingShards = in.readVInt(); initializingShards = in.readVInt(); unassignedShards = in.readVInt(); primaryActive = in.readBoolean(); }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); int size = in.readVInt(); features = new Feature[size]; for (int i = 0; i < size; i++) { features[i] = Feature.fromId(in.readByte()); } humanReadable = in.readBoolean(); if (in.getVersion().onOrAfter(Version.V_6_4_0)) { includeDefaults = in.readBoolean(); } }
@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); 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(); }
@Override public void readFrom(StreamInput in) throws IOException { index = in.readString(); type = in.readOptionalString(); id = in.readString(); routing = in.readOptionalString(); parent = in.readOptionalString(); storedFields = in.readOptionalStringArray(); version = in.readLong(); versionType = VersionType.fromValue(in.readByte()); fetchSourceContext = in.readOptionalWriteable(FetchSourceContext::new); }