@Override
  public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    if (in.getVersion().before(Version.V_1_4_0)) {
      // term vector used to read & write the index twice, here and in the parent class
      in.readString();
    }
    type = in.readString();
    id = in.readString();

    if (in.getVersion().onOrAfter(Version.V_1_4_0)) {
      if (in.readBoolean()) {
        doc = in.readBytesReference();
      }
    }
    routing = in.readOptionalString();
    preference = in.readOptionalString();
    long flags = in.readVLong();

    flagsEnum.clear();
    for (Flag flag : Flag.values()) {
      if ((flags & (1 << flag.ordinal())) != 0) {
        flagsEnum.add(flag);
      }
    }
    int numSelectedFields = in.readVInt();
    if (numSelectedFields > 0) {
      selectedFields = new HashSet<>();
      for (int i = 0; i < numSelectedFields; i++) {
        selectedFields.add(in.readString());
      }
    }
  }
Example #2
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   cause = in.readString();
   index = in.readString();
   settings = readSettingsFromStream(in);
   readTimeout(in);
   int size = in.readVInt();
   for (int i = 0; i < size; i++) {
     mappings.put(in.readString(), in.readString());
   }
   int customSize = in.readVInt();
   for (int i = 0; i < customSize; i++) {
     String type = in.readString();
     IndexMetaData.Custom customIndexMetaData =
         IndexMetaData.lookupPrototypeSafe(type).readFrom(in);
     customs.put(type, customIndexMetaData);
   }
   int aliasesSize = in.readVInt();
   for (int i = 0; i < aliasesSize; i++) {
     aliases.add(Alias.read(in));
   }
   updateAllTypes = in.readBoolean();
   waitForActiveShards = ActiveShardCount.readFrom(in);
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   version = in.readString();
   vmName = in.readString();
   vmVersion = in.readString();
   vmVendor = in.readString();
 }
 @Override
 public IndexMetaData readFrom(StreamInput in) throws IOException {
   Builder builder = new Builder(in.readString());
   builder.version(in.readLong());
   builder.state(State.fromId(in.readByte()));
   builder.settings(readSettingsFromStream(in));
   int mappingsSize = in.readVInt();
   for (int i = 0; i < mappingsSize; i++) {
     MappingMetaData mappingMd = MappingMetaData.PROTO.readFrom(in);
     builder.putMapping(mappingMd);
   }
   int aliasesSize = in.readVInt();
   for (int i = 0; i < aliasesSize; i++) {
     AliasMetaData aliasMd = AliasMetaData.Builder.readFrom(in);
     builder.putAlias(aliasMd);
   }
   int customSize = in.readVInt();
   for (int i = 0; i < customSize; i++) {
     String type = in.readString();
     Custom customIndexMetaData = lookupPrototypeSafe(type).readFrom(in);
     builder.putCustom(type, customIndexMetaData);
   }
   int activeAllocationIdsSize = in.readVInt();
   for (int i = 0; i < activeAllocationIdsSize; i++) {
     int key = in.readVInt();
     Set<String> allocationIds =
         DiffableUtils.StringSetValueSerializer.getInstance().read(in, key);
     builder.putActiveAllocationIds(key, allocationIds);
   }
   return builder.build();
 }
Example #5
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   pid = in.readLong();
   version = in.readString();
   vmName = in.readString();
   vmVersion = in.readString();
   vmVendor = in.readString();
   startTime = in.readLong();
   inputArguments = new String[in.readInt()];
   for (int i = 0; i < inputArguments.length; i++) {
     inputArguments[i] = in.readString();
   }
   bootClassPath = in.readString();
   classPath = in.readString();
   systemProperties = new HashMap<>();
   int size = in.readInt();
   for (int i = 0; i < size; i++) {
     systemProperties.put(in.readString(), in.readString());
   }
   mem = new Mem();
   mem.readFrom(in);
   gcCollectors = in.readStringArray();
   memoryPools = in.readStringArray();
   useCompressedOops = in.readString();
 }
  @Override
  public void readFrom(StreamInput in) throws IOException {
    index = in.readString();
    numberOfShards = in.readVInt();
    numberOfReplicas = in.readVInt();
    activePrimaryShards = in.readVInt();
    activeShards = in.readVInt();
    relocatingShards = in.readVInt();
    initializingShards = in.readVInt();
    unassignedShards = in.readVInt();
    status = ClusterHealthStatus.fromValue(in.readByte());

    int size = in.readVInt();
    for (int i = 0; i < size; i++) {
      ClusterShardHealth shardHealth = readClusterShardHealth(in);
      shards.put(shardHealth.getId(), shardHealth);
    }
    size = in.readVInt();
    if (size == 0) {
      validationFailures = ImmutableList.of();
    } else {
      for (int i = 0; i < size; i++) {
        validationFailures.add(in.readString());
      }
    }
  }
 public static Settings readSettingsFromStream(StreamInput in) throws IOException {
   Builder builder = new Builder();
   int numberOfSettings = in.readVInt();
   for (int i = 0; i < numberOfSettings; i++) {
     builder.put(in.readString(), in.readString());
   }
   return builder.build();
 }
 /** Read from a stream. */
 public StoreFileMetaData(StreamInput in) throws IOException {
   name = in.readString();
   length = in.readVLong();
   checksum = in.readString();
   // TODO Why not Version.parse?
   writtenBy = Lucene.parseVersionLenient(in.readString(), FIRST_LUCENE_CHECKSUM_VERSION);
   hash = in.readBytesRef();
 }
Example #9
0
 Cgroup(final StreamInput in) throws IOException {
   cpuAcctControlGroup = in.readString();
   cpuAcctUsageNanos = in.readLong();
   cpuControlGroup = in.readString();
   cpuCfsPeriodMicros = in.readLong();
   cpuCfsQuotaMicros = in.readLong();
   cpuStat = new CpuStat(in);
 }
 /** Read from a stream. */
 public BucketSelectorPipelineAggregationBuilder(StreamInput in) throws IOException {
   super(in, NAME);
   int mapSize = in.readVInt();
   bucketsPathsMap = new HashMap<String, String>(mapSize);
   for (int i = 0; i < mapSize; i++) {
     bucketsPathsMap.put(in.readString(), in.readString());
   }
   script = new Script(in);
   gapPolicy = GapPolicy.readFrom(in);
 }
 @Override
 public TermsLookup readFrom(StreamInput in) throws IOException {
   String type = in.readString();
   String id = in.readString();
   String path = in.readString();
   String index = in.readOptionalString();
   TermsLookup termsLookup = new TermsLookup(index, type, id, path);
   termsLookup.routing = in.readOptionalString();
   return termsLookup;
 }
Example #12
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   MapBuilder<String, String> builder = MapBuilder.newMapBuilder();
   for (int i = in.readVInt(); i > 0; i--) {
     builder.put(in.readString(), in.readString());
   }
   userData = builder.immutableMap();
   generation = in.readLong();
   id = in.readOptionalString();
   numDocs = in.readInt();
 }
 @Override
 protected Builder doReadFrom(StreamInput in) throws IOException {
   String field = in.readString();
   String geohash = in.readString();
   Builder builder = new Builder(field, geohash);
   if (in.readBoolean()) {
     builder.precision(in.readVInt());
   }
   builder.neighbors(in.readBoolean());
   return builder;
 }
Example #14
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   name = in.readString();
   int numParts = in.readVInt();
   if (numParts > 0) {
     path = new ArrayList<>(numParts);
     for (int i = 0; i < numParts; i++) {
       path.add(in.readString());
     }
   } else {
     path = ImmutableList.of();
   }
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   snapshot = in.readString();
   repository = in.readString();
   indices = in.readStringArray();
   indicesOptions = IndicesOptions.readIndicesOptions(in);
   renamePattern = in.readOptionalString();
   renameReplacement = in.readOptionalString();
   waitForCompletion = in.readBoolean();
   includeGlobalState = in.readBoolean();
   settings = readSettingsFromStream(in);
 }
    @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);
    }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   index = in.readString();
   type = in.readString();
   id = in.readString();
   docVersion = in.readVLong();
   exists = in.readBoolean();
   artificial = in.readBoolean();
   tookInMillis = in.readVLong();
   if (in.readBoolean()) {
     headerRef = in.readBytesReference();
     termVectors = in.readBytesReference();
   }
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   type = in.readString();
   id = in.readString();
   routing = in.readOptionalString();
   preference = in.readOptionalString();
   source = in.readBytesReference();
   sourceUnsafe = false;
   filteringAlias = in.readStringArray();
   if (in.readBoolean()) {
     fields = in.readStringArray();
   }
 }
Example #19
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   this.name = in.readString();
   if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta)) {
     this.docCountError = in.readLong();
   } else {
     this.docCountError = -1;
   }
   this.order = InternalOrder.Streams.readOrder(in);
   this.formatter = ValueFormatterStreams.readOptional(in);
   this.requiredSize = readSize(in);
   if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta)) {
     this.shardSize = readSize(in);
     this.showTermDocCountError = in.readBoolean();
   } else {
     this.shardSize = requiredSize;
     this.showTermDocCountError = false;
   }
   this.minDocCount = in.readVLong();
   int size = in.readVInt();
   List<InternalTerms.Bucket> buckets = new ArrayList<>(size);
   for (int i = 0; i < size; i++) {
     long term = in.readLong();
     long docCount = in.readVLong();
     long bucketDocCountError = -1;
     if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta) && showTermDocCountError) {
       bucketDocCountError = in.readLong();
     }
     InternalAggregations aggregations = InternalAggregations.readAggregations(in);
     buckets.add(
         new Bucket(term, docCount, aggregations, showTermDocCountError, bucketDocCountError));
   }
   this.buckets = buckets;
   this.bucketMap = null;
 }
Example #20
0
 public static AliasMetaData readFrom(StreamInput in) throws IOException {
   String alias = in.readString();
   CompressedString filter = null;
   if (in.readBoolean()) {
     filter = CompressedString.readCompressedString(in);
   }
   String indexRouting = null;
   if (in.readBoolean()) {
     indexRouting = in.readString();
   }
   String searchRouting = null;
   if (in.readBoolean()) {
     searchRouting = in.readString();
   }
   return new AliasMetaData(alias, filter, indexRouting, searchRouting);
 }
Example #21
0
    public IndexMetaDataDiff(StreamInput in) throws IOException {
      index = in.readString();
      version = in.readLong();
      state = State.fromId(in.readByte());
      settings = Settings.readSettingsFromStream(in);
      mappings =
          DiffableUtils.readImmutableOpenMapDiff(
              in, DiffableUtils.getStringKeySerializer(), MappingMetaData.PROTO);
      aliases =
          DiffableUtils.readImmutableOpenMapDiff(
              in, DiffableUtils.getStringKeySerializer(), AliasMetaData.PROTO);
      customs =
          DiffableUtils.readImmutableOpenMapDiff(
              in,
              DiffableUtils.getStringKeySerializer(),
              new DiffableUtils.DiffableValueSerializer<String, Custom>() {
                @Override
                public Custom read(StreamInput in, String key) throws IOException {
                  return lookupPrototypeSafe(key).readFrom(in);
                }

                @Override
                public Diff<Custom> readDiff(StreamInput in, String key) throws IOException {
                  return lookupPrototypeSafe(key).readDiffFrom(in);
                }
              });
      activeAllocationIds =
          DiffableUtils.readImmutableOpenIntMapDiff(
              in,
              DiffableUtils.getVIntKeySerializer(),
              DiffableUtils.StringSetValueSerializer.getInstance());
    }
Example #22
0
  @Override
  public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    type = in.readString();
    id = in.readString();
    routing = in.readOptionalString();
    preference = in.readOptionalString();
    source = in.readBytesReference();
    filteringAlias = in.readStringArray();
    if (in.readBoolean()) {
      fields = in.readStringArray();
    }

    fetchSourceContext = FetchSourceContext.optionalReadFromStream(in);
    nowInMillis = in.readVLong();
  }
Example #23
0
    public MetaDataDiff(StreamInput in) throws IOException {
      clusterUUID = in.readString();
      version = in.readLong();
      transientSettings = Settings.readSettingsFromStream(in);
      persistentSettings = Settings.readSettingsFromStream(in);
      indices =
          DiffableUtils.readImmutableOpenMapDiff(
              in, DiffableUtils.getStringKeySerializer(), IndexMetaData.PROTO);
      templates =
          DiffableUtils.readImmutableOpenMapDiff(
              in, DiffableUtils.getStringKeySerializer(), IndexTemplateMetaData.PROTO);
      customs =
          DiffableUtils.readImmutableOpenMapDiff(
              in,
              DiffableUtils.getStringKeySerializer(),
              new DiffableUtils.DiffableValueSerializer<String, Custom>() {
                @Override
                public Custom read(StreamInput in, String key) throws IOException {
                  return lookupPrototypeSafe(key).readFrom(in);
                }

                @Override
                public Diff<Custom> readDiff(StreamInput in, String key) throws IOException {
                  return lookupPrototypeSafe(key).readDiffFrom(in);
                }
              });
    }
  protected String handleRequest(
      Channel channel, StreamInput buffer, long requestId, Version version) throws IOException {
    final String action = buffer.readString();

    final NettyTransportChannel transportChannel =
        new NettyTransportChannel(transport, action, channel, requestId, version);
    try {
      final TransportRequestHandler handler = transportServiceAdapter.handler(action);
      if (handler == null) {
        throw new ActionNotFoundTransportException(action);
      }
      final TransportRequest request = handler.newInstance();
      request.remoteAddress(
          new InetSocketTransportAddress((InetSocketAddress) channel.getRemoteAddress()));
      request.readFrom(buffer);
      if (handler.executor() == ThreadPool.Names.SAME) {
        //noinspection unchecked
        handler.messageReceived(request, transportChannel);
      } else {
        threadPool
            .executor(handler.executor())
            .execute(new RequestHandler(handler, request, transportChannel, action));
      }
    } catch (Throwable e) {
      try {
        transportChannel.sendResponse(e);
      } catch (IOException e1) {
        logger.warn("Failed to send error message back to client for action [" + action + "]", e);
        logger.warn("Actual Exception", e1);
      }
    }
    return action;
  }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   replicationType = ReplicationType.fromId(in.readByte());
   consistencyLevel = WriteConsistencyLevel.fromId(in.readByte());
   timeout = TimeValue.readTimeValue(in);
   index = in.readString();
 }
 /** Read from a stream. */
 public HasParentQueryBuilder(StreamInput in) throws IOException {
   super(in);
   type = in.readString();
   score = in.readBoolean();
   query = in.readNamedWriteable(QueryBuilder.class);
   innerHit = in.readOptionalWriteable(InnerHitBuilder::new);
   ignoreUnmapped = in.readBoolean();
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   term = in.readString();
   startOffset = in.readInt();
   endOffset = in.readInt();
   position = in.readVInt();
   type = in.readOptionalString();
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   int size = in.readVInt();
   ImmutableOpenMap.Builder<String, ImmutableOpenMap<String, MappingMetaData>> indexMapBuilder =
       ImmutableOpenMap.builder();
   for (int i = 0; i < size; i++) {
     String key = in.readString();
     int valueSize = in.readVInt();
     ImmutableOpenMap.Builder<String, MappingMetaData> typeMapBuilder = ImmutableOpenMap.builder();
     for (int j = 0; j < valueSize; j++) {
       typeMapBuilder.put(in.readString(), new MappingMetaData(in));
     }
     indexMapBuilder.put(key, typeMapBuilder.build());
   }
   mappings = indexMapBuilder.build();
 }
    @Override
    public void readFrom(StreamInput in) throws IOException {
      index = in.readString();
      type = in.readOptionalString();
      id = in.readString();
      routing = in.readOptionalString();
      int size = in.readVInt();
      if (size > 0) {
        fields = new String[size];
        for (int i = 0; i < size; i++) {
          fields[i] = in.readString();
        }
      }
      version = in.readLong();
      versionType = VersionType.fromValue(in.readByte());

      fetchSourceContext = FetchSourceContext.optionalReadFromStream(in);
    }
 @Override
 public SignificanceHeuristic readResult(StreamInput in) throws IOException {
   return new ScriptHeuristic(
       null,
       in.readOptionalString(),
       in.readString(),
       ScriptService.ScriptType.readFrom(in),
       in.readMap());
 }