Esempio n. 1
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeVInt(1); // version
   out.writeUTF(uid.field());
   out.writeUTF(uid.text());
   out.writeLong(version);
 }
  @Override
  public void writeTo(StreamOutput out) throws IOException {
    shardId.writeTo(out);

    out.writeVInt(phase1FileNames.size());
    for (String phase1FileName : phase1FileNames) {
      out.writeUTF(phase1FileName);
    }

    out.writeVInt(phase1FileSizes.size());
    for (Long phase1FileSize : phase1FileSizes) {
      out.writeVLong(phase1FileSize);
    }

    out.writeVInt(phase1ExistingFileNames.size());
    for (String phase1ExistingFileName : phase1ExistingFileNames) {
      out.writeUTF(phase1ExistingFileName);
    }

    out.writeVInt(phase1ExistingFileSizes.size());
    for (Long phase1ExistingFileSize : phase1ExistingFileSizes) {
      out.writeVLong(phase1ExistingFileSize);
    }

    out.writeVLong(phase1TotalSize);
    out.writeVLong(phase1ExistingTotalSize);
  }
  @Override
  public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);
    out.writeVInt(phase1FileNames.size());
    for (String name : phase1FileNames) {
      out.writeUTF(name);
    }
    out.writeVInt(phase1FileSizes.size());
    for (long size : phase1FileSizes) {
      out.writeVLong(size);
    }

    out.writeVInt(phase1ExistingFileNames.size());
    for (String name : phase1ExistingFileNames) {
      out.writeUTF(name);
    }
    out.writeVInt(phase1ExistingFileSizes.size());
    for (long size : phase1ExistingFileSizes) {
      out.writeVLong(size);
    }

    out.writeVLong(phase1TotalSize);
    out.writeVLong(phase1ExistingTotalSize);
    out.writeVLong(phase1Time);
    out.writeVLong(phase1ThrottlingWaitTime);
    out.writeVLong(startTime);
    out.writeVInt(phase2Operations);
    out.writeVLong(phase2Time);
    out.writeVInt(phase3Operations);
    out.writeVLong(phase3Time);
  }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeUTF(index);
   out.writeVInt(shardId);
   out.writeByte(searchType.id());
   out.writeVInt(numberOfShards);
   if (scroll == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     scroll.writeTo(out);
   }
   out.writeBytesReference(source);
   out.writeBytesReference(extraSource);
   out.writeVInt(types.length);
   for (String type : types) {
     out.writeUTF(type);
   }
   if (filteringAliases != null) {
     out.writeVInt(filteringAliases.length);
     for (String index : filteringAliases) {
       out.writeUTF(index);
     }
   } else {
     out.writeVInt(0);
   }
   out.writeVLong(nowInMillis);
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeUTF(name);
   out.writeVLong(length);
   if (checksum == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     out.writeUTF(checksum);
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeUTF(nodeName);
   out.writeUTF(nodeId);
   addressToStream(out, address);
   out.writeVInt(attributes.size());
   for (Map.Entry<String, String> entry : attributes.entrySet()) {
     out.writeUTF(entry.getKey());
     out.writeUTF(entry.getValue());
   }
   Version.writeVersion(version, out);
 }
Esempio n. 7
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeUTF(type);
   out.writeUTF(id);
   if (routing == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     out.writeUTF(routing);
   }
   out.writeBoolean(refresh);
 }
 public static void writeTo(IndexTemplateMetaData indexTemplateMetaData, StreamOutput out)
     throws IOException {
   out.writeUTF(indexTemplateMetaData.name());
   out.writeInt(indexTemplateMetaData.order());
   out.writeUTF(indexTemplateMetaData.template());
   ImmutableSettings.writeSettingsToStream(indexTemplateMetaData.settings(), out);
   out.writeVInt(indexTemplateMetaData.mappings().size());
   for (Map.Entry<String, CompressedString> entry :
       indexTemplateMetaData.mappings().entrySet()) {
     out.writeUTF(entry.getKey());
     entry.getValue().writeTo(out);
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeUTF(cause);
   out.writeUTF(name);
   out.writeUTF(template);
   out.writeInt(order);
   out.writeBoolean(create);
   writeSettingsToStream(settings, out);
   timeout.writeTo(out);
   out.writeVInt(mappings.size());
   for (Map.Entry<String, String> entry : mappings.entrySet()) {
     out.writeUTF(entry.getKey());
     out.writeUTF(entry.getValue());
   }
 }
Esempio n. 10
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeVInt(0); // version
   out.writeVInt(source.length);
   out.writeBytes(source);
   if (queryParserName == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     out.writeUTF(queryParserName);
   }
   out.writeVInt(types.length);
   for (String type : types) {
     out.writeUTF(type);
   }
 }
Esempio n. 11
0
 public static void writeTo(IndexMetaData indexMetaData, StreamOutput out) throws IOException {
   out.writeUTF(indexMetaData.index());
   out.writeLong(indexMetaData.version());
   out.writeByte(indexMetaData.state().id());
   writeSettingsToStream(indexMetaData.settings(), out);
   out.writeVInt(indexMetaData.mappings().size());
   for (MappingMetaData mappingMd : indexMetaData.mappings().values()) {
     MappingMetaData.writeTo(mappingMd, out);
   }
   out.writeVInt(indexMetaData.aliases().size());
   for (AliasMetaData aliasMd : indexMetaData.aliases().values()) {
     AliasMetaData.Builder.writeTo(aliasMd, out);
   }
   out.writeVInt(indexMetaData.customs().size());
   for (Map.Entry<String, Custom> entry : indexMetaData.customs().entrySet()) {
     out.writeUTF(entry.getKey());
     lookupFactorySafe(entry.getKey()).writeTo(entry.getValue(), out);
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   if (indices == null) {
     out.writeVInt(0);
   } else {
     out.writeVInt(indices.length);
     for (String index : indices) {
       out.writeUTF(index);
     }
   }
   out.writeByte(operationThreading.id());
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeVInt(id);
   out.writeUTF(description);
   out.writeVInt(levels.length);
   for (ClusterBlockLevel level : levels) {
     out.writeVInt(level.id());
   }
   out.writeBoolean(retryable);
   out.writeBoolean(disableStatePersistence);
   RestStatus.writeTo(out, status);
 }
 public static void writeTo(DiscoveryNodes nodes, StreamOutput out) throws IOException {
   if (nodes.masterNodeId() == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     out.writeUTF(nodes.masterNodeId);
   }
   out.writeVInt(nodes.size());
   for (DiscoveryNode node : nodes) {
     node.writeTo(out);
   }
 }
Esempio n. 15
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeVInt(3); // version
   out.writeUTF(id);
   out.writeUTF(type);
   out.writeVInt(source.length);
   out.writeBytes(source);
   if (routing == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     out.writeUTF(routing);
   }
   if (parent == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     out.writeUTF(parent);
   }
   out.writeLong(version);
 }
  @Override
  public void writeTo(StreamOutput out) throws IOException {
    out.writeUTF(name);
    out.writeByte(comparatorType.id());
    out.writeVInt(requiredSize);
    out.writeVLong(missing);

    out.writeVInt(entries.size());
    for (IntEntry entry : entries) {
      out.writeInt(entry.term);
      out.writeVInt(entry.count());
    }
  }
  @Override
  public void writeTo(StreamOutput out) throws IOException {
    out.writeUTF(clusterName);
    out.writeVInt(activePrimaryShards);
    out.writeVInt(activeShards);
    out.writeVInt(relocatingShards);
    out.writeVInt(initializingShards);
    out.writeVInt(unassignedShards);
    out.writeVInt(numberOfNodes);
    out.writeVInt(numberOfDataNodes);
    out.writeByte(status.value());
    out.writeVInt(indices.size());
    for (ClusterIndexHealth indexHealth : this) {
      indexHealth.writeTo(out);
    }
    out.writeBoolean(timedOut);

    out.writeVInt(validationFailures.size());
    for (String failure : validationFailures) {
      out.writeUTF(failure);
    }
  }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeBoolean(valid);
   if (failures == null) {
     out.writeVInt(0);
   } else {
     out.writeVInt(failures.size());
     for (String failure : failures) {
       out.writeUTF(failure);
     }
   }
   if (indicesFailures == null) {
     out.writeVInt(0);
   } else {
     out.writeVInt(indicesFailures.size());
     for (Map.Entry<String, List<String>> entry : indicesFailures.entrySet()) {
       out.writeUTF(entry.getKey());
       out.writeVInt(entry.getValue().size());
       for (String failure : entry.getValue()) {
         out.writeUTF(failure);
       }
     }
   }
 }
Esempio n. 19
0
 public static void writeExplanation(StreamOutput out, Explanation explanation)
     throws IOException {
   out.writeFloat(explanation.getValue());
   out.writeUTF(explanation.getDescription());
   Explanation[] subExplanations = explanation.getDetails();
   if (subExplanations == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     out.writeVInt(subExplanations.length);
     for (Explanation subExp : subExplanations) {
       writeExplanation(out, subExp);
     }
   }
 }
  public void writeTo(StreamOutput out) throws IOException {
    super.writeTo(out);

    out.writeVInt(querySourceLength);
    out.writeBytes(querySource, querySourceOffset, querySourceLength);

    if (queryParserName == null) {
      out.writeBoolean(false);
    } else {
      out.writeBoolean(true);
      out.writeUTF(queryParserName);
    }
    if (routing == null) {
      out.writeBoolean(false);
    } else {
      out.writeBoolean(true);
      out.writeUTF(routing);
    }

    out.writeVInt(types.length);
    for (String type : types) {
      out.writeUTF(type);
    }
  }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   if (nodesIds == null) {
     out.writeVInt(0);
   } else {
     out.writeVInt(nodesIds.length);
     for (String nodeId : nodesIds) {
       out.writeUTF(nodeId);
     }
   }
   if (timeout == null) {
     out.writeBoolean(false);
   } else {
     out.writeBoolean(true);
     timeout.writeTo(out);
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeUTF(index);
   out.writeVInt(successfulShards);
   out.writeVInt(failedShards);
 }
Esempio n. 23
0
  public static void writeTopDocs(StreamOutput out, TopDocs topDocs, int from) throws IOException {
    if (topDocs.scoreDocs.length - from < 0) {
      out.writeBoolean(false);
      return;
    }
    out.writeBoolean(true);
    if (topDocs instanceof TopFieldDocs) {
      out.writeBoolean(true);
      TopFieldDocs topFieldDocs = (TopFieldDocs) topDocs;

      out.writeVInt(topDocs.totalHits);
      out.writeFloat(topDocs.getMaxScore());

      out.writeVInt(topFieldDocs.fields.length);
      for (SortField sortField : topFieldDocs.fields) {
        if (sortField.getField() == null) {
          out.writeBoolean(false);
        } else {
          out.writeBoolean(true);
          out.writeUTF(sortField.getField());
        }
        if (sortField.getComparatorSource() != null) {
          out.writeVInt(
              ((FieldDataType.ExtendedFieldComparatorSource) sortField.getComparatorSource())
                  .reducedType());
        } else {
          out.writeVInt(sortField.getType());
        }
        out.writeBoolean(sortField.getReverse());
      }

      out.writeVInt(topDocs.scoreDocs.length - from);
      int index = 0;
      for (ScoreDoc doc : topFieldDocs.scoreDocs) {
        if (index++ < from) {
          continue;
        }
        FieldDoc fieldDoc = (FieldDoc) doc;
        out.writeVInt(fieldDoc.fields.length);
        for (Object field : fieldDoc.fields) {
          if (field == null) {
            out.writeByte((byte) 0);
          } else {
            Class type = field.getClass();
            if (type == String.class) {
              out.writeByte((byte) 1);
              out.writeUTF((String) field);
            } else if (type == Integer.class) {
              out.writeByte((byte) 2);
              out.writeInt((Integer) field);
            } else if (type == Long.class) {
              out.writeByte((byte) 3);
              out.writeLong((Long) field);
            } else if (type == Float.class) {
              out.writeByte((byte) 4);
              out.writeFloat((Float) field);
            } else if (type == Double.class) {
              out.writeByte((byte) 5);
              out.writeDouble((Double) field);
            } else if (type == Byte.class) {
              out.writeByte((byte) 6);
              out.writeByte((Byte) field);
            } else if (type == Short.class) {
              out.writeByte((byte) 7);
              out.writeShort((Short) field);
            } else if (type == Boolean.class) {
              out.writeByte((byte) 8);
              out.writeBoolean((Boolean) field);
            } else {
              throw new IOException("Can't handle sort field value of type [" + type + "]");
            }
          }
        }

        out.writeVInt(doc.doc);
        out.writeFloat(doc.score);
      }
    } else {
      out.writeBoolean(false);
      out.writeVInt(topDocs.totalHits);
      out.writeFloat(topDocs.getMaxScore());

      out.writeVInt(topDocs.scoreDocs.length - from);
      int index = 0;
      for (ScoreDoc doc : topDocs.scoreDocs) {
        if (index++ < from) {
          continue;
        }
        out.writeVInt(doc.doc);
        out.writeFloat(doc.score);
      }
    }
  }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeUTF(nodeId);
 }